Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | * @param $modules Array: List of module names to preload information for |
53 | 53 | * @param $context ResourceLoaderContext: Context to load the information within |
54 | 54 | */ |
55 | | - protected function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) { |
| 55 | + public function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) { |
56 | 56 | if ( !count( $modules ) ) { |
57 | 57 | return; // or else Database*::select() will explode, plus it's cheaper! |
58 | 58 | } |
— | — | @@ -82,14 +82,12 @@ |
83 | 83 | |
84 | 84 | // Get message blob mtimes. Only do this for modules with messages |
85 | 85 | $modulesWithMessages = array(); |
86 | | - $modulesWithoutMessages = array(); |
87 | 86 | foreach ( $modules as $name ) { |
88 | 87 | if ( count( $this->getModule( $name )->getMessages() ) ) { |
89 | 88 | $modulesWithMessages[] = $name; |
90 | | - } else { |
91 | | - $modulesWithoutMessages[] = $name; |
92 | 89 | } |
93 | 90 | } |
| 91 | + $modulesWithoutMessages = array_flip( $modules ); // Will be trimmed down by the loop below |
94 | 92 | if ( count( $modulesWithMessages ) ) { |
95 | 93 | $res = $dbr->select( 'msg_resource', array( 'mr_resource', 'mr_timestamp' ), array( |
96 | 94 | 'mr_resource' => $modulesWithMessages, |
— | — | @@ -98,9 +96,10 @@ |
99 | 97 | ); |
100 | 98 | foreach ( $res as $row ) { |
101 | 99 | $this->getModule( $row->mr_resource )->setMsgBlobMtime( $lang, $row->mr_timestamp ); |
| 100 | + unset( $modulesWithoutMessages[$row->mr_resource] ); |
102 | 101 | } |
103 | | - } |
104 | | - foreach ( $modulesWithoutMessages as $name ) { |
| 102 | + } |
| 103 | + foreach ( array_keys( $modulesWithoutMessages ) as $name ) { |
105 | 104 | $this->getModule( $name )->setMsgBlobMtime( $lang, 0 ); |
106 | 105 | } |
107 | 106 | } |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php |
— | — | @@ -189,13 +189,17 @@ |
190 | 190 | if ( isset( $this->modifiedTime[$hash] ) ) { |
191 | 191 | return $this->modifiedTime[$hash]; |
192 | 192 | } |
| 193 | + |
| 194 | + // Call preloadModuleInfo() on ALL modules as we're about |
| 195 | + // to call getModifiedTime() on all of them |
| 196 | + $loader = $context->getResourceLoader(); |
| 197 | + $loader->preloadModuleInfo( $loader->getModuleNames(), $context ); |
| 198 | + |
193 | 199 | $this->modifiedTime[$hash] = filemtime( "$IP/resources/startup.js" ); |
194 | | - |
195 | | - // ATTENTION!: Because of the line above, this is not going to cause |
| 200 | + // ATTENTION!: Because of the line above, this is not going to cause |
196 | 201 | // infinite recursion - think carefully before making changes to this |
197 | 202 | // code! |
198 | 203 | $time = wfTimestamp( TS_UNIX, $wgCacheEpoch ); |
199 | | - $loader = $context->getResourceLoader(); |
200 | 204 | foreach ( $loader->getModuleNames() as $name ) { |
201 | 205 | $module = $loader->getModule( $name ); |
202 | 206 | $time = max( $time, $module->getModifiedTime( $context ) ); |