Remove $wgMemc->set() call left over from r73645
[lhc/web/wiklou.git] / includes / ResourceLoaderContext.php
index 269712a..11a86ad 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @author Trevor Parscal
  * @author Roan Kattouw
  */
 
+defined( 'MEDIAWIKI' ) || die( 1 );
+
 /**
- * Object passed around to modules which contains information about the state of a specific loader request
+ * Object passed around to modules which contains information about the state 
+ * of a specific loader request
  */
 class ResourceLoaderContext {
+
        /* Protected Members */
 
+       protected $resourceLoader;
        protected $request;
        protected $modules;
        protected $language;
@@ -38,17 +44,19 @@ class ResourceLoaderContext {
 
        /* Methods */
 
-       public function __construct( WebRequest $request ) {
-               global $wgLang, $wgDefaultSkin;
+       public function __construct( ResourceLoader $resourceLoader, WebRequest $request ) {
+               global $wgLang, $wgDefaultSkin, $wgResourceLoaderDebug;
 
+               $this->resourceLoader = $resourceLoader;
                $this->request = $request;
-               // Interperet request
-               $this->modules = explode( '|', $request->getVal( 'modules' ) );
+               // Interpret request
+               $modules = $request->getVal( 'modules' );
+               $this->modules = $modules ? explode( '|', $modules ) : array();
                $this->language = $request->getVal( 'lang' );
                $this->direction = $request->getVal( 'dir' );
                $this->skin = $request->getVal( 'skin' );
                $this->user = $request->getVal( 'user' );
-               $this->debug = $request->getBool( 'debug' ) && $request->getVal( 'debug' ) === 'true';
+               $this->debug = $request->getFuzzyBool( 'debug', $wgResourceLoaderDebug );
                $this->only = $request->getVal( 'only' );
                $this->version = $request->getVal( 'version' );
 
@@ -66,6 +74,10 @@ class ResourceLoaderContext {
                }
        }
 
+       public function getResourceLoader() {
+               return $this->resourceLoader;
+       }
+       
        public function getRequest() {
                return $this->request;
        }
@@ -115,9 +127,12 @@ class ResourceLoaderContext {
        }
 
        public function getHash() {
-               return isset( $this->hash ) ?
-                       $this->hash : $this->hash = implode( '|', array(
-                               $this->language, $this->direction, $this->skin, $this->user, $this->debug, $this->only, $this->version
+               if ( isset( $this->hash ) ) {
+                       $this->hash = implode( '|', array(
+                               $this->language, $this->direction, $this->skin, $this->user, 
+                               $this->debug, $this->only, $this->version
                        ) );
+               }
+               return $this->hash;
        }
-}
\ No newline at end of file
+}