X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderFileModule.php;h=112ebc0052543967c4a1727865d928eac07beadd;hb=dd3b90a9db09498bfb6f35a61aad1832b4218c8f;hp=efb151e346475076f22604c5285ba145979d1550;hpb=298e55a5b7de57f129735f0c103e4d951c550a39;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index efb151e346..112ebc0052 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -152,6 +152,12 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { */ protected $localFileRefs = array(); + /** + * @var array Place where readStyleFile() tracks file dependencies for non-existent files. + * Used in tests to detect missing dependencies. + */ + protected $missingLocalFileRefs = array(); + /* Methods */ /** @@ -591,9 +597,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $options = array(); foreach ( array( - // T104950: Do not include localBasePath! That path may vary over time and needlessly - // invalidate cache. If the path changes in a way that makes relative file paths point - // to something else, getFileHashes() will incorporate that already. + // 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', @@ -601,14 +612,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 'languageScripts', 'skinScripts', 'skinStyles', - 'dependencies', 'messages', - 'targets', 'templates', - 'group', - 'position', 'skipFunction', - 'remoteBasePath', 'debugRaw', 'raw', ) as $member ) { @@ -917,10 +923,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $localDir = dirname( $localPath ); $remoteDir = dirname( $remotePath ); // Get and register local file references - $this->localFileRefs = array_merge( - $this->localFileRefs, - CSSMin::getLocalFileReferences( $style, $localDir ) - ); + $localFileRefs = CSSMin::getAllLocalFileReferences( $style, $localDir ); + foreach ( $localFileRefs as $file ) { + if ( file_exists( $file ) ) { + $this->localFileRefs[] = $file; + } else { + $this->missingLocalFileRefs[] = $file; + } + } return CSSMin::remap( $style, $localDir, $remoteDir, true );