* Construct a new HistoryPage.
*
* @param $article Article
- * @return nothing
*/
function __construct( $article ) {
global $wgUser;
/**
* Print the history page for an article.
- *
* @return nothing
*/
function history() {
$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(
$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(
) .
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" .
'</fieldset></form>'
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' => Revision::selectFields(),
- 'conds' => array_merge( array('rev_page' => $this->historyPage->title->getArticleID() ), $this->conds ),
+ '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' ) ),
);
$this->counter = 1;
$this->oldIdChecked = 0;
- $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1</div>", 'histlegend' );
- $s = Xml::openElement( 'form', array( 'action' => $wgScript,
+ $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", '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 .= '<div>' . $this->submitButton( wfMsg( 'compareselectedversions'),
+ array( 'class' => 'historysubmit' ) ) . "\n";
+
$this->buttons = '<div>';
+ $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
+ array( 'class' => 'historysubmit' )
+ + $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'compareselectedversions' )
+ ) . "\n";
+
if( $wgUser->isAllowed('deleterevision') ) {
$float = $wgContLang->alignEnd();
# Note bug #20966, <button> is non-standard in IE<8
- $this->buttons .= Xml::element( 'button',
+ $element = Html::element( 'button',
array(
'type' => 'submit',
'name' => 'revisiondelete',
),
wfMsg( 'showhideselectedversions' )
) . "\n";
+ $s .= $element;
+ $this->buttons .= $element;
+ }
+ if( $wgUser->isAllowed( 'revisionmove' ) ) {
+ $float = $wgContLang->alignEnd();
+ # Note bug #20966, <button> is non-standard in IE<8
+ $element = Html::element( 'button',
+ array(
+ 'type' => 'submit',
+ 'name' => 'revisionmove',
+ 'value' => '1',
+ 'style' => "float: $float;",
+ 'class' => 'mw-history-revisionmove-button',
+ ),
+ wfMsg( 'revisionmoveselectedversions' )
+ ) . "\n";
+ $s .= $element;
+ $this->buttons .= $element;
}
- $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
- array(
- 'class' => 'historysubmit',
- 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
- 'title' => wfMsg( 'tooltip-compareselectedversions' ),
- )
- ) . "\n";
$this->buttons .= '</div>';
- $s .= $this->buttons . '<ul id="pagehistory">' . "\n";
+ $s .= '</div><ul id="pagehistory">' . "\n";
return $s;
}
$classes = array();
$del = '';
- // User can delete revisions...
- if( $wgUser->isAllowed( 'deleterevision' ) ) {
+ // Show checkboxes for each revision
+ if( $wgUser->isAllowed( 'deleterevision' ) || $wgUser->isAllowed( 'revisionmove' ) ) {
// If revision was hidden from sysops, disable the checkbox
- if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
+ // However, if the user has revisionmove rights, we cannot disable the checkbox
+ if( !$rev->userCan( Revision::DELETED_RESTRICTED ) && !$wgUser->isAllowed( 'revisionmove' ) ) {
$del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
// Otherwise, enable the checkbox...
} else {
- $del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids['.$rev->getId().']' ) );
+ $del = Xml::check( 'showhiderevisions', false,
+ array( 'name' => 'ids['.$rev->getId().']' ) );
}
// User can only view deleted revisions...
} else if( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
if( $del ) $s .= " $del ";
$s .= " $link";
- $s .= " <span class='history-user'>" . $this->getSkin()->revUserTools( $rev, true ) . "</span>";
+ $s .= " <span class='history-user'>" .
+ $this->getSkin()->revUserTools( $rev, true ) . "</span>";
if( $rev->isMinor() ) {
$s .= ' ' . ChangesList::flag( 'minor' );
global $wgLang;
$date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
$date = htmlspecialchars( $date );
- if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
+ if ( $rev->userCan( Revision::DELETED_TEXT ) ) {
$link = $this->getSkin()->link(
$this->title,
$date,
array( 'known', 'noclasses' )
);
} else {
- $link = "<span class=\"history-deleted\">$date</span>";
+ $link = $date;
+ }
+ if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+ $link = "<span class=\"history-deleted\">$link</span>";
}
return $link;
}
),
array( 'known', 'noclasses' )
);
- } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
+ } elseif( !$prevRev->userCan(Revision::DELETED_TEXT)
+ || !$nextRev->userCan(Revision::DELETED_TEXT) )
+ {
return $last;
} else {
return $this->getSkin()->link(
if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
$radio['disabled'] = 'disabled';
$checkmark = array(); // We will check the next possible one
- } else if( $counter == 2 || !$this->oldIdChecked ) {
+ } else if( !$this->oldIdChecked ) {
$checkmark = array( 'checked' => 'checked' );
$this->oldIdChecked = $id;
} else {