X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=6516ae81d2a570790e3a09aa4f6cccae4a89da50;hb=3c4bf0c2a86d9f515b47b8265bca978c21d363bd;hp=a8633e8162a2324abe8075f6726a205ead772fa8;hpb=72bc1e8cf87ec368227fdae648ab7e5037a55bcf;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/Article.php b/includes/page/Article.php index a8633e8162..6516ae81d2 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -342,7 +342,6 @@ class Article implements Page { return $this->mContent; } - $content = $this->fetchContentObject(); if ( !$content ) { @@ -353,7 +352,6 @@ class Article implements Page { $this->mContent = ContentHandler::getContentText( $content ); ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) ); - return $this->mContent; } @@ -374,7 +372,6 @@ class Article implements Page { return $this->mContentObject; } - $this->mContentLoaded = true; $this->mContent = null; @@ -413,15 +410,22 @@ class Article implements Page { // @todo FIXME: Horrible, horrible! This content-loading interface just plain sucks. // We should instead work with the Revision object when we need it... // Loads if user is allowed - $this->mContentObject = $this->mRevision->getContent( + $content = $this->mRevision->getContent( Revision::FOR_THIS_USER, $this->getContext()->getUser() ); + + if ( !$content ) { + wfDebug( __METHOD__ . " failed to retrieve content of revision " . + $this->mRevision->getId() . "\n" ); + return false; + } + + $this->mContentObject = $content; $this->mRevIdFetched = $this->mRevision->getId(); Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) ); - return $this->mContentObject; } @@ -472,7 +476,6 @@ class Article implements Page { public function view() { global $wgUseFileCache, $wgUseETag, $wgDebugToolbar, $wgMaxRedirects; - # Get variables from query string # As side effect this will load the revision and update the title # in a revision ID is passed in the request, so this should remain @@ -684,9 +687,8 @@ class Article implements Page { $this->mParserOutput = $poolArticleView->getParserOutput(); $outputPage->addParserOutput( $this->mParserOutput ); if ( $content->getRedirectTarget() ) { - $outputPage->addSubtitle( - "" . wfMessage( 'redirectpagesub' )->parse() . "" - ); + $outputPage->addSubtitle( "" . + $this->getContext()->msg( 'redirectpagesub' )->parse() . "" ); } # Don't cache a dirty ParserOutput object @@ -1080,7 +1082,6 @@ class Article implements Page { return false; } - // New page patrol: Get the timestamp of the oldest revison which // the revision table holds for the given page. Then we look // whether it's within the RC lifespan and if it is, we try @@ -1135,7 +1136,7 @@ class Article implements Page { return false; } - if ( $rc->getPerformer()->getName() == $user->getName() ) { + if ( $rc->getPerformer()->equals( $user ) ) { // Don't show a patrol link for own creations. If the user could // patrol them, they already would be patrolled return false; @@ -1324,7 +1325,8 @@ class Article implements Page { return; } - $unhide = $this->getContext()->getRequest()->getInt( 'unhide' ) == 1; + $context = $this->getContext(); + $unhide = $context->getRequest()->getInt( 'unhide' ) == 1; # Cascade unhide param in links for easy deletion browsing $extraParams = array(); @@ -1341,8 +1343,8 @@ class Article implements Page { $timestamp = $revision->getTimestamp(); $current = ( $oldid == $this->mPage->getLatest() ); - $language = $this->getContext()->getLanguage(); - $user = $this->getContext()->getUser(); + $language = $context->getLanguage(); + $user = $context->getUser(); $td = $language->userTimeAndDate( $timestamp, $user ); $tddate = $language->userDate( $timestamp, $user ); @@ -1351,13 +1353,13 @@ class Article implements Page { # Show user links if allowed to see them. If hidden, then show them only if requested... $userlinks = Linker::revUserTools( $revision, !$unhide ); - $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled() + $infomsg = $current && !$context->msg( 'revision-info-current' )->isDisabled() ? 'revision-info-current' : 'revision-info'; - $outputPage = $this->getContext()->getOutput(); + $outputPage = $context->getOutput(); $outputPage->addSubtitle( "
" . - wfMessage( $infomsg, $td ) + $context->msg( $infomsg, $td ) ->rawParams( $userlinks ) ->params( $revision->getID(), $tddate, $tdtime, $revision->getUserText() ) ->rawParams( Linker::revComment( $revision, true, true ) ) @@ -1366,18 +1368,18 @@ class Article implements Page { ); $lnk = $current - ? wfMessage( 'currentrevisionlink' )->escaped() + ? $context->msg( 'currentrevisionlink' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMessage( 'currentrevisionlink' )->escaped(), + $context->msg( 'currentrevisionlink' )->escaped(), array(), $extraParams ); $curdiff = $current - ? wfMessage( 'diff' )->escaped() + ? $context->msg( 'diff' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMessage( 'diff' )->escaped(), + $context->msg( 'diff' )->escaped(), array(), array( 'diff' => 'cur', @@ -1388,30 +1390,30 @@ class Article implements Page { $prevlink = $prev ? Linker::linkKnown( $this->getTitle(), - wfMessage( 'previousrevision' )->escaped(), + $context->msg( 'previousrevision' )->escaped(), array(), array( 'direction' => 'prev', 'oldid' => $oldid ) + $extraParams ) - : wfMessage( 'previousrevision' )->escaped(); + : $context->msg( 'previousrevision' )->escaped(); $prevdiff = $prev ? Linker::linkKnown( $this->getTitle(), - wfMessage( 'diff' )->escaped(), + $context->msg( 'diff' )->escaped(), array(), array( 'diff' => 'prev', 'oldid' => $oldid ) + $extraParams ) - : wfMessage( 'diff' )->escaped(); + : $context->msg( 'diff' )->escaped(); $nextlink = $current - ? wfMessage( 'nextrevision' )->escaped() + ? $context->msg( 'nextrevision' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMessage( 'nextrevision' )->escaped(), + $context->msg( 'nextrevision' )->escaped(), array(), array( 'direction' => 'next', @@ -1419,10 +1421,10 @@ class Article implements Page { ) + $extraParams ); $nextdiff = $current - ? wfMessage( 'diff' )->escaped() + ? $context->msg( 'diff' )->escaped() : Linker::linkKnown( $this->getTitle(), - wfMessage( 'diff' )->escaped(), + $context->msg( 'diff' )->escaped(), array(), array( 'diff' => 'next', @@ -1436,7 +1438,7 @@ class Article implements Page { } $outputPage->addSubtitle( "
" . $cdel . - wfMessage( 'revision-nav' )->rawParams( + $context->msg( 'revision-nav' )->rawParams( $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff )->escaped() . "
" ); } @@ -1456,7 +1458,7 @@ class Article implements Page { $lang = $this->getTitle()->getPageLanguage(); $out = $this->getContext()->getOutput(); if ( $appendSubtitle ) { - $out->addSubtitle( wfMessage( 'redirectpagesub' )->parse() ); + $out->addSubtitle( wfMessage( 'redirectpagesub' ) ); } $out->addModuleStyles( 'mediawiki.action.view.redirectPage' ); return static::getRedirectHeaderHtml( $lang, $target, $forceKnown ); @@ -1600,7 +1602,7 @@ class Article implements Page { if ( !$reason ) { try { $reason = $this->generateReason( $hasHistory ); - } catch ( MWException $e ) { + } catch ( Exception $e ) { # if a page is horribly broken, we still want to be able to # delete it. So be lenient about errors here. wfDebug( "Error while building auto delete summary: $e" );