本文整理汇总了PHP中JUDownloadHelper::deleteLogs方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::deleteLogs方法的具体用法?PHP JUDownloadHelper::deleteLogs怎么用?PHP JUDownloadHelper::deleteLogs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::deleteLogs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($pk = null)
{
$k = $this->_tbl_key;
$pk = is_null($pk) ? $this->{$k} : $pk;
if (parent::delete($pk)) {
$db = JFactory::getDbo();
$query = "DELETE FROM #__judownload_criterias_values WHERE rating_id = {$pk}";
$db->setQuery($query);
$db->execute();
JUDownloadHelper::deleteLogs('rating', $pk);
return true;
}
return false;
}
示例2: _delete
protected function _delete($comment)
{
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/tables');
$db = $this->_db;
$query = "DELETE FROM #__judownload_subscriptions WHERE item_id = " . $comment->id . " AND type = 'comment'";
$db->setQuery($query);
$db->execute();
$query = "DELETE FROM #__judownload_reports WHERE item_id = " . $comment->id . " AND type = 'comment'";
$db->setQuery($query);
$db->execute();
$query = "SELECT r.id FROM #__judownload_rating AS r JOIN #__judownload_comments AS cm ON r.id = cm.rating_id WHERE cm.id = " . $comment->id;
$db->setQuery($query);
$ratingIds = $db->loadColumn();
if ($ratingIds) {
$ratingTable = JTable::getInstance("Rating", "JUDownloadTable");
foreach ($ratingIds as $ratingId) {
$ratingTable->delete($ratingId);
}
}
if ($comment->parent_id == 0 && $comment->approved == 1) {
$query = "SELECT SUM(score) AS total_ratings, COUNT(*) AS total_votes FROM #__judownload_rating AS rating LEFT JOIN #__judownload_comments AS comment ON (comment.rating_id = rating.id AND comment.approved = 1) WHERE rating.doc_id = " . $comment->doc_id;
$db->setQuery($query);
$score = $db->loadObject();
$document_table = JTable::getInstance("Document", "JUDownloadTable");
if ($document_table->load($comment->doc_id)) {
if ($score->total_votes > 0) {
$document_table->rating = (double) $score->total_ratings / $score->total_votes;
} else {
$document_table->rating = 0;
}
$document_table->total_votes = $score->total_votes;
$document_table->store();
}
}
$query = "DELETE FROM #__judownload_mailqs\r\n\t\t\t WHERE item_id =" . $comment->id . "\r\n\t\t\t\t\t\tAND email_id IN (SELECT id FROM #__judownload_emails WHERE (`event` LIKE 'comment.%' and `event` != 'comment.delete'))";
$db->setQuery($query);
$db->execute();
JUDownloadHelper::deleteLogs('comment', $comment->id);
return true;
}
示例3: delete
//.........这里部分代码省略.........
if ($canDeleteDocIds) {
foreach ($canDeleteDocIds as $docId) {
if (!$documentTable->delete($docId)) {
$this->setError($documentTable->getError());
return false;
}
}
}
$canDeleteCatIds = array_unique($canDeleteCatIds);
if ($canDeleteCatIds) {
foreach ($canDeleteCatIds as $pk) {
if ($table->load($pk)) {
$context = $this->option . '.' . $this->name;
$result = $dispatcher->trigger($this->event_before_delete, array($context, $table));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
if (!$table->delete($pk, false)) {
$this->setError($table->getError());
return false;
} else {
$query = "DELETE FROM #__judownload_categories_relations WHERE cat_id=" . $pk;
$db->setQuery($query);
$db->execute();
$query = "DELETE FROM #__judownload_documents_xref WHERE main=0 AND cat_id=" . $pk;
$db->setQuery($query);
$db->execute();
$query = "SELECT mod_id FROM #__judownload_moderators_xref WHERE cat_id = " . $pk;
$db->setQuery($query);
$moderatorIds = $db->loadColumn();
$query = "DELETE FROM #__judownload_moderators_xref WHERE cat_id=" . $pk;
$db->setQuery($query);
$db->execute();
if ($moderatorIds) {
$modTable = JTable::getInstance("Moderator", "JUDownloadTable");
foreach ($moderatorIds as $moderatorId) {
$query = $db->getQuery(true);
$query->select('COUNT(*)');
$query->from('#__judownload_moderators AS m');
$query->join('', '#__judownload_moderators_xref AS mxref ON m.id = mxref.mod_id');
$query->where('m.id =' . $moderatorId);
$db->setQuery($query);
$totalModeratedCats = $db->loadResult();
if ($totalModeratedCats <= 0) {
$modTable->reset();
if ($modTable->load(array($moderatorId))) {
$modTable->delete();
}
}
}
}
$images = json_decode($table->images);
if (is_object($images)) {
if ($images->intro_image) {
$intro_image = JUDownloadFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judownload/images/category/intro/') . $images->intro_image;
$ori_intro_image = JUDownloadFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judownload/images/category/intro/') . "original/" . $images->intro_image;
if (JFile::exists(JPATH_ROOT . "/" . $ori_intro_image)) {
JFile::delete(JPATH_ROOT . "/" . $ori_intro_image);
}
if (JFile::exists(JPATH_ROOT . "/" . $intro_image)) {
JFile::delete(JPATH_ROOT . "/" . $intro_image);
}
}
if ($images->detail_image) {
$detail_image = JUDownloadFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judownload/images/category/detail/') . $images->detail_image;
$ori_detail_image = JUDownloadFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judownload/images/category/detail/') . "original/" . $images->detail_image;
if (JFile::exists(JPATH_ROOT . "/" . $detail_image)) {
JFile::delete(JPATH_ROOT . "/" . $detail_image);
}
if (JFile::exists(JPATH_ROOT . "/" . $ori_detail_image)) {
JFile::delete(JPATH_ROOT . "/" . $ori_detail_image);
}
}
}
if ($table->level == 0 || $table->level == 1) {
$query = "DELETE FROM #__judownload_emails_xref WHERE cat_id = " . $table->id;
$db->setQuery($query);
$db->execute();
}
JUDownloadHelper::deleteLogs('category', $pk);
$query = "DELETE FROM #__judownload_fields_ordering WHERE `item_id` = " . $table->id . " AND `type` = 'category'";
$db->setQuery($query);
$db->execute();
$dispatcher->trigger($this->event_after_delete, array($context, $table));
}
}
}
}
if ($canDeleteCatIds) {
$app = JFactory::getApplication();
$app->enqueueMessage(JText::plural('COM_JUDOWNLOAD_CATEGORIES_N_ITEMS_DELETED', count($canDeleteCatIds)));
}
$canNotDeleteCatIds = array_unique($canNotDeleteCatIds);
if ($canNotDeleteCatIds) {
JError::raiseWarning(500, JText::plural('COM_JUDOWNLOAD_CATEGORIES_N_ITEMS_NOT_DELETED', count($canNotDeleteCatIds)));
}
$this->cleanCache();
return true;
}
示例4: delete
public function delete($pk = null)
{
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/tables');
$k = $this->_tbl_key;
$pk = is_null($pk) ? $this->{$k} : $pk;
$db = JFactory::getDbo();
$query = "DELETE FROM #__judownload_subscriptions WHERE item_id = {$pk} AND type = 'document'";
$db->setQuery($query);
$db->execute();
$query = "SELECT * FROM #__judownload_comments WHERE doc_id = " . $pk;
$db->setQuery($query);
$commentIds = $db->loadColumn();
if ($commentIds) {
$commentTable = JTable::getInstance("Comment", "JUDownloadTable");
foreach ($commentIds as $commentId) {
$commentTable->delete($commentId);
}
}
$query = "SELECT id FROM #__judownload_rating WHERE doc_id = {$pk}";
$db->setQuery($query);
$ratingItemIds = $db->loadColumn();
if ($ratingItemIds) {
$ratingTable = JTable::getInstance("Rating", "JUDownloadTable");
foreach ($ratingItemIds as $ratingItemId) {
$ratingTable->delete($ratingItemId);
}
}
$query = "DELETE FROM #__judownload_reports WHERE item_id = {$pk} AND type = 'document'";
$db->setQuery($query);
$db->execute();
$query = "SELECT id FROM #__judownload_collections_items WHERE doc_id = {$pk}";
$db->setQuery($query);
$collectionItemIds = $db->loadColumn();
if ($collectionItemIds) {
$collectionItemTable = JTable::getInstance("CollectionItem", "JUDownloadTable");
foreach ($collectionItemIds as $collectionItemId) {
$collectionItemTable->delete($collectionItemId);
}
}
JUDownloadHelper::deleteLogs('document', $pk);
$query = "DELETE FROM #__judownload_mailqs\r\n\t\t\t WHERE item_id =" . $pk . "\r\n\t\t\t\t\t\tAND email_id IN (SELECT id FROM #__judownload_emails WHERE (`event` LIKE 'document.%' AND `event` != 'document.delete'))";
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__judownload_documents');
$query->where('approved=' . -$pk);
$db->setQuery($query);
$tempDocIds = $db->loadColumn();
if (count($tempDocIds)) {
foreach ($tempDocIds as $tempDocId) {
$this->deleteMainData($tempDocId, true);
}
}
$cat_id = JUDownloadFrontHelperCategory::getMainCategoryId($this->id);
$this->deleteMainData($pk);
if (parent::delete($pk)) {
$app = JFactory::getApplication();
if ($app->isSite()) {
$registry = new JRegistry();
$registry->loadObject($this);
$mailData = $registry->toArray();
$mailData['cat_id'] = $cat_id;
if ($this->approved < 1) {
JUDownloadFrontHelperMail::sendEmailByEvent('document.reject', $this->id, $mailData);
} else {
JUDownloadFrontHelperMail::sendEmailByEvent('document.delete', $this->id, $mailData);
}
}
return true;
} else {
return false;
}
}