X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=6516ae81d2a570790e3a09aa4f6cccae4a89da50;hb=3c4bf0c2a86d9f515b47b8265bca978c21d363bd;hp=9ce3854e99241927f245cc5f36b568cce8bf9db7;hpb=89ff55344a5e797eb9cc038337424a938700c0dc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/Article.php b/includes/page/Article.php index 9ce3854e99..6516ae81d2 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -410,10 +410,18 @@ 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 ) ); @@ -679,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 @@ -1318,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(); @@ -1335,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 ); @@ -1345,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 ) ) @@ -1360,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', @@ -1382,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', @@ -1413,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', @@ -1430,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() . "
" ); } @@ -1450,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 );