Esempio n. 1
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     parent::delete();
     if (!empty($this->objects)) {
         // identify i18n labels
         $languageVariables = array();
         foreach ($this->objects as $object) {
             if (preg_match('~wcf.acp.label.label\\d+~', $object->label)) {
                 $languageVariables[] = $object->label;
             }
         }
         // remove language variables
         if (!empty($languageVariables)) {
             $conditions = new PreparedStatementConditionBuilder();
             $conditions->add("languageItem IN (?)", array($languageVariables));
             $sql = "SELECT\tlanguageItemID\n\t\t\t\t\tFROM\twcf" . WCF_N . "_language_item\n\t\t\t\t\t" . $conditions;
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute($conditions->getParameters());
             $languageItemIDs = array();
             while ($row = $statement->fetchArray()) {
                 $languageItemIDs[] = $row['languageItemID'];
             }
             $objectAction = new LanguageItemAction($languageItemIDs, 'delete');
             $objectAction->executeAction();
         }
     }
 }
Esempio n. 2
0
	/**
	 * @see	wcf\data\AbstractDatabaseObjectAction::delete()
	 */
	public function delete() {
		$returnValues = parent::delete();
		
		PageMenuItemEditor::updateLandingPage();
		
		return $returnValues;
	}
Esempio n. 3
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $count = parent::delete();
     foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType') as $objectType) {
         $objectType->getProcessor()->save();
     }
     return $count;
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     // delete news update
     parent::delete();
     foreach ($this->objects as $entryUpdate) {
         $entry = new Entry($entryUpdate->entryID);
         $entry->updateEntryUpdates();
     }
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     // delete news update
     parent::delete();
     foreach ($this->objects as $newsUpdate) {
         $news = new News($newsUpdate->newsID);
         $news->updateNewsUpdates();
     }
 }
Esempio n. 6
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $returnValue = parent::delete();
     // call category types
     foreach ($this->objects as $categoryEditor) {
         $categoryEditor->getProcessor()->afterDeletion($categoryEditor);
     }
     return $returnValue;
 }
Esempio n. 7
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $count = parent::delete();
     LanguageFactory::getInstance()->deleteLanguageCache();
     return $count;
 }
Esempio n. 8
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     // update counters
     $processors = array();
     $groupCommentIDs = $commentIDs = array();
     foreach ($this->objects as $comment) {
         if (!isset($processors[$comment->objectTypeID])) {
             $objectType = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID);
             $processors[$comment->objectTypeID] = $objectType->getProcessor();
             $groupCommentIDs[$comment->objectTypeID] = array();
         }
         $processors[$comment->objectTypeID]->updateCounter($comment->objectID, -1 * ($comment->responses + 1));
         $groupCommentIDs[$comment->objectTypeID][] = $comment->commentID;
         $commentIDs[] = $comment->commentID;
     }
     if (!empty($groupCommentIDs)) {
         $likeObjectIDs = array();
         $notificationObjectTypes = array();
         foreach ($groupCommentIDs as $objectTypeID => $objectIDs) {
             // remove activity events
             $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
             if (UserActivityEventHandler::getInstance()->getObjectTypeID($objectType->objectType . '.recentActivityEvent')) {
                 UserActivityEventHandler::getInstance()->removeEvents($objectType->objectType . '.recentActivityEvent', $objectIDs);
             }
             $likeObjectIDs = array_merge($likeObjectIDs, $objectIDs);
             // delete notifications
             $objectType = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID);
             if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType . '.notification')) {
                 UserNotificationHandler::getInstance()->removeNotifications($objectType->objectType . '.notification', $objectIDs);
             }
             if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType . '.like.notification')) {
                 $notificationObjectTypes[] = $objectType->objectType . '.like.notification';
             }
         }
         // remove likes
         LikeHandler::getInstance()->removeLikes('com.woltlab.wcf.comment', $likeObjectIDs, $notificationObjectTypes);
     }
     // delete responses
     if (!empty($commentIDs)) {
         $commentResponseList = new CommentResponseList();
         $commentResponseList->getConditionBuilder()->add('comment_response.commentID IN (?)', array($commentIDs));
         $commentResponseList->readObjectIDs();
         if (count($commentResponseList->getObjectIDs())) {
             $action = new CommentResponseAction($commentResponseList->getObjectIDs(), 'delete', array('ignoreCounters' => true));
             $action->executeAction();
         }
     }
     return parent::delete();
 }
