static function onArticleDeleteComplete(&$article, &$user, $reason, $id)
 {
     $title = $article->getTitle();
     if ($title->getNamespace() != NS_LQT_THREAD) {
         return true;
     }
     $threads = Threads::where(array('thread_root' => $id));
     if (!count($threads)) {
         wfDebugLog('LiquidThreads', __METHOD__ . ": no threads with root {$id}, ignoring...\n");
         return true;
     }
     $thread = array_pop($threads);
     // Mark the thread as deleted
     $thread->delete($reason);
     // Avoid orphaning subthreads, update their parentage.
     if ($thread->replies() && $thread->isTopmostThread()) {
         $reason = wfMsg('lqt-delete-parent-deleted', $reason);
         self::recursivelyDeleteReplies($thread, $reason);
         global $wgOut;
         $wgOut->addWikiMsg('lqt-delete-replies-done');
     } elseif ($thread->replies()) {
         foreach ($thread->replies() as $reply) {
             $reply->setSuperthread($thread->superthread());
             $reply->save();
         }
     }
     // Synchronise the first 500 threads, in reverse order by thread id. If
     // there are more threads to synchronise, the job queue will take over.
     Threads::synchroniseArticleData($article, 500, 'cascade');
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @param $article
  * @param $bulkLoad bool
  * @return Thread
  */
 static function withSummary($article, $bulkLoad = true)
 {
     $ts = Threads::where(array('thread_summary_page' => $article->getId()), array(), $bulkLoad);
     return self::assertSingularity($ts, 'thread_summary_page', $article->getId());
 }
Ejemplo n.º 3
0
 public static function getHotThreads($count = 10)
 {
     $topics = array_values(self::generateHotTopics($count));
     return Threads::where(array('thread_id' => $topics));
 }