/** * Recovers all marked posts. */ public function recoverAll() { // get threadids $threadIDs = PostEditor::getThreadIDs($this->postIDs); // get boards list($boards, $boardIDs) = ThreadEditor::getBoards($threadIDs); // check permissions foreach ($boards as $board) { $board->checkModeratorPermission('canDeletePostCompletely'); } // recover posts PostEditor::restoreAll($this->postIDs); PostEditor::unmarkAll(); // handle threads (check for empty, deleted and hidden threads) ThreadEditor::checkVisibilityAll($threadIDs); // refresh last post, replies, attachments, polls in threads ThreadEditor::refreshAll($threadIDs); // refresh counts BoardEditor::refreshAll($boardIDs); // refresh last post in boards foreach ($boards as $board) { $board->setLastPosts(); } // reset cache ThreadAction::resetCache(); // forward HeaderUtil::redirect($this->url); exit; }
/** * Restores the threads with the given thread ids. */ public static function restoreAll($threadIDs, $restorePosts = true) { if (empty($threadIDs)) { return; } // restore thread $sql = "UPDATE \twbb" . WBB_N . "_thread\n\t\t\tSET\tisDeleted = 0\n\t\t\tWHERE \tthreadID IN (" . $threadIDs . ")"; WCF::getDB()->sendQuery($sql); // restore post if ($restorePosts) { PostEditor::restoreAll(self::getAllPostIDs($threadIDs)); } }