resourceloader: Reformat code around member grouping in ResourceLoaderContext
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderContext.php
index 6c4cdfe..5ea4769 100644 (file)
@@ -33,19 +33,24 @@ class ResourceLoaderContext {
 
        protected $resourceLoader;
        protected $request;
-       protected $modules;
-       protected $language;
-       protected $direction;
+
+       // Module content vary
        protected $skin;
-       protected $user;
+       protected $language;
        protected $debug;
+       protected $user;
+
+       // Request vary (in addition to cache vary)
+       protected $modules;
        protected $only;
        protected $version;
-       protected $hash;
        protected $raw;
        protected $image;
        protected $variant;
        protected $format;
+
+       protected $direction;
+       protected $hash;
        protected $userObj;
        protected $imageObj;
 
@@ -333,14 +338,30 @@ class ResourceLoaderContext {
        }
 
        /**
+        * All factors that uniquely identify this request, except 'modules'.
+        *
+        * The list of modules is excluded here for legacy reasons as most callers already
+        * split up handling of individual modules. Including it here would massively fragment
+        * the cache and decrease its usefulness.
+        *
+        * E.g. Used by RequestFileCache to form a cache key for storing the reponse output.
+        *
         * @return string
         */
        public function getHash() {
                if ( !isset( $this->hash ) ) {
                        $this->hash = implode( '|', array(
-                               $this->getLanguage(), $this->getDirection(), $this->getSkin(), $this->getUser(),
-                               $this->getImage(), $this->getVariant(), $this->getFormat(),
-                               $this->getDebug(), $this->getOnly(), $this->getVersion()
+                               // Module content vary
+                               $this->getLanguage(),
+                               $this->getSkin(),
+                               $this->getDebug(),
+                               $this->getUser(),
+                               // Request vary
+                               $this->getOnly(),
+                               $this->getVersion(),
+                               $this->getImage(),
+                               $this->getVariant(),
+                               $this->getFormat(),
                        ) );
                }
                return $this->hash;