fixing r65339 which broke Upload when file dest was undefined
[lhc/web/wiklou.git] / includes / Article.php
index 9a4a700..7915e80 100644 (file)
@@ -832,15 +832,6 @@ class Article {
                        wfIncrStats( 'pcache_miss_stub' );
                }
 
-               # For the main page, overwrite the <title> element with the con-
-               # tents of 'pagetitle-view-mainpage' instead of the default (if
-               # that's not empty).
-               if ( $this->mTitle->equals( Title::newMainPage() )
-                       && ( $m = wfMsgForContent( 'pagetitle-view-mainpage' ) ) !== '' )
-               {
-                       $wgOut->setHTMLTitle( $m );
-               }
-
                $wasRedirected = $this->showRedirectedFromHeader();
                $this->showNamespaceHeader();
 
@@ -848,6 +839,7 @@ class Article {
                # Keep going until $outputDone is set, or we run out of things to do.
                $pass = 0;
                $outputDone = false;
+               $this->mParserOutput = false;
                while ( !$outputDone && ++$pass ) {
                        switch( $pass ) {
                                case 1:
@@ -956,6 +948,23 @@ class Article {
                        }
                }
 
+               # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
+               if ( $this->mParserOutput ) {
+                       $titleText = $this->mParserOutput->getTitleText();
+                       if ( strval( $titleText ) !== '' ) {
+                               $wgOut->setPageTitle( $titleText );
+                       }
+               }
+
+               # For the main page, overwrite the <title> element with the con-
+               # tents of 'pagetitle-view-mainpage' instead of the default (if
+               # that's not empty).
+               if ( $this->mTitle->equals( Title::newMainPage() )
+                       && ( $m = wfMsgForContent( 'pagetitle-view-mainpage' ) ) !== '' )
+               {
+                       $wgOut->setHTMLTitle( $m );
+               }
+
                # Now that we've filled $this->mParserOutput, we know whether
                # there are any __NOINDEX__ tags on the page
                $policy = $this->getRobotPolicy( 'view' );
@@ -1022,7 +1031,7 @@ class Article {
         *    array
         */
        public function getRobotPolicyForView() {
-               wfDeprecated( __FUNCTION__ );
+               wfDeprecated( __METHOD__ );
                $policy = $this->getRobotPolicy( 'view' );
                return $policy['index'] . ',' . $policy['follow'];
        }
@@ -1505,7 +1514,6 @@ class Article {
                                        $rmvtxt );
                }
                $wgOut->wrapWikiMsg( "<div id='mw_trackbacks'>$1</div>\n", array( 'trackbackbox', $tbtext ) );
-               $this->mTitle->invalidateCache();
        }
 
        /**
@@ -1754,6 +1762,9 @@ class Article {
 
        /**
         * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...)
+        * @param $text String: new text of the section
+        * @param $summary String: new section's subject, only if $section is 'new'
+        * @param $edittime String: revision timestamp or null to use the current revision
         * @return string Complete article text, or null if error
         */
        public function replaceSection( $section, $text, $summary = '', $edittime = null ) {