Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | public function makeModuleResponse( ResourceLoaderContext $context, array $modules, $missing = null ) { |
301 | 301 | // Pre-fetch blobs |
302 | 302 | $blobs = $context->shouldIncludeMessages() ? |
303 | | - MessageBlobStore::get( $modules, $context->getLanguage() ) : array(); |
| 303 | + MessageBlobStore::get( $this, $modules, $context->getLanguage() ) : array(); |
304 | 304 | |
305 | 305 | // Generate output |
306 | 306 | $out = ''; |
Index: trunk/phase3/includes/MessageBlobStore.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | * @param $lang string Language code |
37 | 37 | * @return array An array mapping module names to message blobs |
38 | 38 | */ |
39 | | - public static function get( $modules, $lang ) { |
| 39 | + public static function get( ResourceLoader $resourceLoader, $modules, $lang ) { |
40 | 40 | // TODO: Invalidate blob when module touched |
41 | 41 | wfProfileIn( __METHOD__ ); |
42 | 42 | if ( !count( $modules ) ) { |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | return array(); |
45 | 45 | } |
46 | 46 | // Try getting from the DB first |
47 | | - $blobs = self::getFromDB( array_keys( $modules ), $lang ); |
| 47 | + $blobs = self::getFromDB( $resourceLoader, array_keys( $modules ), $lang ); |
48 | 48 | |
49 | 49 | // Generate blobs for any missing modules and store them in the DB |
50 | 50 | $missing = array_diff( array_keys( $modules ), array_keys( $blobs ) ); |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | * @param $lang string Language code |
313 | 313 | * @return array Array mapping module names to blobs |
314 | 314 | */ |
315 | | - private static function getFromDB( $modules, $lang ) { |
| 315 | + private static function getFromDB( ResourceLoader $resourceLoader, $modules, $lang ) { |
316 | 316 | $retval = array(); |
317 | 317 | $dbr = wfGetDB( DB_SLAVE ); |
318 | 318 | $res = $dbr->select( 'msg_resource', |
— | — | @@ -321,7 +321,7 @@ |
322 | 322 | ); |
323 | 323 | |
324 | 324 | foreach ( $res as $row ) { |
325 | | - $module = ResourceLoader::getModule( $row->mr_resource ); |
| 325 | + $module = $resourceLoader->getModule( $row->mr_resource ); |
326 | 326 | if ( !$module ) { |
327 | 327 | // This shouldn't be possible |
328 | 328 | throw new MWException( __METHOD__ . ' passed an invalid module name' ); |