);
// Collect referenced files
$this->localFileRefs = array_unique( $this->localFileRefs );
- // If the list has been modified since last time we cached it, update the cache
- try {
- if ( $this->localFileRefs !== $this->getFileDependencies( $context->getSkin() ) ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->replace( 'module_deps',
- array( array( 'md_module', 'md_skin' ) ), array(
- 'md_module' => $this->getName(),
- 'md_skin' => $context->getSkin(),
- 'md_deps' => FormatJson::encode( $this->localFileRefs ),
- )
- );
- }
- } catch ( Exception $e ) {
- wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
- }
+ $this->saveFileDependencies( $context->getSkin(), $this->localFileRefs );
+
return $styles;
}
/**
* Get the files this module depends on indirectly for a given skin.
- * Currently these are only image files referenced by the module's CSS.
+ *
+ * These are only image files referenced by the module's stylesheet.
*
* @param string $skin Skin name
* @return array List of files
*/
- public function getFileDependencies( $skin ) {
+ protected function getFileDependencies( $skin ) {
// Try in-object cache first
if ( isset( $this->fileDeps[$skin] ) ) {
return $this->fileDeps[$skin];
}
/**
- * Set preloaded file dependency information. Used so we can load this
- * information for all modules at once.
+ * Set in-object cache for file dependencies.
+ *
+ * This is used to retrieve data in batches. See ResourceLoader::preloadModuleInfo().
+ * To save the data, use saveFileDependencies().
+ *
* @param string $skin Skin name
* @param array $deps Array of file names
*/
$this->fileDeps[$skin] = $deps;
}
+ /**
+ * Set the files this module depends on indirectly for a given skin.
+ *
+ * @since 1.26
+ * @param string $skin Skin name
+ * @param array $localFileRefs List of files
+ */
+ protected function saveFileDependencies( $skin, $localFileRefs ) {
+ try {
+ // If the list has been modified since last time we cached it, update the cache
+ if ( $localFileRefs !== $this->getFileDependencies( $skin ) ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->replace( 'module_deps',
+ array( array( 'md_module', 'md_skin' ) ), array(
+ 'md_module' => $this->getName(),
+ 'md_skin' => $skin,
+ 'md_deps' => FormatJson::encode( $localFileRefs ),
+ )
+ );
+ }
+ } catch ( Exception $e ) {
+ wfDebugLog( 'resourceloader', __METHOD__ . ": failed to update DB: $e" );
+ }
+ }
+
/**
* Get the last modification timestamp of the messages in this module for a given language.
* @param string $lang Language code
}
/**
- * Set a preloaded message blob last modification timestamp. Used so we
- * can load this information for all modules at once.
+ * Set in-object cache for message blob time.
+ *
+ * This is used to retrieve data in batches. See ResourceLoader::preloadModuleInfo().
+ *
* @param string $lang Language code
* @param int $mtime UNIX timestamp
*/