Moved $wgQueryPages stuff out of the global scope and into a function
[lhc/web/wiklou.git] / includes / OutputPage.php
index 1972d2d..9cba0cc 100644 (file)
@@ -685,7 +685,7 @@ class OutputPage extends ContextSource {
                        return false;
                }
                if ( !$wgCachePages ) {
-                       wfDebug( __METHOD__ . ": CACHE DISABLED\n", false );
+                       wfDebug( __METHOD__ . ": CACHE DISABLED\n" );
                        return false;
                }
 
@@ -706,7 +706,7 @@ class OutputPage extends ContextSource {
 
                $clientHeader = $this->getRequest()->getHeader( 'If-Modified-Since' );
                if ( $clientHeader === false ) {
-                       wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", false );
+                       wfDebug( __METHOD__ . ": client did not send If-Modified-Since header\n", 'log' );
                        return false;
                }
 
@@ -734,17 +734,17 @@ class OutputPage extends ContextSource {
                }
 
                wfDebug( __METHOD__ . ": client sent If-Modified-Since: " .
-                       wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", false );
+                       wfTimestamp( TS_ISO_8601, $clientHeaderTime ) . "\n", 'log' );
                wfDebug( __METHOD__ . ": effective Last-Modified: " .
-                       wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", false );
+                       wfTimestamp( TS_ISO_8601, $maxModified ) . "\n", 'log' );
                if ( $clientHeaderTime < $maxModified ) {
-                       wfDebug( __METHOD__ . ": STALE, $info\n", false );
+                       wfDebug( __METHOD__ . ": STALE, $info\n", 'log' );
                        return false;
                }
 
                # Not modified
                # Give a 304 response code and disable body output
-               wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false );
+               wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", 'log' );
                ini_set( 'zlib.output_compression', 0 );
                $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
                $this->sendCacheControl();
@@ -1574,6 +1574,7 @@ class OutputPage extends ContextSource {
                $this->addModuleScripts( $parserOutput->getModuleScripts() );
                $this->addModuleStyles( $parserOutput->getModuleStyles() );
                $this->addModuleMessages( $parserOutput->getModuleMessages() );
+               $this->addJsConfigVars( $parserOutput->getJsConfigVars() );
 
                // Template versioning...
                foreach ( (array)$parserOutput->getTemplateIds() as $ns => $dbks ) {
@@ -1919,7 +1920,7 @@ class OutputPage extends ContextSource {
                                        # We'll purge the proxy cache explicitly, but require end user agents
                                        # to revalidate against the proxy on each visit.
                                        # Surrogate-Control controls our Squid, Cache-Control downstream caches
-                                       wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", false );
+                                       wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", 'log' );
                                        # start with a shorter timeout for initial testing
                                        # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"');
                                        $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"' );
@@ -1929,7 +1930,7 @@ class OutputPage extends ContextSource {
                                        # to revalidate against the proxy on each visit.
                                        # IMPORTANT! The Squid needs to replace the Cache-Control header with
                                        # Cache-Control: s-maxage=0, must-revalidate, max-age=0
-                                       wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", false );
+                                       wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", 'log' );
                                        # start with a shorter timeout for initial testing
                                        # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" );
                                        $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' );
@@ -1937,7 +1938,7 @@ class OutputPage extends ContextSource {
                        } else {
                                # We do want clients to cache if they can, but they *must* check for updates
                                # on revisiting the page.
-                               wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", false );
+                               wfDebug( __METHOD__ . ": private caching; {$this->mLastModified} **\n", 'log' );
                                $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
                                $response->header( "Cache-Control: private, must-revalidate, max-age=0" );
                        }
@@ -1945,7 +1946,7 @@ class OutputPage extends ContextSource {
                                $response->header( "Last-Modified: {$this->mLastModified}" );
                        }
                } else {
-                       wfDebug( __METHOD__ . ": no caching **\n", false );
+                       wfDebug( __METHOD__ . ": no caching **\n", 'log' );
 
                        # In general, the absence of a last modified header should be enough to prevent
                        # the client from using its cache. We send a few other things just to make sure.
@@ -2510,14 +2511,14 @@ $templates
                        // Our XML declaration is output by Html::htmlHeader.
                        // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
                        // http://www.whatwg.org/html/semantics.html#charset
-                       $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
+                       $ret .= Html::element( 'meta', array( 'charset' => 'UTF-8' ) ) . "\n";
                }
 
                $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
 
                // Avoid Internet Explorer "compatibility view", so that
                // jQuery can work correctly.
-               $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) );
+               $ret .= Html::element( 'meta', array( 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=EDGE' ) ) . "\n";
 
                $ret .= implode( "\n", array(
                        $this->getHeadLinks(),
@@ -2945,6 +2946,16 @@ $templates
                return $html;
        }
 
+       /**
+        * Get the javascript config vars to include on this page
+        *
+        * @return Array of javascript config vars
+        * @since 1.23
+        */
+       public function getJsConfigVars() {
+               return $this->mJsConfigVars;
+       }
+
        /**
         * Add one or more variables to be set in mw.config in JavaScript.
         *
@@ -3077,7 +3088,7 @@ $templates
                wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars, $this ) );
 
                // Merge in variables from addJsConfigVars last
-               return array_merge( $vars, $this->mJsConfigVars );
+               return array_merge( $vars, $this->getJsConfigVars() );
        }
 
        /**