return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent();
}
+ /**
+ * Get the fetched Revision object depending on request parameters or null
+ * on failure.
+ *
+ * @return Revision|null
+ */
+ public function getRevisionFetched() {
+ $this->fetchContent();
+
+ return $this->mRevision;
+ }
+
/**
* Use this to fetch the rev ID used on page views
*
wfDebug( __METHOD__ . ": done file cache\n" );
# tell wgOut that output is taken care of
$wgOut->disable();
- $this->mPage->viewUpdates();
+ $this->mPage->doViewUpdates( $wgUser );
wfProfileOut( __METHOD__ );
return;
# the correct version information.
$wgOut->setRevisionId( $this->mPage->getLatest() );
# Preload timestamp to avoid a DB hit
- $wgOut->setRevisionTimestamp( $this->mParserOutput->getTimestamp() );
- $this->mPage->setTimestamp( $this->mParserOutput->getTimestamp() );
+ $cachedTimestamp = $this->mParserOutput->getTimestamp();
+ if ( $cachedTimestamp !== null ) {
+ $wgOut->setRevisionTimestamp( $cachedTimestamp );
+ $this->mPage->setTimestamp( $cachedTimestamp );
+ }
$outputDone = true;
}
}
$wgOut->setFollowPolicy( $policy['follow'] );
$this->showViewFooter();
- $this->mPage->viewUpdates();
+ $this->mPage->doViewUpdates( $wgUser );
wfProfileOut( __METHOD__ );
}
if ( $diff == 0 || $diff == $this->mPage->getLatest() ) {
# Run view updates for current revision only
- $this->mPage->viewUpdates();
+ $this->mPage->doViewUpdates( $wgUser );
}
}
array( 'known', 'noclasses' )
);
- $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 ) ) {
- $cdel = Linker::revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops
- } else {
- $query = array(
- 'type' => 'revision',
- 'target' => $this->getTitle()->getPrefixedDbkey(),
- 'ids' => $oldid
- );
- $cdel = Linker::revDeleteLink( $query, $revision->isDeleted( File::DELETED_RESTRICTED ), $canHide );
- }
+ $cdel = Linker::getRevDeleteLink( $wgUser, $revision, $this->getTitle() );
+ if ( $cdel !== '' ) {
$cdel .= ' ';
}
return;
}
- # Hack for big sites
- $bigHistory = $this->mPage->isBigDeletion();
- if ( $bigHistory && !$title->userCan( 'bigdelete' ) ) {
- global $wgDeleteRevisionsLimit;
-
- $wgOut->setPageTitle( wfMessage( 'cannotdelete-title', $title->getPrefixedText() ) );
- $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n",
- array( 'delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
-
- return;
- }
-
$deleteReasonList = $wgRequest->getText( 'wpDeleteReasonList', 'other' );
$deleteReason = $wgRequest->getText( 'wpReason' );
// If the page has a history, insert a warning
if ( $hasHistory ) {
- $revisions = $this->mPage->estimateRevisionCount();
+ $revisions = $this->mTitle->estimateRevisionCount();
// @todo FIXME: i18n issue/patchwork message
$wgOut->addHTML( '<strong class="mw-delete-warning-revisions">' .
wfMsgExt( 'historywarning', array( 'parseinline' ), $wgLang->formatNum( $revisions ) ) .
'</strong>'
);
- if ( $bigHistory ) {
+ if ( $this->mTitle->isBigDeletion() ) {
global $wgDeleteRevisionsLimit;
$wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n",
array( 'delete-warning-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
public function doDelete( $reason, $suppress = false ) {
global $wgOut;
- $id = $this->getTitle()->getArticleID( Title::GAID_FOR_UPDATE );
-
$error = '';
- if ( $this->mPage->doDeleteArticle( $reason, $suppress, $id, true, $error ) ) {
+ if ( $this->mPage->doDeleteArticle( $reason, $suppress, 0, true, $error ) ) {
$deleted = $this->getTitle()->getPrefixedText();
$wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
// ****** B/C functions to work-around PHP silliness with __call and references ****** //
+ /**
+ * @param $limit array
+ * @param $expiry array
+ * @param $cascade bool
+ * @param $reason string
+ * @param $user User
+ * @return Status
+ */
+ public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user ) {
+ return $this->mPage->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $user );
+ }
+
/**
* @param $limit array
* @param $reason string