/**
  * Print the history page for an article.
  */
 function onView()
 {
     $out = $this->getOutput();
     $request = $this->getRequest();
     /**
      * Allow client caching.
      */
     if ($out->checkLastModified($this->page->getTouched())) {
         return;
         // Client cache fresh and headers sent, nothing more to do.
     }
     wfProfileIn(__METHOD__);
     $this->preCacheMessages();
     $config = $this->context->getConfig();
     # Fill in the file cache if not set already
     $useFileCache = $config->get('UseFileCache');
     if ($useFileCache && HTMLFileCache::useFileCache($this->getContext())) {
         $cache = HTMLFileCache::newFromTitle($this->getTitle(), 'history');
         if (!$cache->isCacheGood()) {
             ob_start(array(&$cache, 'saveToFileCache'));
         }
     }
     // Setup page variables.
     $out->setFeedAppendQuery('action=history');
     $out->addModules('mediawiki.action.history');
     if ($config->get('UseMediaWikiUIEverywhere')) {
         $out = $this->getOutput();
         $out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox'));
     }
     // Handle atom/RSS feeds.
     $feedType = $request->getVal('feed');
     if ($feedType) {
         $this->feed($feedType);
         wfProfileOut(__METHOD__);
         return;
     }
     // Fail nicely if article doesn't exist.
     if (!$this->page->exists()) {
         $out->addWikiMsg('nohistory');
         # show deletion/move log if there is an entry
         LogEventsList::showLogExtract($out, array('delete', 'move'), $this->getTitle(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice')));
         wfProfileOut(__METHOD__);
         return;
     }
     /**
      * Add date selector to quickly get to a certain time
      */
     $year = $request->getInt('year');
     $month = $request->getInt('month');
     $tagFilter = $request->getVal('tagfilter');
     $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
     /**
      * Option to show only revisions that have been (partially) hidden via RevisionDelete
      */
     if ($request->getBool('deleted')) {
         $conds = array('rev_deleted != 0');
     } else {
         $conds = array();
     }
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n";
     } else {
         $checkDeleted = '';
     }
     // Add the general form
     $action = htmlspecialchars(wfScript());
     $out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year == null ? MWTimestamp::getLocalInstance()->format('Y') : $year, $month) . '&#160;' . ($tagSelector ? implode('&#160;', $tagSelector) . '&#160;' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>');
     wfRunHooks('PageHistoryBeforeList', array(&$this->page, $this->getContext()));
     // Create and output the list.
     $pager = new HistoryPager($this, $year, $month, $tagFilter, $conds);
     $out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
     $out->preventClickjacking($pager->getPreventClickjacking());
     wfProfileOut(__METHOD__);
 }
Esempio n. 2
0
 /**
  * Print the history page for an article.
  * @return nothing
  */
 function history()
 {
     global $wgOut, $wgRequest, $wgScript;
     /**
      * Allow client caching.
      */
     if ($wgOut->checkLastModified($this->article->getTouched())) {
         return;
     }
     // Client cache fresh and headers sent, nothing more to do.
     wfProfileIn(__METHOD__);
     // Setup page variables.
     $wgOut->setPageTitle(wfMsg('history-title', $this->title->getPrefixedText()));
     $wgOut->setPageTitleActionText(wfMsg('history_short'));
     $wgOut->setArticleFlag(false);
     $wgOut->setArticleRelated(true);
     $wgOut->setRobotPolicy('noindex,nofollow');
     $wgOut->setSyndicated(true);
     $wgOut->setFeedAppendQuery('action=history');
     $wgOut->addModules(array('mediawiki.legacy.history', 'mediawiki.action.history'));
     // Creation of a subtitle link pointing to [[Special:Log]]
     $logPage = SpecialPage::getTitleFor('Log');
     $logLink = $this->skin->link($logPage, wfMsgHtml('viewpagelogs'), array(), array('page' => $this->title->getPrefixedText()), array('known', 'noclasses'));
     $wgOut->setSubtitle($logLink);
     // Handle atom/RSS feeds.
     $feedType = $wgRequest->getVal('feed');
     if ($feedType) {
         wfProfileOut(__METHOD__);
         return $this->feed($feedType);
     }
     // Fail nicely if article doesn't exist.
     if (!$this->title->exists()) {
         $wgOut->addWikiMsg('nohistory');
         # show deletion/move log if there is an entry
         LogEventsList::showLogExtract($wgOut, array('delete', 'move'), $this->title->getPrefixedText(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice')));
         wfProfileOut(__METHOD__);
         return;
     }
     /**
      * Add date selector to quickly get to a certain time
      */
     $year = $wgRequest->getInt('year');
     $month = $wgRequest->getInt('month');
     $tagFilter = $wgRequest->getVal('tagfilter');
     $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
     /**
      * Option to show only revisions that have been (partially) hidden via RevisionDelete
      */
     if ($wgRequest->getBool('deleted')) {
         $conds = array("rev_deleted != '0'");
     } else {
         $conds = array();
     }
     $checkDeleted = Xml::checkLabel(wfMsg('history-show-deleted'), 'deleted', 'mw-show-deleted-only', $wgRequest->getBool('deleted')) . "\n";
     // Add the general form
     $action = htmlspecialchars($wgScript);
     $wgOut->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset(wfMsg('history-fieldset-title'), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->title->getPrefixedDBKey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year, $month) . '&#160;' . ($tagSelector ? implode('&#160;', $tagSelector) . '&#160;' : '') . $checkDeleted . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . '</fieldset></form>');
     wfRunHooks('PageHistoryBeforeList', array(&$this->article));
     // Create and output the list.
     $pager = new HistoryPager($this, $year, $month, $tagFilter, $conds);
     $wgOut->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
     $wgOut->preventClickjacking($pager->getPreventClickjacking());
     wfProfileOut(__METHOD__);
 }