X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FHistoryPage.php;h=27c115339536e613145f954a772298c19ffcca45;hb=b29514b0b3f71e4794e8d9810b20911f3ff420db;hp=ebbc4003349f573ba79c3dd1a2f6dbc2dac50aa3;hpb=a6b30d6b82fa997dacfdd54b109b39b80bf5e22d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/HistoryPage.php b/includes/HistoryPage.php index ebbc400334..27c1153395 100644 --- a/includes/HistoryPage.php +++ b/includes/HistoryPage.php @@ -24,8 +24,7 @@ class HistoryPage { /** * Construct a new HistoryPage. * - * @param Article $article - * @returns nothing + * @param $article Article */ function __construct( $article ) { global $wgUser; @@ -59,8 +58,7 @@ class HistoryPage { /** * Print the history page for an article. - * - * @returns nothing + * @return nothing */ function history() { global $wgOut, $wgRequest, $wgScript; @@ -83,7 +81,7 @@ class HistoryPage { $wgOut->setRobotPolicy( 'noindex,nofollow' ); $wgOut->setSyndicated( true ); $wgOut->setFeedAppendQuery( 'action=history' ); - $wgOut->addScriptFile( 'history.js' ); + $wgOut->addModules( array( 'mediawiki.legacy.history' ) ); $logPage = SpecialPage::getTitleFor( 'Log' ); $logLink = $this->skin->link( @@ -131,18 +129,14 @@ class HistoryPage { $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); /** * Option to show only revisions that have been (partially) hidden via RevisionDelete - * Note that this can run a *long* time if there are many revisions to look at. - * We use "isBigDeletion" to determine if the history is too big to go through. - * Additionally, only users with 'deleterevision' right can filter for deleted edits. */ - if ( $this->title->userCan( 'deleterevision' ) && ( !$this->article->isBigDeletion() || $this->title->userCan( 'bigdelete' ) ) ) { - $conds = ( $wgRequest->getBool( 'deleted' ) ) ? array("rev_deleted != '0'") : array(); - $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), 'deleted', '', $wgRequest->getBool( 'deleted' ) ) . "\n"; - } - else { # Don't filter and don't add the checkbox for filtering + if ( $wgRequest->getBool( 'deleted' ) ) { + $conds = array("rev_deleted != '0'"); + } else { $conds = array(); - $checkDeleted = ''; } + $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), + 'deleted', 'mw-show-deleted-only', $wgRequest->getBool( 'deleted' ) ) . "\n"; $action = htmlspecialchars( $wgScript ); $wgOut->addHTML( @@ -154,8 +148,8 @@ class HistoryPage { ) . Xml::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" . Xml::hidden( 'action', 'history' ) . "\n" . - Xml::dateMenu( $year, $month ) . ' ' . - ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . + Xml::dateMenu( $year, $month ) . ' ' . + ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . $checkDeleted . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . '' @@ -180,8 +174,13 @@ class HistoryPage { * Fetch an array of revisions, specified by a given limit, offset and * direction. This is now only used by the feeds. It was previously * used by the main UI but that's now handled by the pager. + * + * @param $limit Integer: the limit number of revisions to get + * @param $offset Integer + * @param $direction Integer: either HistoryPage::DIR_PREV or HistoryPage::DIR_NEXT + * @return ResultWrapper */ - function fetchRevisions($limit, $offset, $direction) { + function fetchRevisions( $limit, $offset, $direction ) { $dbr = wfGetDB( DB_SLAVE ); if( $direction == HistoryPage::DIR_PREV ) @@ -207,7 +206,8 @@ class HistoryPage { /** * Output a subscription feed listing recent edits to this page. - * @param string $type + * + * @param $type String: feed type */ function feed( $type ) { global $wgFeedClasses, $wgRequest, $wgFeedLimit; @@ -258,7 +258,7 @@ class HistoryPage { * Borrows Recent Changes' feed generation functions for formatting; * includes a diff to the previous revision (if any). * - * @param $row + * @param $row Object: database row * @return FeedItem */ function feedItem( $row ) { @@ -316,11 +316,21 @@ class HistoryPager extends ReverseChronologicalPager { return $this->historyPage->getArticle(); } + function getSqlComment() { + if ( $this->conds ) { + return 'history page filtered'; // potentially slow, see CR r58153 + } else { + return 'history page unfiltered'; + } + } + function getQueryInfo() { $queryInfo = array( 'tables' => array('revision'), - 'fields' => array_merge( Revision::selectFields()), - 'conds' => array_merge( array('rev_page' => $this->historyPage->title->getArticleID() ), $this->conds ), + 'fields' => Revision::selectFields(), + 'conds' => array_merge( + array( 'rev_page' => $this->historyPage->title->getArticleID() ), + $this->conds ), 'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ), 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ), ); @@ -364,17 +374,25 @@ class HistoryPager extends ReverseChronologicalPager { $this->counter = 1; $this->oldIdChecked = 0; - $wgOut->wrapWikiMsg( "
\n$1
", 'histlegend' ); - $s = Xml::openElement( 'form', array( 'action' => $wgScript, + $wgOut->wrapWikiMsg( "
\n$1\n
", 'histlegend' ); + $s = Html::openElement( 'form', array( 'action' => $wgScript, 'id' => 'mw-history-compare' ) ) . "\n"; - $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n"; - $s .= Xml::hidden( 'action', 'historysubmit' ) . "\n"; + $s .= Html::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n"; + $s .= Html::hidden( 'action', 'historysubmit' ) . "\n"; + $s .= '
' . $this->submitButton( wfMsg( 'compareselectedversions'), + array( 'class' => 'historysubmit' ) ) . "\n"; + $this->buttons = '
'; + $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'), + array( 'class' => 'historysubmit' ) + + $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'compareselectedversions' ) + ) . "\n"; + if( $wgUser->isAllowed('deleterevision') ) { $float = $wgContLang->alignEnd(); # Note bug #20966,
'; - $s .= $this->buttons . '