From: Platonides Date: Wed, 29 Sep 2010 15:54:43 +0000 (+0000) Subject: Tiny changes, fix comment, remove unused globals and throw and exception instead... X-Git-Tag: 1.31.0-rc.0~34749 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=adf45bb4e139e3bd30ef32593a1117b78d6e0742;p=lhc%2Fweb%2Fwiklou.git Tiny changes, fix comment, remove unused globals and throw and exception instead of a fatal if given a wrong langcode. --- diff --git a/includes/Article.php b/includes/Article.php index 300c256a09..3c8f98734c 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -853,7 +853,7 @@ class Article { $wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) ); } - # Is is client cached? + # Is it client cached? if ( $wgOut->checkLastModified( $this->getTouched() ) ) { wfDebug( __METHOD__ . ": done 304\n" ); wfProfileOut( __METHOD__ ); diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 6b8860c03f..df572c866f 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -546,6 +546,8 @@ class MessageCache { } $lang = wfGetLangObj( $langcode ); + if (!$lang) throw new MWException( "Bad lang code $langcode given" ); + $langcode = $lang->getCode(); $message = false; diff --git a/includes/ResourceLoader.php b/includes/ResourceLoader.php index 484329b8c8..5647f69407 100644 --- a/includes/ResourceLoader.php +++ b/includes/ResourceLoader.php @@ -327,8 +327,6 @@ class ResourceLoader { } public static function makeModuleResponse( ResourceLoaderContext $context, array $modules, $missing = null ) { - global $wgUser; - // Pre-fetch blobs $blobs = $context->shouldIncludeMessages() ? MessageBlobStore::get( array_keys( $modules ), $context->getLanguage() ) : array(); diff --git a/maintenance/tests/phpunit/includes/api/ApiSetup.php b/maintenance/tests/phpunit/includes/api/ApiSetup.php index 23014378d0..5e108d2410 100644 --- a/maintenance/tests/phpunit/includes/api/ApiSetup.php +++ b/maintenance/tests/phpunit/includes/api/ApiSetup.php @@ -7,8 +7,7 @@ abstract class ApiTestSetup extends PHPUnit_Framework_TestCase { protected static $apiUrl; function setUp() { - global $wgServer, $wgContLang, $wgAuth, $wgScriptPath, - $wgScriptExtension, $wgMemc, $wgRequest; + global $wgServer, $wgContLang, $wgAuth, $wgMemc, $wgRequest; self::$apiUrl = $wgServer . wfScript( 'api' );