* @deprecated in 1.19; use fetchContent()
*/
function loadContent() {
+ wfDeprecated( __METHOD__, '1.19' );
$this->fetchContent();
}
* @deprecated since 1.18
*/
public function forUpdate() {
- wfDeprecated( __METHOD__ );
+ wfDeprecated( __METHOD__, '1.18' );
}
/**
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
*
*/
public function view() {
global $wgUser, $wgOut, $wgRequest, $wgParser;
- global $wgUseFileCache, $wgUseETag;
+ global $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
wfProfileIn( __METHOD__ );
}
# Try client and file cache
- if ( $oldid === 0 && $this->mPage->checkTouched() ) {
+ if ( !$wgDebugToolbar && $oldid === 0 && $this->mPage->checkTouched() ) {
if ( $wgUseETag ) {
$wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) );
}
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;
# Ensure that UI elements requiring revision ID have
# the correct version information.
$wgOut->setRevisionId( $this->mPage->getLatest() );
- $outputDone = true;
# Preload timestamp to avoid a DB hit
- if ( isset( $this->mParserOutput->mTimestamp ) ) {
- $this->mPage->setTimestamp( $this->mParserOutput->mTimestamp );
+ $cachedTimestamp = $this->mParserOutput->getTimestamp();
+ if ( $cachedTimestamp !== null ) {
+ $wgOut->setRevisionTimestamp( $cachedTimestamp );
+ $this->mPage->setTimestamp( $cachedTimestamp );
}
+ $outputDone = true;
}
}
break;
# Ensure that UI elements requiring revision ID have
# the correct version information.
$wgOut->setRevisionId( $this->getRevIdFetched() );
+ # Preload timestamp to avoid a DB hit
+ $wgOut->setRevisionTimestamp( $this->getTimestamp() );
# Pages containing custom CSS or JavaScript get special treatment
if ( $this->getTitle()->isCssOrJsPage() || $this->getTitle()->isCssJsSubpage() ) {
$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 );
}
}
'href' => $this->getTitle()->getLocalURL() )
);
+ // Tell $wgOut the user arrived at this article through a redirect
+ $wgOut->setRedirectedFrom( $this->mRedirectedFrom );
+
return true;
}
} elseif ( $rdfrom ) {
* Show the footer section of an ordinary page view
*/
public function showViewFooter() {
- global $wgOut, $wgUseTrackbacks;
+ global $wgOut;
# check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
if ( $this->getTitle()->getNamespace() == NS_USER_TALK && IP::isValid( $this->getTitle()->getText() ) ) {
# chance to mark this new article as patrolled.
$this->showPatrolFooter();
- # Trackbacks
- if ( $wgUseTrackbacks ) {
- $this->addTrackbacks();
- }
-
wfRunHooks( 'ArticleViewFooter', array( $this ) );
}
* namespace, show the default message text. To be called from Article::view().
*/
public function showMissingArticle() {
- global $wgOut, $wgRequest, $wgUser;
+ global $wgOut, $wgRequest, $wgUser, $wgSend404Code;
# Show info in user (talk) namespace. Does the user exist? Is he blocked?
if ( $this->getTitle()->getNamespace() == NS_USER || $this->getTitle()->getNamespace() == NS_USER_TALK ) {
}
$text = "<div class='noarticletext'>\n$text\n</div>";
- if ( !$this->mPage->hasViewableContent() ) {
+ if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
// If there's no backing content, send a 404 Not Found
// for better machine handling of broken links.
$wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
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 .= ' ';
}
'<span class="redirectText">' . $link . '</span></div>';
}
- /**
- * Builds trackback links for article display if $wgUseTrackbacks is set to true
- */
- public function addTrackbacks() {
- global $wgOut;
-
- $dbr = wfGetDB( DB_SLAVE );
- $tbs = $dbr->select( 'trackbacks',
- array( 'tb_id', 'tb_title', 'tb_url', 'tb_ex', 'tb_name' ),
- array( 'tb_page' => $this->mPage->getID() )
- );
-
- if ( !$dbr->numRows( $tbs ) ) {
- return;
- }
-
- $wgOut->preventClickjacking();
-
- $tbtext = "";
- foreach ( $tbs as $o ) {
- $rmvtxt = "";
-
- if ( $this->getContext()->getUser()->isAllowed( 'trackback' ) ) {
- $delurl = $this->getTitle()->getFullURL( "action=deletetrackback&tbid=" .
- $o->tb_id . "&token=" . urlencode( $this->getContext()->getUser()->getEditToken() ) );
- $rmvtxt = wfMsg( 'trackbackremove', htmlspecialchars( $delurl ) );
- }
-
- $tbtext .= "\n";
- $tbtext .= wfMsgNoTrans( strlen( $o->tb_ex ) ? 'trackbackexcerpt' : 'trackback',
- $o->tb_title,
- $o->tb_url,
- $o->tb_ex,
- $o->tb_name,
- $rmvtxt );
- }
-
- $wgOut->wrapWikiMsg( "<div id='mw_trackbacks'>\n$1\n</div>\n", array( 'trackbackbox', $tbtext ) );
- }
-
/**
* Handle action=render
*/
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' ) );
}
}
- /**
- * Removes trackback record for current article from trackbacks table
- * @deprecated since 1.18
- */
- public function deletetrackback() {
- return Action::factory( 'deletetrackback', $this )->show();
- }
-
/**
* Info about this page
* @deprecated since 1.19
*/
public function info() {
+ wfDeprecated( __METHOD__, '1.19' );
Action::factory( 'info', $this )->show();
}
* @deprecated since 1.18
*/
public function markpatrolled() {
+ wfDeprecated( __METHOD__, '1.18' );
Action::factory( 'markpatrolled', $this )->show();
}
* @deprecated since 1.19
*/
public function revert() {
+ wfDeprecated( __METHOD__, '1.19' );
Action::factory( 'revert', $this )->show();
}
* @deprecated since 1.19
*/
public function rollback() {
+ wfDeprecated( __METHOD__, '1.19' );
Action::factory( 'rollback', $this )->show();
}
* @deprecated since 1.18
*/
public function watch() {
+ wfDeprecated( __METHOD__, '1.18' );
Action::factory( 'watch', $this )->show();
}
*/
public function doWatch() {
global $wgUser;
+ wfDeprecated( __METHOD__, '1.18' );
return WatchAction::doWatch( $this->getTitle(), $wgUser );
}
* @deprecated since 1.18
*/
public function unwatch() {
+ wfDeprecated( __METHOD__, '1.18' );
Action::factory( 'unwatch', $this )->show();
}
*/
public function doUnwatch() {
global $wgUser;
+ wfDeprecated( __METHOD__, '1.18' );
return WatchAction::doUnwatch( $this->getTitle(), $wgUser );
}
* @param $extraQuery String: extra query params
*/
public function doRedirect( $noRedir = false, $sectionAnchor = '', $extraQuery = '' ) {
- wfDeprecated( __METHOD__ );
+ wfDeprecated( __METHOD__, '1.18' );
global $wgOut;
if ( $noRedir ) {
// ****** 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