Merge "Use WikiPage::makeParserOptions() where possible."
[lhc/web/wiklou.git] / includes / Article.php
index 5a8bbeb..9ab4b6b 100644 (file)
@@ -1243,7 +1243,7 @@ class Article extends Page {
 
                if ( $appendSubtitle ) {
                        $out = $this->getContext()->getOutput();
-                       $out->appendSubtitle( wfMessage( 'redirectpagesub' )->escaped() );
+                       $out->addSubtitle( wfMessage( 'redirectpagesub' )->escaped() );
                }
 
                // the loop prepends the arrow image before the link, so the first case needs to be outside
@@ -1532,11 +1532,10 @@ class Article extends Page {
                } else {
                        $outputPage->setPageTitle( wfMessage( 'cannotdelete-title', $this->getTitle()->getPrefixedText() ) );
                        if ( $error == '' ) {
-                               $errors = $status->getErrorsArray();
-                               $deleteLogPage = new LogPage( 'delete' );
-                               $outputPage->wrapWikiMsg( "<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
-                                       $errors[0]
+                               $outputPage->addWikiText(
+                                       "<div class=\"error mw-error-cannotdelete\">\n" . $status->getWikiText() . "\n</div>"
                                );
+                               $deleteLogPage = new LogPage( 'delete' );
                                $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );
 
                                LogEventsList::showLogExtract(
@@ -1618,8 +1617,11 @@ class Article extends Page {
         * @return ParserOutput or false if the given revsion ID is not found
         */
        public function getParserOutput( $oldid = null, User $user = null ) {
-               $user = is_null( $user ) ? $this->getContext()->getUser() : $user;
-               $parserOptions = $this->mPage->makeParserOptions( $user );
+               if ( $user === null ) {
+                       $parserOptions = $this->getParserOptions();
+               } else {
+                       $parserOptions = $this->mPage->makeParserOptions( $user );
+               }
 
                return $this->mPage->getParserOutput( $parserOptions, $oldid );
        }
@@ -1630,7 +1632,7 @@ class Article extends Page {
         */
        public function getParserOptions() {
                if ( !$this->mParserOptions ) {
-                       $this->mParserOptions = $this->mPage->makeParserOptions( $this->getContext()->getUser() );
+                       $this->mParserOptions = $this->mPage->makeParserOptions( $this->getContext() );
                }
                // Clone to allow modifications of the return value without affecting cache
                return clone $this->mParserOptions;