示例#1
0
 /**
  * Show a diff page according to current request variables. For use within
  * Article::view() only, other callers should use the DifferenceEngine class.
  *
  * @todo: make protected
  */
 public function showDiffPage()
 {
     $request = $this->getContext()->getRequest();
     $user = $this->getContext()->getUser();
     $diff = $request->getVal('diff');
     $rcid = $request->getVal('rcid');
     $diffOnly = $request->getBool('diffonly', $user->getOption('diffonly'));
     $purge = $request->getVal('action') == 'purge';
     $unhide = $request->getInt('unhide') == 1;
     $oldid = $this->getOldID();
     $rev = $this->getRevisionFetched();
     if (!$rev) {
         $this->getContext()->getOutput()->setPageTitle(wfMessage('errorpagetitle'));
         $this->getContext()->getOutput()->addWikiMsg('difference-missing-revision', $oldid, 1);
         return;
     }
     $contentHandler = $rev->getContentHandler();
     $de = $contentHandler->createDifferenceEngine($this->getContext(), $oldid, $diff, $rcid, $purge, $unhide);
     // DifferenceEngine directly fetched the revision:
     $this->mRevIdFetched = $de->mNewid;
     $de->showDiffPage($diffOnly);
     if ($diff == 0 || $diff == $this->mPage->getLatest()) {
         # Run view updates for current revision only
         $this->mPage->doViewUpdates($user);
     }
 }
示例#2
0
 /**
  * Show a diff page according to current request variables. For use within
  * Article::view() only, other callers should use the DifferenceEngine class.
  *
  * @todo Make protected
  */
 public function showDiffPage()
 {
     $request = $this->getContext()->getRequest();
     $user = $this->getContext()->getUser();
     $diff = $request->getVal('diff');
     $rcid = $request->getVal('rcid');
     $diffOnly = $request->getBool('diffonly', $user->getOption('diffonly'));
     $purge = $request->getVal('action') == 'purge';
     $unhide = $request->getInt('unhide') == 1;
     $oldid = $this->getOldID();
     $rev = $this->getRevisionFetched();
     if (!$rev) {
         $this->getContext()->getOutput()->setPageTitle(wfMessage('errorpagetitle'));
         $this->getContext()->getOutput()->addWikiMsg('difference-missing-revision', $oldid, 1);
         return;
     }
     $contentHandler = $rev->getContentHandler();
     $de = $contentHandler->createDifferenceEngine($this->getContext(), $oldid, $diff, $rcid, $purge, $unhide);
     // DifferenceEngine directly fetched the revision:
     $this->mRevIdFetched = $de->mNewid;
     $de->showDiffPage($diffOnly);
     // Run view updates for the newer revision being diffed (and shown
     // below the diff if not $diffOnly).
     list($old, $new) = $de->mapDiffPrevNext($oldid, $diff);
     // New can be false, convert it to 0 - this conveniently means the latest revision
     $this->mPage->doViewUpdates($user, (int) $new);
 }
示例#3
0
 /**
  * Show a diff page according to current request variables. For use within
  * Article::view() only, other callers should use the DifferenceEngine class.
  */
 public function showDiffPage()
 {
     global $wgRequest, $wgUser;
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getGlobalPreference('diffonly'));
     $purge = $wgRequest->getVal('action') == 'purge';
     $unhide = $wgRequest->getInt('unhide') == 1;
     $oldid = $this->getOldID();
     $de = new DifferenceEngine($this->getContext(), $oldid, $diff, $rcid, $purge, $unhide);
     // DifferenceEngine directly fetched the revision:
     $this->mRevIdFetched = $de->mNewid;
     $de->showDiffPage($diffOnly);
     if ($diff == 0 || $diff == $this->mPage->getLatest()) {
         # Run view updates for current revision only
         $this->mPage->doViewUpdates($wgUser);
     }
 }