Esempio n. 9
0
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     // delete avatars
     $avatarIDs = array();
     foreach ($this->objects as $user) {
         if ($user->avatarID) {
             $avatarIDs[] = $user->avatarID;
         }
     }
     if (!empty($avatarIDs)) {
         $action = new UserAvatarAction($avatarIDs, 'delete');
         $action->executeAction();
     }
     // delete profile comments
     if (!empty($this->objectIDs)) {
         CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.user.profileComment', $this->objectIDs);
     }
     $returnValue = parent::delete();
     return $returnValue;
 }
Esempio n. 10
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     foreach ($this->objects as $projectEditor) {
         $sql = "UPDATE\tict" . WCF_N . "_project\n\t\t\t\t\tSET\t\tposition = position - 1\n\t\t\t\t\tWHERE\tposition >= ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array($projectEditor->position));
     }
     return parent::delete();
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     // deletes messages
     $messageList = new ConversationMessageList();
     $messageList->getConditionBuilder()->add('conversation_message.conversationID IN (?)', array($this->objectIDs));
     $messageList->readObjectIDs();
     $action = new ConversationMessageAction($messageList->getObjectIDs(), 'delete');
     $action->executeAction();
     // delete conversations
     parent::delete();
     if (!empty($this->objectIDs)) {
         // delete notifications
         UserNotificationHandler::getInstance()->deleteNotifications('conversation', 'com.woltlab.wcf.conversation.notification', array(), $this->objectIDs);
         // remove modification logs
         ConversationModificationLogHandler::getInstance()->remove($this->objectIDs);
     }
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $this->prepareObjects();
     $ignoreEntries = isset($this->parameters['ignoreEntries']) && $this->parameters['ignoreEntries'];
     $entryIDs = array();
     foreach ($this->objects as $file) {
         if (!isset($entryIDs[$file->entryID])) {
             $entryIDs[$file->entryID] = $file->entryID;
         }
     }
     $fileStats = $this->getDetailedFileStats($entryIDs);
     parent::delete();
     // update entries
     $entryEditors = $fileIDs = array();
     foreach ($this->objects as $file) {
         $entryEditors[$file->entryID] = new EntryEditor($file->getEntry());
         $fileIDs[] = $file->fileID;
         $fileStats[$file->entryID]['files']--;
         if ($file->isDisabled) {
             $fileStats[$file->entryID]['disabledFiles']--;
         }
         // entry has no files anymore -> delete it
         if (!$ignoreEntries && !$fileStats[$file->entryID]['files']) {
             unset($entryIDs[$file->entryID]);
             // deleted entries need no data update
             $entryEditors[$file->entryID]->delete();
             EntryModificationLogHandler::getInstance()->delete($file->getEntry());
             $this->addEntryData($file->entryID, 'deleted', LinkHandler::getInstance()->getLink('FilebaseOverview', array('application' => 'filebase')));
             continue;
         }
         FileModificationLogHandler::getInstance()->delete($file->getDecoratedObject());
         $this->addFileData($file->getDecoratedObject(), 'deleted', 1);
         @unlink($file->getLocation());
     }
     if (!$ignoreEntries) {
         // check if the left files are all disabled and if the entry
         // is also disabled
         $disableEntries = array();
         foreach ($entryIDs as $entryID) {
             if ($fileStats[$entryID]['files'] == $fileStats[$entryID]['disabledFiles'] && !$entryEditors[$entryID]->isDisabled) {
                 $disableEntries[] = $fileStats[$entryID];
                 $this->addEntryData($entryID, 'isDisabled', 1);
                 // after disabling the entry, the entry data
                 // will be be rebuild in that method, so no need
                 // to rebuild it here, too
                 unset($entryIDs[$entryID]);
             }
         }
         if (!empty($disableEntries)) {
             $entryAction = new EntryAction($disableEntries, 'disable', array('ignoreFiles' => true));
             $entryAction->executeAction();
         }
         if (!empty($entryIDs)) {
             EntryEditor::rebuildEntryData($entryIDs);
         }
     }
     if (!empty($fileIDs)) {
         // delete user notifications
         UserNotificationHandler::getInstance()->deleteNotifications('file', 'de.incendium.filebase.file', array(), $fileIDs);
         // unmark files
         if (isset($this->parameters['unmarkItems'])) {
             $this->unmarkItems($fileIDs);
         }
     }
     return $this->getFileData();
 }
