Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/314015
Change subject: Don't use Config as an access method for global objects
......................................................................
Don't use Config as an access method for global objects
The Config interface (and it's implementation(s)) was never thought
to be an access method for objects saved in the global state, even
if it works with the current implementation GlobalVarConfig.
Imagine, that MediaWiki core switches to another file-based configuratiion
storage or a a database based one, we wouldn't be able to provide
access to global objects anymore, without weird hacks in the new
config-backend implementation or serializing objects to store in
the database or something else. This all isn't the idea with the Config
interface, as far as I know, so don't use it at all.
This commit changes the access to wgContLang to use the global keyword,
instead of accessing it through Config.
Follow up: Ice4f40911c3761c2542430935bc1898bc4e7a4d4
Follow up: I46f376a82205a5c99b98c9e971f9e9d7868ce9fb
Change-Id: I7a08b3bb649898abd445317a523051b07420b211
---
M includes/OutputPage.php
M includes/cache/HTMLFileCache.php
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/15/314015/1
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index b2e7d94..a69c0e6 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2215,6 +2215,8 @@
* @throws MWException
*/
public function output( $return = false ) {
+ global $wgContLang;
+
if ( $this->mDoNothing ) {
return $return ? '' : null;
}
@@ -2261,7 +2263,7 @@
ob_start();
$response->header( 'Content-type: ' . $config->get( 'MimeType'
) . '; charset=UTF-8' );
- $response->header( 'Content-language: ' . $config->get(
'ContLang' )->getHtmlCode() );
+ $response->header( 'Content-language: ' .
$wgContLang->getHtmlCode() );
// Avoid Internet Explorer "compatibility view" in IE 8-10, so
that
// jQuery etc. can work correctly.
diff --git a/includes/cache/HTMLFileCache.php b/includes/cache/HTMLFileCache.php
index 060837e..ae8efa9 100644
--- a/includes/cache/HTMLFileCache.php
+++ b/includes/cache/HTMLFileCache.php
@@ -157,6 +157,7 @@
* @return void
*/
public function loadFromFileCache( IContextSource $context, $mode =
self::MODE_NORMAL ) {
+ global $wgContLang;
$config = MediaWikiServices::getInstance()->getMainConfig();
wfDebug( __METHOD__ . "()\n" );
@@ -167,10 +168,9 @@
$context->getTitle()->resetArticleID( 0 );
}
- $contLang = $config->get( 'ContLang' );
$context->getOutput()->sendCacheControl();
header( "Content-Type: {$config->get( 'MimeType' )};
charset=UTF-8" );
- header( "Content-Language: {$contLang->getHtmlCode()}" );
+ header( "Content-Language: {$wgContLang->getHtmlCode()}" );
if ( $this->useGzip() ) {
if ( wfClientAcceptsGzip() ) {
header( 'Content-Encoding: gzip' );
--
To view, visit https://gerrit.wikimedia.org/r/314015
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a08b3bb649898abd445317a523051b07420b211
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits