Coerce mtimes to TS_UNIX before outputting them, and fix a wrong timestamp format...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 13 Jan 2011 14:42:19 +0000 (14:42 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 13 Jan 2011 14:42:19 +0000 (14:42 +0000)
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/resourceloader/ResourceLoaderUserOptionsModule.php

index 3f1f235..bf998e5 100644 (file)
@@ -116,7 +116,10 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        }
                        // Automatically register module
                        else {
-                               $mtime = max( $module->getModifiedTime( $context ), wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
+                               // getModifiedTime() is supposed to return a UNIX timestamp, but it doesn't always
+                               // seem to do that, and custom implementations might forget. Coerce it to TS_UNIX
+                               $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) );
+                               $mtime = max( $moduleMtime, wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
                                // Modules without dependencies or a group pass two arguments (name, timestamp) to 
                                // mediaWiki.loader.register()
                                if ( !count( $module->getDependencies() && $module->getGroup() === null ) ) {
index 82563dc..1a9a2ca 100644 (file)
@@ -40,7 +40,7 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                global $wgUser;
 
                if ( $context->getUser() === $wgUser->getName() ) {
-                       return $this->modifiedTime[$hash] = $wgUser->getTouched();
+                       return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
                } else {
                        return 1;
                }