Merge "Change 'editfont' default preference to 'monospace'"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderFileModule.php
index 07649e3..4675191 100644 (file)
@@ -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 ) {