Make mediawiki.special.pageLanguage work again
[lhc/web/wiklou.git] / includes / OutputPage.php
index 3e0564b..93ba702 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\Session\SessionManager;
 use WrappedString\WrappedString;
 
 /**
@@ -229,9 +230,6 @@ class OutputPage extends ContextSource {
        /** @var string */
        private $mPageTitleActionText = '';
 
-       /** @var array */
-       private $mParseWarnings = array();
-
        /** @var int Cache stuff. Looks like mEnableClientCache */
        protected $mCdnMaxage = 0;
        /** @var int Upper limit on mCdnMaxage */
@@ -1773,7 +1771,6 @@ class OutputPage extends ContextSource {
                $this->mNewSectionLink = $parserOutput->getNewSection();
                $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
 
-               $this->mParseWarnings = $parserOutput->getWarnings();
                if ( !$parserOutput->isCacheable() ) {
                        $this->enableClientCache( false );
                }
@@ -1981,11 +1978,9 @@ class OutputPage extends ContextSource {
                if ( $cookies === null ) {
                        $config = $this->getConfig();
                        $cookies = array_merge(
+                               SessionManager::singleton()->getVaryCookies(),
                                array(
-                                       $config->get( 'CookiePrefix' ) . 'Token',
-                                       $config->get( 'CookiePrefix' ) . 'LoggedOut',
-                                       "forceHTTPS",
-                                       session_name()
+                                       'forceHTTPS',
                                ),
                                $config->get( 'CacheVaryCookies' )
                        );
@@ -2037,6 +2032,9 @@ class OutputPage extends ContextSource {
         * @return string
         */
        public function getVaryHeader() {
+               foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
+                       $this->addVaryHeader( $header, $options );
+               }
                return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
        }
 
@@ -2054,6 +2052,10 @@ class OutputPage extends ContextSource {
                }
                $this->addVaryHeader( 'Cookie', $cookiesOption );
 
+               foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
+                       $this->addVaryHeader( $header, $options );
+               }
+
                $headers = array();
                foreach ( $this->mVaryHeader as $header => $option ) {
                        $newheader = $header;
@@ -2177,8 +2179,8 @@ class OutputPage extends ContextSource {
 
                if ( $this->mEnableClientCache ) {
                        if (
-                               $config->get( 'UseSquid' ) && session_id() == '' && !$this->isPrintable() &&
-                               $this->mCdnMaxage != 0 && !$this->haveCacheVaryCookies()
+                               $config->get( 'UseSquid' ) && !SessionManager::getGlobalSession()->isPersistent() &&
+                               !$this->isPrintable() && $this->mCdnMaxage != 0 && !$this->haveCacheVaryCookies()
                        ) {
                                if ( $config->get( 'UseESI' ) ) {
                                        # We'll purge the proxy cache explicitly, but require end user agents
@@ -2338,15 +2340,6 @@ class OutputPage extends ContextSource {
                print $ins;
        }
 
-       /**
-        * Produce a "user is blocked" page.
-        * @deprecated since 1.18
-        */
-       function blockedPage() {
-               wfDeprecated( __METHOD__, '1.18' );
-               throw new UserBlockedError( $this->getUser()->mBlock );
-       }
-
        /**
         * Prepare this object to display an error page; disable caching and
         * indexing, clear the current text and redirect, set the page's title
@@ -2488,17 +2481,6 @@ class OutputPage extends ContextSource {
                $this->returnToMain();
        }
 
-       /**
-        * Display an error page noting that a given permission bit is required.
-        * @deprecated since 1.18, just throw the exception directly
-        * @param string $permission Key required
-        * @throws PermissionsError
-        */
-       public function permissionRequired( $permission ) {
-               wfDeprecated( __METHOD__, '1.18' );
-               throw new PermissionsError( $permission );
-       }
-
        /**
         * Format a list of error messages
         *
@@ -3953,20 +3935,6 @@ class OutputPage extends ContextSource {
                $this->addWikiText( $s );
        }
 
-       /**
-        * Include jQuery core. Use this to avoid loading it multiple times
-        * before we get a usable script loader.
-        *
-        * @param array $modules List of jQuery modules which should be loaded
-        * @return array The list of modules which were not loaded.
-        * @since 1.16
-        * @deprecated since 1.17
-        */
-       public function includeJQuery( array $modules = array() ) {
-               wfDeprecated( __METHOD__, '1.17' );
-               return array();
-       }
-
        /**
         * Enables/disables TOC, doesn't override __NOTOC__
         * @param bool $flag