/** * @see \wbb\data\DatabaseObjectList::__construct() */ public function __construct() { parent::__construct(); // get object types $entryObjectType = EntryModificationLogHandler::getInstance()->getObjectType('de.incendium.linklist.entry'); $this->entryObjectTypeID = $entryObjectType->objectTypeID; }
/** * Initializes the entry list modification log list. * * @param array<integer> $entryIDs * @param string $action */ public function setEntryData(array $entryIDs, $action = '') { // load object type id $objectType = EntryModificationLogHandler::getInstance()->getObjectType('de.incendium.linklist.entry'); // add conditions $this->getConditionBuilder()->add("objectTypeID = ?", array($objectType->objectTypeID)); $this->getConditionBuilder()->add("objectID IN (?)", array($entryIDs)); if (!empty($action)) { $this->getConditionBuilder()->add("action = ?", array($action)); } }
/** * @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(); }