X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderFileModule.php;h=46751918847a9af17091587d538a9054ac225c8b;hb=d84c3dde5af90c5c3497d18e427a5c2a38ac6ca8;hp=07649e34497a4586ccbe42c0848f9c74cb476200;hpb=fba48c6dae69b7163580d936095b7dd16c9b3644;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 07649e3449..4675191884 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -117,9 +117,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** @var string Name of group to load this module in */ protected $group; - /** @var string Position on the page to load this module at */ - protected $position = 'bottom'; - /** @var bool Link to raw files in debug mode */ protected $debugRaw = true; @@ -204,8 +201,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * 'messages' => [array of message key strings], * // Group which this module should be loaded together with * 'group' => [group name string], - * // Position on the page to load this module at - * 'position' => ['bottom' (default) or 'top'] * // Function that, if it returns true, makes the loader skip this module. * // The file must contain valid JavaScript for execution in a private function. * // The file must not contain the "function () {" and "}" wrapper though. @@ -272,7 +267,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $this->{$member} = $option; break; // Single strings - case 'position': case 'group': case 'skipFunction': $this->{$member} = (string)$option; @@ -445,13 +439,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { return $this->group; } - /** - * @return string - */ - public function getPosition() { - return $this->position; - } - /** * Gets list of names of modules this module depends on. * @param ResourceLoaderContext|null $context @@ -573,7 +560,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { // - dependencies (provided via startup module) // - targets // - group (provided via startup module) - // - position (only used by OutputPage) 'scripts', 'debugScripts', 'styles', @@ -594,6 +580,12 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 'fileHashes' => $this->getFileHashes( $context ), 'messageBlob' => $this->getMessageBlob( $context ), ]; + + $lessVars = $this->getLessVars( $context ); + if ( $lessVars ) { + $summary[] = [ 'lessVars' => $lessVars ]; + } + return $summary; } @@ -994,18 +986,19 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $files = $compiler->AllParsedFiles(); $this->localFileRefs = array_merge( $this->localFileRefs, $files ); + // Cache for 24 hours (86400 seconds). $cache->set( $cacheKey, [ 'css' => $css, 'files' => $files, 'hash' => FileContentsHasher::getFileContentsHash( $files ), - ], 60 * 60 * 24 ); // 86400 seconds, or 24 hours. + ], 3600 * 24 ); return $css; } /** * Takes named templates by the module and returns an array mapping. - * @return array of templates mapping template alias to content + * @return array Templates mapping template alias to content * @throws MWException */ public function getTemplates() { @@ -1036,7 +1029,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * the BOM character is not valid in the middle of a string. * We already assume UTF-8 everywhere, so this should be safe. * - * @return string input minus the intial BOM char + * @param string $input + * @return string Input minus the intial BOM char */ protected function stripBom( $input ) { if ( substr_compare( "\xef\xbb\xbf", $input, 0, 3 ) === 0 ) {