* (bug 41966) Follow-up I551a90b0 (c2172d4): fix fatal error in PoolWorkArticleView...
[lhc/web/wiklou.git] / includes / Article.php
index ee96338..169dd03 100644 (file)
@@ -243,7 +243,7 @@ class Article extends Page {
         * @return string Return the text of this revision
         */
        public function getContent() {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = $this->getContentObject();
                return ContentHandler::getContentText( $content );
        }
@@ -377,7 +377,7 @@ class Article extends Page {
         * @deprecated in 1.21, use WikiPage::getContent() instead
         */
        function fetchContent() { #BC cruft!
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
 
                if ( $this->mContentLoaded && $this->mContent ) {
                        return $this->mContent;
@@ -688,7 +688,7 @@ class Article extends Page {
                                                $outputDone = true;
                                        } else {
                                                $content = $this->getContentObject();
-                                               $rt = $content->getRedirectChain();
+                                               $rt = $content ? $content->getRedirectChain() : null;
                                                if ( $rt ) {
                                                        wfDebug( __METHOD__ . ": showing redirect=no page\n" );
                                                        # Viewing a redirect page (e.g. with parameter redirect=no)
@@ -704,9 +704,8 @@ class Article extends Page {
                                        # Run the parse, protected by a pool counter
                                        wfDebug( __METHOD__ . ": doing uncached parse\n" );
 
-                                       // @todo: shouldn't we be passing $this->getPage() to PoolWorkArticleView instead of plain $this?
-                                       $poolArticleView = new PoolWorkArticleView( $this, $parserOptions,
-                                               $this->getRevIdFetched(), $useParserCache, $this->getContentObject(), $this->getContext() );
+                                       $poolArticleView = new PoolWorkArticleView( $this->getPage(), $parserOptions,
+                                               $this->getRevIdFetched(), $useParserCache, $this->getContentObject() );
 
                                        if ( !$poolArticleView->execute() ) {
                                                $error = $poolArticleView->getError();
@@ -832,19 +831,24 @@ class Article extends Page {
         * @param bool $showCacheHint whether to show a message telling the user to clear the browser cache (default: true).
         */
        protected function showCssOrJsPage( $showCacheHint = true ) {
+               $outputPage = $this->getContext()->getOutput();
+
                if ( $showCacheHint ) {
                        $dir = $this->getContext()->getLanguage()->getDir();
                        $lang = $this->getContext()->getLanguage()->getCode();
 
-                       $outputPage = $this->getContext()->getOutput();
                        $outputPage->wrapWikiMsg( "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
                                'clearyourcache' );
                }
 
-               // Give hooks a chance to customise the output
-               if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->fetchContentObject(), $this->getTitle(), $wgOut ) ) ) {
-                       $po = $this->mContentObject->getParserOutput( $this->getTitle() );
-                       $wgOut->addHTML( $po->getText() );
+               $this->fetchContentObject();
+
+               if ( $this->mContentObject ) {
+                       // Give hooks a chance to customise the output
+                       if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->mContentObject, $this->getTitle(), $outputPage ) ) ) {
+                               $po = $this->mContentObject->getParserOutput( $this->getTitle() );
+                               $outputPage->addHTML( $po->getText() );
+                       }
                }
        }