/** * Enables the threads with the given thread ids. */ public static function enableAll($threadIDs, $enablePosts = true) { if (empty($threadIDs)) { return; } // send notifications $statThreadIDs = ''; $sql = "SELECT\t*\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")\n\t\t\t\tAND isDisabled = 1\n\t\t\t\tAND everEnabled = 0"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (!empty($statThreadIDs)) { $statThreadIDs .= ','; } $statThreadIDs .= $row['threadID']; // send notifications $thread = new ThreadEditor(null, $row); $thread->sendNotification(); } // update user posts & activity points self::updateUserStats($statThreadIDs, 'enable'); // enable thread $sql = "UPDATE \twbb" . WBB_N . "_thread\n\t\t\tSET\tisDisabled = 0,\n\t\t\t\teverEnabled = 1\n\t\t\tWHERE \tthreadID IN (" . $threadIDs . ")"; WCF::getDB()->registerShutdownUpdate($sql); // enable post if ($enablePosts) { PostEditor::enableAll(self::getAllPostIDs($threadIDs)); } }