*/
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
- return $t == null ? null : new Article( $t );
+ # FIXME: doesn't inherit right
+ return $t == null ? null : new self( $t );
+ #return $t == null ? null : new static( $t ); // PHP 5.3
}
/**
$rcid = $wgRequest->getVal( 'rcid' );
$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
$purge = $wgRequest->getVal( 'action' ) == 'purge';
- $htmldiff = $wgRequest->getBool( 'htmldiff' );
$unhide = $wgRequest->getInt('unhide') == 1;
$oldid = $this->getOldID();
- $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid, $purge, $htmldiff, $unhide );
+ $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid, $purge, $unhide );
// DifferenceEngine directly fetched the revision:
$this->mRevIdFetched = $de->mNewid;
$de->showDiffPage( $diffOnly );
* @return bool true on success
*/
public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
- global $wgUser, $wgRestrictionTypes, $wgContLang;
+ global $wgUser, $wgContLang;
+
+ $restrictionTypes = $this->mTitle->getRestrictionTypes();
$id = $this->mTitle->getArticleID();
if ( $id <= 0 ) {
$current = array();
$updated = Article::flattenRestrictions( $limit );
$changed = false;
- foreach( $wgRestrictionTypes as $action ) {
+ foreach( $restrictionTypes as $action ) {
if( isset( $expiry[$action] ) ) {
# Get current restrictions on $action
$aLimits = $this->mTitle->getRestrictions( $action );
$conds = $this->mTitle->pageCond();
$latest = $dbw->selectField( 'page', 'page_latest', $conds, __METHOD__ );
if( $latest === false ) {
- $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
+ $wgOut->showFatalError(
+ Html::rawElement(
+ 'div',
+ array( 'class' => 'error mw-error-cannotdelete' ),
+ wfMsgExt( 'cannotdelete', array( 'parse' ), $this->mTitle->getPrefixedText() )
+ )
+ );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
LogEventsList::showLogExtract(
$wgOut,
// If the page has a history, insert a warning
if( $hasHistory && !$confirm ) {
+ global $wgLang;
$skin = $wgUser->getSkin();
- $wgOut->addHTML( '<strong>' . wfMsgExt( 'historywarning', array( 'parseinline' ) ) . ' ' . $skin->historyLink() . '</strong>' );
+ $revisions = $this->estimateRevisionCount();
+ $wgOut->addHTML( '<strong class="mw-delete-warning-revisions">' .
+ wfMsgExt( 'historywarning', array( 'parseinline' ), $wgLang->formatNum( $revisions ) ) .' ' .
+ $skin->historyLink() .
+ '</strong>'
+ );
if( $bigHistory ) {
- global $wgLang, $wgDeleteRevisionsLimit;
+ global $wgDeleteRevisionsLimit;
$wgOut->wrapWikiMsg( "<div class='error'>\n$1</div>\n",
array( 'delete-warning-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
}
}
} else {
if( $error == '' ) {
- $wgOut->showFatalError( wfMsgExt( 'cannotdelete', array( 'parse' ) ) );
+ $wgOut->showFatalError(
+ Html::rawElement(
+ 'div',
+ array( 'class' => 'error mw-error-cannotdelete' ),
+ wfMsgExt( 'cannotdelete', array( 'parse' ), $this->mTitle->getPrefixedText() )
+ )
+ );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
LogEventsList::showLogExtract(
$wgOut,
return;
}
+ $unhide = $wgRequest->getInt('unhide') == 1 &&
+ $wgUser->matchEditToken( $wgRequest->getVal('token'), $oldid );
+ # Cascade unhide param in links for easy deletion browsing
+ $extraParams = array();
+ if( $wgRequest->getVal('unhide') ) {
+ $extraParams['unhide'] = 1;
+ }
$revision = Revision::newFromId( $oldid );
$current = ( $oldid == $this->mLatest );
$this->mTitle,
wfMsgHtml( 'currentrevisionlink' ),
array(),
- array(),
+ $extraParams,
array( 'known', 'noclasses' )
);
$curdiff = $current
array(
'diff' => 'cur',
'oldid' => $oldid
- ),
+ ) + $extraParams,
array( 'known', 'noclasses' )
);
$prev = $this->mTitle->getPreviousRevisionID( $oldid ) ;
array(
'direction' => 'prev',
'oldid' => $oldid
- ),
+ ) + $extraParams,
array( 'known', 'noclasses' )
)
: wfMsgHtml( 'previousrevision' );
array(
'diff' => 'prev',
'oldid' => $oldid
- ),
+ ) + $extraParams,
array( 'known', 'noclasses' )
)
: wfMsgHtml( 'diff' );
array(
'direction' => 'next',
'oldid' => $oldid
- ),
+ ) + $extraParams,
array( 'known', 'noclasses' )
);
$nextdiff = $current
array(
'diff' => 'next',
'oldid' => $oldid
- ),
+ ) + $extraParams,
array( 'known', 'noclasses' )
);
- $cdel='';
- // Don't show useless link to people who cannot hide revisions
- if( $wgUser->isAllowed('deleterevision') || ($revision->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
+ $cdel = '';
+ // User can delete revisions or view deleted revisions...
+ $canHide = $wgUser->isAllowed( 'deleterevision' );
+ if( $canHide || ($revision->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
if( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) {
- // If revision was hidden from sysops
- $cdel = wfMsgHtml( 'rev-delundel' );
+ $cdel = $sk->revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops
} else {
- $cdel = $sk->link(
- SpecialPage::getTitleFor( 'Revisiondelete' ),
- wfMsgHtml('rev-delundel'),
- array(),
- array(
- 'type' => 'revision',
- 'target' => urlencode( $this->mTitle->getPrefixedDbkey() ),
- 'ids' => urlencode( $oldid )
- ),
- array( 'known', 'noclasses' )
+ $query = array(
+ 'type' => 'revision',
+ 'target' => $this->mTitle->getPrefixedDbkey(),
+ 'ids' => $oldid
);
- // Bolden oversighted content
- if( $revision->isDeleted( Revision::DELETED_RESTRICTED ) )
- $cdel = "<strong>$cdel</strong>";
+ $cdel = $sk->revDeleteLink( $query, $revision->isDeleted(File::DELETED_RESTRICTED), $canHide );
}
- $cdel = "(<small>$cdel</small>) ";
+ $cdel .= ' ';
}
- $unhide = $wgRequest->getInt('unhide') == 1 && $wgUser->matchEditToken( $wgRequest->getVal('token'), $oldid );
+
# Show user links if allowed to see them. If hidden, then show them only if requested...
$userlinks = $sk->revUserTools( $revision, !$unhide );
}
$insertRows = array();
foreach( $insertCats as $cat ) {
- $insertRows[] = array( 'cat_id' => $dbw->nextSequenceValue( 'category_id_seq' ),
+ $insertRows[] = array( 'cat_id' => $dbw->nextSequenceValue( 'category_cat_id_seq' ),
'cat_title' => $cat );
}
$dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' );