Merge "Removed doCascadeProtectionUpdates method to avoid DB writes on page views"
[lhc/web/wiklou.git] / includes / page / Article.php
index 089576d..817b4b6 100644 (file)
@@ -707,7 +707,7 @@ class Article implements Page {
                }
 
                # Get the ParserOutput actually *displayed* here.
-               # Note that $this->mParserOutput is the *current* version output.
+               # Note that $this->mParserOutput is the *current*/oldid version output.
                $pOutput = ( $outputDone instanceof ParserOutput )
                        ? $outputDone // object fetched by hook
                        : $this->mParserOutput;
@@ -756,9 +756,8 @@ class Article implements Page {
         * Show a diff page according to current request variables. For use within
         * Article::view() only, other callers should use the DifferenceEngine class.
         *
-        * @todo Make protected
         */
-       public function showDiffPage() {
+       protected function showDiffPage() {
                $request = $this->getContext()->getRequest();
                $user = $this->getContext()->getUser();
                $diff = $request->getVal( 'diff' );
@@ -959,9 +958,10 @@ class Article implements Page {
         */
        public function showRedirectedFromHeader() {
                global $wgRedirectSources;
-               $outputPage = $this->getContext()->getOutput();
 
-               $request = $this->getContext()->getRequest();
+               $context = $this->getContext();
+               $outputPage = $context->getOutput();
+               $request = $context->getRequest();
                $rdfrom = $request->getVal( 'rdfrom' );
 
                // Construct a URL for the current page view, but with the target title
@@ -986,7 +986,7 @@ class Article implements Page {
                                );
 
                                $outputPage->addSubtitle( "<span class=\"mw-redirectedfrom\">" .
-                                       wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse()
+                                       $context->msg( 'redirectedfrom' )->rawParams( $redir )->parse()
                                . "</span>" );
 
                                // Add the script to update the displayed URL and
@@ -1010,7 +1010,7 @@ class Article implements Page {
                        if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
                                $redir = Linker::makeExternalLink( $rdfrom, $rdfrom );
                                $outputPage->addSubtitle( "<span class=\"mw-redirectedfrom\">" .
-                                       wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse()
+                                       $context->msg( 'redirectedfrom' )->rawParams( $redir )->parse()
                                . "</span>" );
 
                                // Add the script to update the displayed URL
@@ -1325,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();
@@ -1342,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 );
@@ -1352,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( "<div id=\"mw-{$infomsg}\">" .
-                       wfMessage( $infomsg, $td )
+                       $context->msg( $infomsg, $td )
                                ->rawParams( $userlinks )
                                ->params( $revision->getID(), $tddate, $tdtime, $revision->getUserText() )
                                ->rawParams( Linker::revComment( $revision, true, true ) )
@@ -1367,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',
@@ -1389,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',
@@ -1420,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',
@@ -1437,7 +1438,7 @@ class Article implements Page {
                }
 
                $outputPage->addSubtitle( "<div id=\"mw-revision-nav\">" . $cdel .
-                       wfMessage( 'revision-nav' )->rawParams(
+                       $context->msg( 'revision-nav' )->rawParams(
                                $prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
                        )->escaped() . "</div>" );
        }
@@ -1493,8 +1494,9 @@ class Article implements Page {
                                ( $forceKnown ? array( 'known', 'noclasses' ) : array() )
                        ) . '</li>';
                }
+               $html .= '</ul>';
 
-               $redirectToText = wfMessage( 'redirectto' )->inLanguage( $lang )->text();
+               $redirectToText = wfMessage( 'redirectto' )->inLanguage( $lang )->escaped();
 
                return '<div class="redirectMsg">' .
                        '<p>' . $redirectToText . '</p>' .