Merge "xhprof: Guard against division by 0 when computing percentages"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderUserOptionsModule.php
index 3686bea..84c1906 100644 (file)
@@ -38,27 +38,32 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
        /* Methods */
 
        /**
-        * @param $context ResourceLoaderContext
-        * @return array|int|Mixed
+        * @return array List of module names as strings
+        */
+       public function getDependencies() {
+               return array( 'user.defaults' );
+       }
+
+       /**
+        * @param ResourceLoaderContext $context
+        * @return int
         */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                $hash = $context->getHash();
                if ( !isset( $this->modifiedTime[$hash] ) ) {
-                       global $wgUser;
-                       $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
+                       $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $context->getUserObj()->getTouched() );
                }
 
                return $this->modifiedTime[$hash];
        }
 
        /**
-        * @param $context ResourceLoaderContext
+        * @param ResourceLoaderContext $context
         * @return string
         */
        public function getScript( ResourceLoaderContext $context ) {
-               global $wgUser;
                return Xml::encodeJsCall( 'mw.user.options.set',
-                       array( $wgUser->getOptions() ),
+                       array( $context->getUserObj()->getOptions( User::GETOPTIONS_EXCLUDE_DEFAULTS ) ),
                        ResourceLoader::inDebugMode()
                );
        }