Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -1957,6 +1957,13 @@ |
1958 | 1958 | define( 'TS_DB2', 8 ); |
1959 | 1959 | |
1960 | 1960 | /** |
| 1961 | + * ISO 8601 basic format with no timezone: 19860209T200000Z |
| 1962 | + * |
| 1963 | + * This is used by ResourceLoader |
| 1964 | + */ |
| 1965 | +define( 'TS_ISO_8601_BASIC', 9 ); |
| 1966 | + |
| 1967 | +/** |
1961 | 1968 | * @param $outputtype Mixed: A timestamp in one of the supported formats, the |
1962 | 1969 | * function will autodetect which format is supplied and act |
1963 | 1970 | * accordingly. |
— | — | @@ -1983,6 +1990,8 @@ |
1984 | 1991 | str_replace( '+00:00', 'UTC', $ts ) ) ); |
1985 | 1992 | } elseif ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.*\d*)?Z$/', $ts, $da ) ) { |
1986 | 1993 | # TS_ISO_8601 |
| 1994 | + } elseif ( preg_match( '/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(?\.*\d*)?Z$/', $ts, $da ) ) { |
| 1995 | + #TS_ISO_8601_BASIC |
1987 | 1996 | } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d*[\+\- ](\d\d)$/', $ts, $da ) ) { |
1988 | 1997 | # TS_POSTGRES |
1989 | 1998 | } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/', $ts, $da ) ) { |
— | — | @@ -2014,6 +2023,8 @@ |
2015 | 2024 | return gmdate( 'Y-m-d H:i:s', $uts ); |
2016 | 2025 | case TS_ISO_8601: |
2017 | 2026 | return gmdate( 'Y-m-d\TH:i:s\Z', $uts ); |
| 2027 | + case TS_ISO_8601_BASIC: |
| 2028 | + return gmdate( 'Ymd\THis\Z', $uts ); |
2018 | 2029 | // This shouldn't ever be used, but is included for completeness |
2019 | 2030 | case TS_EXIF: |
2020 | 2031 | return gmdate( 'Y:m:d H:i:s', $uts ); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2343,12 +2343,12 @@ |
2344 | 2344 | // Create a fake request based on the one we are about to make so modules return correct times |
2345 | 2345 | $context = new ResourceLoaderContext( $this->mResourceLoader, new FauxRequest( $query ) ); |
2346 | 2346 | // Get the maximum timestamp |
2347 | | - $timestamp = 0; |
| 2347 | + $timestamp = 1; |
2348 | 2348 | foreach ( $modules as $module ) { |
2349 | 2349 | $timestamp = max( $timestamp, $module->getModifiedTime( $context ) ); |
2350 | 2350 | } |
2351 | 2351 | // Add a version parameter so cache will break when things change |
2352 | | - $query['version'] = wfTimestamp( TS_ISO_8601, round( $timestamp, -2 ) ); |
| 2352 | + $query['version'] = wfTimestamp( TS_ISO_8601_BASIC, round( $timestamp, -2 ) ); |
2353 | 2353 | } |
2354 | 2354 | // Make queries uniform in order |
2355 | 2355 | ksort( $query ); |
Index: trunk/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -1062,7 +1062,7 @@ |
1063 | 1063 | if ( ( $loader = $module->getLoaderScript() ) !== false ) { |
1064 | 1064 | $deps = FormatJson::encode( $module->getDependencies() ); |
1065 | 1065 | $group = FormatJson::encode( $module->getGroup() ); |
1066 | | - $version = wfTimestamp( TS_ISO_8601, round( $module->getModifiedTime( $context ), -2 ) ); |
| 1066 | + $version = wfTimestamp( TS_ISO_8601_BASIC, round( $module->getModifiedTime( $context ), -2 ) ); |
1067 | 1067 | $out .= ResourceLoader::makeCustomLoaderScript( $name, $version, $deps, $group, $loader ); |
1068 | 1068 | } |
1069 | 1069 | // Automatically register module |
— | — | @@ -1106,7 +1106,7 @@ |
1107 | 1107 | 'lang' => $context->getLanguage(), |
1108 | 1108 | 'skin' => $context->getSkin(), |
1109 | 1109 | 'debug' => $context->getDebug() ? 'true' : 'false', |
1110 | | - 'version' => wfTimestamp( TS_ISO_8601, round( max( |
| 1110 | + 'version' => wfTimestamp( TS_ISO_8601_BASIC, round( max( |
1111 | 1111 | $context->getResourceLoader()->getModule( 'jquery' )->getModifiedTime( $context ), |
1112 | 1112 | $context->getResourceLoader()->getModule( 'mediawiki' )->getModifiedTime( $context ) |
1113 | 1113 | ), -2 ) ) |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -168,6 +168,7 @@ |
169 | 169 | * Special:Version now displays whether a SQLite database supports full-text |
170 | 170 | search. |
171 | 171 | * (bug 24343) New parser hook {{linkurl:}}, same as {{localurl:}} with fragment |
| 172 | +* TS_ISO_8691_BASIC was added as a time format, which is used by ResourceLoader for versioning |
172 | 173 | |
173 | 174 | === Bug fixes in 1.17 === |
174 | 175 | * (bug 17560) Half-broken deletion moved image files to deletion archive |
Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -230,24 +230,18 @@ |
231 | 231 | /* Private Methods */ |
232 | 232 | |
233 | 233 | /** |
234 | | - * Generates an ISO8601 string from a UNIX timestamp |
| 234 | + * Generates an ISO8601 "basic" string from a UNIX timestamp |
235 | 235 | */ |
236 | 236 | function formatVersionNumber( timestamp ) { |
237 | | - var date = new Date(); |
238 | | - date.setTime( timestamp * 1000 ); |
239 | | - function pad1( n ) { |
240 | | - return n < 10 ? '0' + n : n |
| 237 | + function pad( a, b, c ) { |
| 238 | + return [a < 10 ? '0' + a : a, b < 10 ? '0' + b : b, c < 10 ? '0' + c : c].join(); |
241 | 239 | } |
242 | | - function pad2( n ) { |
243 | | - return n < 10 ? '00' + n : ( n < 100 ? '0' + n : n ); |
244 | | - } |
245 | | - return date.getUTCFullYear() + '-' + |
246 | | - pad1( date.getUTCMonth() + 1 ) + '-' + |
247 | | - pad1( date.getUTCDate() ) + 'T' + |
248 | | - pad1( date.getUTCHours() ) + ':' + |
249 | | - pad1( date.getUTCMinutes() ) + ':' + |
250 | | - pad1( date.getUTCSeconds() ) + |
251 | | - 'Z'; |
| 240 | + var d = new Date() |
| 241 | + d.setTime( timestamp * 1000 ); |
| 242 | + return [ |
| 243 | + pad( d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() ), 'T', |
| 244 | + pad( d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds() ), 'Z' |
| 245 | + ].join(); |
252 | 246 | } |
253 | 247 | |
254 | 248 | /** |