Esempio n. 13
0
 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();
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     if (empty($this->objects)) {
         return 0;
     }
     $ignoreCounters = !empty($this->parameters['ignoreCounters']);
     // read object type ids for comments
     $commentIDs = array();
     foreach ($this->objects as $response) {
         $commentIDs[] = $response->commentID;
     }
     $commentList = new CommentList();
     $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs));
     $commentList->readObjects();
     $comments = $commentList->getObjects();
     // update counters
     $processors = $responseIDs = $updateComments = array();
     foreach ($this->objects as $response) {
         $objectTypeID = $comments[$response->commentID]->objectTypeID;
         if (!isset($processors[$objectTypeID])) {
             $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
             $processors[$objectTypeID] = $objectType->getProcessor();
             $responseIDs[$objectTypeID] = array();
         }
         $responseIDs[$objectTypeID][] = $response->responseID;
         if (!$ignoreCounters) {
             $processors[$objectTypeID]->updateCounter($comments[$response->commentID]->objectID, -1);
             if (!isset($updateComments[$response->commentID])) {
                 $updateComments[$response->commentID] = 0;
             }
             $updateComments[$response->commentID]++;
         }
     }
     // remove responses
     $count = parent::delete();
     // update comment responses and cached response ids
     if (!$ignoreCounters) {
         foreach ($comments as $comment) {
             $commentEditor = new CommentEditor($comment);
             $commentEditor->updateResponseIDs();
             $commentEditor->updateCounters(array('responses' => -1 * $updateComments[$comment->commentID]));
         }
     }
     $likeObjectIDs = array();
     $notificationObjectTypes = array();
     foreach ($responseIDs as $objectTypeID => $objectIDs) {
         // remove activity events
         $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
         if (UserActivityEventHandler::getInstance()->getObjectTypeID($objectType->objectType . '.response.recentActivityEvent')) {
             UserActivityEventHandler::getInstance()->removeEvents($objectType->objectType . '.response.recentActivityEvent', $objectIDs);
         }
         // delete notifications
         if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType . '.response.notification')) {
             UserNotificationHandler::getInstance()->removeNotifications($objectType->objectType . '.response.notification', $objectIDs);
         }
         $likeObjectIDs = array_merge($likeObjectIDs, $objectIDs);
         if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType . '.response.like.notification')) {
             $notificationObjectTypes[] = $objectType->objectType . '.response.like.notification';
         }
     }
     // remove likes
     if (!empty($likeObjectIDs)) {
         LikeHandler::getInstance()->removeLikes('com.woltlab.wcf.comment.response', $likeObjectIDs, $notificationObjectTypes);
     }
     return $count;
 }
 /**
  * @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;
 }
 /**
  * {@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();
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     // delete news entries
     parent::delete();
     // collect data
     $newsIDs = $perUserCount = $pollIDs = array();
     foreach ($this->objects as $news) {
         $newsIDs[] = $news->newsID;
         if ($news->pollID) {
             $pollIDs[] = $news->pollID;
         }
         if (!$news->isDisabled) {
             if (!isset($perUserCount[$news->userID])) {
                 $perUserCount[$news->userID] = 0;
             }
             $perUserCount[$news->userID]++;
         }
     }
     if (!empty($newsIDs)) {
         // delete like data
         LikeHandler::getInstance()->removeLikes('de.voolia.news.likeableNews', $newsIDs);
         // delete comments
         CommentHandler::getInstance()->deleteObjects('de.voolia.news.comment', $newsIDs);
         // delete tag to object entries
         TagEngine::getInstance()->deleteObjects('de.voolia.news.entry', $newsIDs);
         // delete entry activity events
         UserActivityEventHandler::getInstance()->removeEvents('de.voolia.news.recentActivityEvent.news', $newsIDs);
         UserActivityPointHandler::getInstance()->removeEvents('de.voolia.news.activityPointEvent.news', $perUserCount);
         // delete entry from search index
         SearchIndexManager::getInstance()->delete('de.voolia.news.entry', $newsIDs);
         // remove object from moderation queue
         ModerationQueueActivationManager::getInstance()->removeModeratedContent('de.voolia.news.entry', $newsIDs);
     }
     // delete a poll
     if (!empty($pollIDs)) {
         PollManager::getInstance()->removePolls($pollIDs);
     }
     // reset the user storage data
     UserStorageHandler::getInstance()->resetAll('newsUnreadEntries');
     UserStorageHandler::getInstance()->resetAll('newsUnreadWatchedEntries');
     // reset the news cache
     NewsEditor::resetNewsStatsCache();
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     ConditionHandler::getInstance()->deleteConditions('com.woltlab.wcf.condition.userGroupAssignment', $this->objectIDs);
     return parent::delete();
 }
Esempio n. 19
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $returnValues = parent::delete();
     $followUserIDs = array();
     foreach ($this->objects as $follow) {
         $followUserIDs[] = $follow->followUserID;
         // remove activity event
         UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', array($follow->followUserID));
     }
     // reset storage
     UserStorageHandler::getInstance()->reset($followUserIDs, 'followerUserIDs');
     UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'followingUserIDs');
     return $returnValues;
 }
Esempio n. 20
0
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     $returnValues = parent::delete();
     $menuItemIDs = $pageIDs = array();
     foreach ($this->objects as $pageEditor) {
         $pageIDs[] = $pageEditor->pageID;
         if ($pageEditor->menuItemID) {
             $menuItemIDs[] = $pageEditor->menuItemID;
         }
     }
     // update search index
     if (!empty($pageIDs)) {
         SearchIndexManager::getInstance()->delete('de.codequake.cms.page', $pageIDs);
     }
     // delete related menu items
     if (!empty($menuItemIDs)) {
         $menuItemList = new PageMenuItemList();
         $menuItemList->setObjectIDs($menuItemIDs);
         $menuItemList->readObjects();
         $deleteMenuItemIDs = array();
         foreach ($menuItemList as $menuItem) {
             if ($menuItem->getProcessor() instanceof CMSPageMenuItemProvider) {
                 $page = $menuItem->getProcessor()->getPage();
                 if (in_array($page->pageID, $pageIDs)) {
                     $deleteMenuItemIDs[] = $menuItem->menuItemID;
                 }
             }
         }
         if (!empty($deleteMenuItemIDs)) {
             $pageMenuItemAction = new PageMenuItemAction($deleteMenuItemIDs, 'delete');
             $pageMenuItemAction->executeAction();
         }
     }
     return $returnValues;
 }
Esempio n. 21
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $returnValues = parent::delete();
     // reset storage
     UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'ignoredUserIDs');
     return $returnValues;
 }
Esempio n. 22
0
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $count = parent::delete();
     foreach ($this->objects as $style) {
         // remove custom images
         if ($style->imagePath && $style->imagePath != 'images/') {
             $this->removeDirectory($style->imagePath);
         }
         // remove preview image
         $previewImage = WCF_DIR . 'images/' . $style->image;
         if (file_exists($previewImage)) {
             @unlink($previewImage);
         }
         // remove stylesheet
         StyleHandler::getInstance()->resetStylesheet($style->getDecoratedObject());
     }
     return $count;
 }
 /**
  * @see	\wcf\data\AbstractDatabaseObjectAction::delete()
  */
 public function delete()
 {
     $this->revoke();
     parent::delete();
 }