X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderFileModule.php;h=4a4a828527f6ff15cee2b98c06b67837c6d3a994;hb=266dbe55e8c752654a1041a77063ae5d389c2f75;hp=b734defe3af6009e26700353ce106c95e2dbe5e0;hpb=f7ab1be2616ae13b850e728435b89cbd62d92fb4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index b734defe3a..4a4a828527 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -526,19 +526,16 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { } /** - * Helper method to gather file mtimes for getDefinitionSummary. + * Helper method to gather file hashes for getDefinitionSummary. * - * Last modified timestamps are calculated from the highest last modified - * timestamp of this module's constituent files as well as the files it - * depends on. This function is context-sensitive, only performing - * calculations on files relevant to the given language, skin and debug - * mode. + * This function is context-sensitive, only computing hashes of files relevant to the + * given language, skin, etc. * * @see ResourceLoaderModule::getFileDependencies * @param ResourceLoaderContext $context * @return array */ - protected function getFileMtimes( ResourceLoaderContext $context ) { + protected function getFileHashes( ResourceLoaderContext $context ) { $files = array(); // Flatten style files into $files @@ -577,13 +574,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { // entry point Less file we already know about. $files = array_values( array_unique( $files ) ); - // Don't max() because older files are significant. - // While the associated file names are significant, that is already taken care of by the - // definition summary. Avoid creating an array keyed by file path here because those are - // absolute file paths. Including that would needlessly cause global cache invalidation - // when the MediaWiki installation path changes (which is quite common in cases like - // Wikimedia where the installation path reflects the MediaWiki branch name). - return array_map( array( __CLASS__, 'safeFilemtime' ), $files ); + // Don't include keys or file paths here, only the hashes. Including that would needlessly + // cause global cache invalidation when files move or if e.g. the MediaWiki path changes. + // Any significant ordering is already detected by the definition summary. + return array_map( array( __CLASS__, 'safeFileHash' ), $files ); } /** @@ -597,6 +591,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $options = array(); foreach ( array( + // The following properties are omitted because they don't affect the module reponse: + // - localBasePath (Per T104950; Changes when absolute directory name changes. If + // this affects 'scripts' and other file paths, getFileHashes accounts for that.) + // - remoteBasePath (Per T104950) + // - dependencies (provided via startup module) + // - targets + // - group (provided via startup module) + // - position (only used by OutputPage) 'scripts', 'debugScripts', 'loaderScripts', @@ -604,17 +606,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 'languageScripts', 'skinScripts', 'skinStyles', - 'dependencies', 'messages', - 'targets', 'templates', - 'group', - 'position', 'skipFunction', - // FIXME: localBasePath includes the MediaWiki installation path and - // needlessly causes cache invalidation. - 'localBasePath', - 'remoteBasePath', 'debugRaw', 'raw', ) as $member ) { @@ -623,7 +617,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $summary[] = array( 'options' => $options, - 'fileMtimes' => $this->getFileMTimes( $context ), + 'fileHashes' => $this->getFileHashes( $context ), 'msgBlobMtime' => $this->getMsgBlobMtime( $context->getLanguage() ), ); return $summary;