/** * {@inheritdoc} */ public function delete() { //get classes $baseClass = $this->className; $articleClass = $baseClass::getBaseClass(); $attachedNewsIDs = array(); foreach ($this->objects as $article) { $this->objectIDs[] = $article->{$baseClass::getDatabaseTableIndexName()}; if ($article->attachments != 0) { $attachedObjectIDs[] = $article->{$baseClass::getDatabaseTableIndexName()}; } } // remove attachments if (0 !== count($attachedObjectIDs)) { AttachmentHandler::removeAttachments($articleClass::$objectType, $attachedObjectIDs); } return parent::delete(); }
/** * Deletes given entries. * * @return array<array> */ public function delete() { if (empty($this->objects)) { $this->readObjects(); } $entryIDs = $entyData = $attachmentEntryIDs = $userCounters = array(); foreach ($this->objects as $entry) { $entryData[$entry->entryID] = $entry->userID; $entryIDs[] = $entry->entryID; if ($entry->attachments) { $attachmentEntryIDs[] = $entry->entryID; } if (!$entry->isDisabled) { if (!isset($userToItems[$entry->userID])) { $userToItems[$entry->userID] = 0; } $userToItems[$entry->userID]++; } } // remove user activity events $this->removeActivityEvents($entryData); // remove files $fileList = new EntryFileList(); $fileList->getConditionBuilder()->add("file.entryID IN (?)", array(array_keys($entryData))); $fileList->readObjects(); $fileAction = new EntryFileAction($fileList->getObjects(), 'delete', array('ignoreEntries' => true)); $fileAction->executeAction(); // remove entries foreach ($this->objects as $entry) { $entry->delete(); $this->addEntryData($entry->getDecoratedObject(), 'deleted', LinkHandler::getInstance()->getLink('FilebaseOverview', array('application' => 'filebase'))); EntryModificationLogHandler::getInstance()->delete($entry->getDecoratedObject()); } if (!empty($entryIDs)) { // delete like data LikeHandler::getInstance()->removeLikes('de.incendium.filebase.likeableEntry', $entryIDs); // delete comments CommentHandler::getInstance()->deleteObjects('de.incendium.filebase.entryComment', $entryIDs); // delete tag to object entries TagEngine::getInstance()->deleteObjects('de.incendium.filebase.entry', $entryIDs); // delete entry from search index SearchIndexManager::getInstance()->delete('de.incendium.filebase.entry', $entryIDs); } // decrease user entry counter if (!empty($userCounters)) { EntryEditor::updateEntryCounter($userCounters); } // delete attachments if (!empty($attachmentEntryIDs)) { AttachmentHandler::removeAttachments('de.incendium.filebase.entry', $attachmentEntryIDs); } // delete subscriptions UserObjectWatchHandler::getInstance()->deleteObjects('de.incendium.filebase.entry', $entryIDs); $this->unmarkItems(); return $this->getEntryData(); }
/** * @see \wcf\data\AbstractDatabaseObjectAction::delete() */ public function delete() { $count = parent::delete(); $attachmentMessageIDs = $conversationIDs = array(); foreach ($this->objects as $message) { if (!in_array($message->conversationID, $conversationIDs)) { $conversationIDs[] = $message->conversationID; } if ($message->attachments) { $attachmentMessageIDs[] = $message->messageID; } } // rebuild conversations if (!empty($conversationIDs)) { $conversationAction = new ConversationAction($conversationIDs, 'rebuild'); $conversationAction->executeAction(); } if (!empty($this->objectIDs)) { // delete notifications UserNotificationHandler::getInstance()->deleteNotifications('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', array(), $this->objectIDs); // update search index SearchIndexManager::getInstance()->delete('com.woltlab.wcf.conversation.message', $this->objectIDs); // update embedded objects MessageEmbeddedObjectManager::getInstance()->removeObjects('com.woltlab.wcf.conversation.message', $this->objectIDs); // remove moderation queues ModerationQueueManager::getInstance()->removeQueues('com.woltlab.wcf.conversation.message', $this->objectIDs); } // remove attachments if (!empty($attachmentMessageIDs)) { AttachmentHandler::removeAttachments('com.woltlab.wcf.conversation.message', $attachmentMessageIDs); } return $count; }
/** * @see \wcf\data\IDeleteAction::delete() */ public function delete() { if (empty($this->objects)) { $this->readObjects(); } $entryIDs = $entyData = $attachmentEntryIDs = $userCounters = array(); foreach ($this->objects as $entry) { $entryData[$entry->entryID] = $entry->userID; $entryIDs[] = $entry->entryID; if ($entry->attachments) { $attachmentEntryIDs[] = $entry->entryID; } if (!$entry->isDisabled) { if (!isset($userToItems[$entry->userID])) { $userToItems[$entry->userID] = 0; } $userToItems[$entry->userID]++; } } // remove user activity events $this->removeActivityEvents($entryData); // remove entries foreach ($this->objects as $entry) { $entry->delete(); $this->addEntryData($entry->getDecoratedObject(), 'deleted', LinkHandler::getInstance()->getLink('LinklistOverview', array('application' => 'linklist'))); EntryModificationLogHandler::getInstance()->delete($entry->getDecoratedObject()); } if (!empty($entryIDs)) { // delete like data LikeHandler::getInstance()->removeLikes('de.incendium.linklist.likeableEntry', $entryIDs); // delete comments CommentHandler::getInstance()->deleteObjects('de.incendium.linklist.entryComment', $entryIDs); // delete tag to object entries TagEngine::getInstance()->deleteObjects('de.incendium.linklist.entry', $entryIDs); // delete entry from search index SearchIndexManager::getInstance()->delete('de.incendium.linklist.entry', $entryIDs); } // decrease user entry counter if (!empty($userCounters)) { EntryEditor::updateEntryCounter($userCounters); } // delete attachments if (!empty($attachmentEntryIDs)) { AttachmentHandler::removeAttachments('de.incendium.linklist.entry', $attachmentEntryIDs); } $this->unmarkItems(); return $this->getEntryData(); }
public function delete() { $newsIDs = array(); $attachedNewsIDs = array(); foreach ($this->objects as $news) { $newsIDs[] = $news->newsID; if ($news->attachments != 0) { $attachedNewsIDs[] = $news->newsID; } } // remove activity points UserActivityPointHandler::getInstance()->removeEvents('de.codequake.cms.activityPointEvent.news', $newsIDs); // remove attaches if (!empty($attachedNewsIDs)) { AttachmentHandler::removeAttachments('de.codequake.cms.news', $attachedNewsIDs); } // delete old search index entries if (!empty($objectIDs)) { SearchIndexManager::getInstance()->delete('de.codequake.cms.news', $newsIDs); } if (isset($this->parameters['unmarkItems'])) { $this->unmarkItems($newsIDs); } return parent::delete(); }