r80167 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80166‎ | r80167 | r80168 >
Date:14:42, 13 January 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Coerce mtimes to TS_UNIX before outputting them, and fix a wrong timestamp format in ResourceLoaderUserModule. This should fix bug 26704
Modified paths:
  • /trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php
@@ -40,7 +40,7 @@
4141 global $wgUser;
4242
4343 if ( $context->getUser() === $wgUser->getName() ) {
44 - return $this->modifiedTime[$hash] = $wgUser->getTouched();
 44+ return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
4545 } else {
4646 return 1;
4747 }
Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -116,7 +116,10 @@
117117 }
118118 // Automatically register module
119119 else {
120 - $mtime = max( $module->getModifiedTime( $context ), wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
 120+ // getModifiedTime() is supposed to return a UNIX timestamp, but it doesn't always
 121+ // seem to do that, and custom implementations might forget. Coerce it to TS_UNIX
 122+ $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) );
 123+ $mtime = max( $moduleMtime, wfTimestamp( TS_UNIX, $wgCacheEpoch ) );
121124 // Modules without dependencies or a group pass two arguments (name, timestamp) to
122125 // mediaWiki.loader.register()
123126 if ( !count( $module->getDependencies() && $module->getGroup() === null ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r96557MFT r80167, r81689, r87498, r89253reedy12:38, 8 September 2011

Comments

#Comment by Hashar (talk | contribs)   19:08, 26 June 2011

This looks similar to r81689 . I am wondering if we need it in 1.17 and on live site.

Status & tagging log