Esempio n. 1
0
 function commitRevision($change_type, $change_object = null, $reason = "", $bump = null)
 {
     $this->dieIfHistorical();
     global $wgUser;
     global $wgThreadActionsNoBump;
     if (is_null($bump)) {
         $bump = !in_array($change_type, $wgThreadActionsNoBump);
     }
     if ($bump) {
         $this->sortkey = wfTimestamp(TS_MW);
     }
     $original = $this->dbVersion;
     $this->modified = wfTimestampNow();
     $this->updateEditedness($change_type);
     $this->save(__METHOD__ . "/" . wfGetCaller());
     $topmost = $this->topmostThread();
     $topmost->modified = wfTimestampNow();
     if ($bump) {
         $topmost->setSortkey(wfTimestamp(TS_MW));
     }
     $topmost->save();
     ThreadRevision::create($this, $change_type, $change_object, $reason);
     $this->logChange($change_type, $original, $change_object, $reason);
     if ($change_type == Threads::CHANGE_EDITED_ROOT) {
         NewMessages::writeMessageStateForUpdatedThread($this, $change_type, $wgUser);
     }
 }
Esempio n. 2
0
 function moveToPage($title, $reason, $leave_trace)
 {
     global $wgUser;
     if (!$this->isTopmostThread()) {
         throw new Exception("Attempt to move non-toplevel thread to another page");
     }
     $this->dieIfHistorical();
     $dbr = wfGetDB(DB_MASTER);
     $oldTitle = $this->getTitle();
     $newTitle = $title;
     $new_articleNamespace = $title->getNamespace();
     $new_articleTitle = $title->getDBkey();
     $new_articleID = $title->getArticleID();
     if (!$new_articleID) {
         $article = new Article($newTitle, 0);
         Threads::createTalkpageIfNeeded($article);
         $new_articleID = $article->getId();
     }
     // Update on *all* subthreads.
     $dbr->update('thread', array('thread_article_namespace' => $new_articleNamespace, 'thread_article_title' => $new_articleTitle, 'thread_article_id' => $new_articleID), array('thread_ancestor' => $this->id()), __METHOD__);
     $this->articleNamespace = $new_articleNamespace;
     $this->articleTitle = $new_articleTitle;
     $this->articleId = $new_articleID;
     $this->article = null;
     $this->commitRevision(Threads::CHANGE_MOVED_TALKPAGE, null, $reason);
     // Notifications
     NewMessages::writeMessageStateForUpdatedThread($this, $this->type, $wgUser);
     if ($leave_trace) {
         $this->leaveTrace($reason, $oldTitle, $newTitle);
     }
 }