r73984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73983‎ | r73984 | r73985 >
Date:21:13, 29 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed a use of ResourceLoader::getModule as a static method when converting things over in r73971.
Modified paths:
  • /trunk/phase3/includes/MessageBlobStore.php (modified) (history)
  • /trunk/phase3/includes/ResourceLoader.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ResourceLoader.php
@@ -299,7 +299,7 @@
300300 public function makeModuleResponse( ResourceLoaderContext $context, array $modules, $missing = null ) {
301301 // Pre-fetch blobs
302302 $blobs = $context->shouldIncludeMessages() ?
303 - MessageBlobStore::get( $modules, $context->getLanguage() ) : array();
 303+ MessageBlobStore::get( $this, $modules, $context->getLanguage() ) : array();
304304
305305 // Generate output
306306 $out = '';
Index: trunk/phase3/includes/MessageBlobStore.php
@@ -35,7 +35,7 @@
3636 * @param $lang string Language code
3737 * @return array An array mapping module names to message blobs
3838 */
39 - public static function get( $modules, $lang ) {
 39+ public static function get( ResourceLoader $resourceLoader, $modules, $lang ) {
4040 // TODO: Invalidate blob when module touched
4141 wfProfileIn( __METHOD__ );
4242 if ( !count( $modules ) ) {
@@ -43,7 +43,7 @@
4444 return array();
4545 }
4646 // Try getting from the DB first
47 - $blobs = self::getFromDB( array_keys( $modules ), $lang );
 47+ $blobs = self::getFromDB( $resourceLoader, array_keys( $modules ), $lang );
4848
4949 // Generate blobs for any missing modules and store them in the DB
5050 $missing = array_diff( array_keys( $modules ), array_keys( $blobs ) );
@@ -311,7 +311,7 @@
312312 * @param $lang string Language code
313313 * @return array Array mapping module names to blobs
314314 */
315 - private static function getFromDB( $modules, $lang ) {
 315+ private static function getFromDB( ResourceLoader $resourceLoader, $modules, $lang ) {
316316 $retval = array();
317317 $dbr = wfGetDB( DB_SLAVE );
318318 $res = $dbr->select( 'msg_resource',
@@ -321,7 +321,7 @@
322322 );
323323
324324 foreach ( $res as $row ) {
325 - $module = ResourceLoader::getModule( $row->mr_resource );
 325+ $module = $resourceLoader->getModule( $row->mr_resource );
326326 if ( !$module ) {
327327 // This shouldn't be possible
328328 throw new MWException( __METHOD__ . ' passed an invalid module name' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73971Made ResourceLoader an instantiable object, rather than a static one, making ...tparscal19:04, 29 September 2010

Status & tagging log