* Special:Version now displays whether a SQLite database supports full-text
search.
* (bug 24343) New parser hook {{linkurl:}}, same as {{localurl:}} with fragment
+* TS_ISO_8691_BASIC was added as a time format, which is used by ResourceLoader for versioning
=== Bug fixes in 1.17 ===
* (bug 17560) Half-broken deletion moved image files to deletion archive
*/
define( 'TS_DB2', 8 );
+/**
+ * ISO 8601 basic format with no timezone: 19860209T200000Z
+ *
+ * This is used by ResourceLoader
+ */
+define( 'TS_ISO_8601_BASIC', 9 );
+
/**
* @param $outputtype Mixed: A timestamp in one of the supported formats, the
* function will autodetect which format is supplied and act
str_replace( '+00:00', 'UTC', $ts ) ) );
} elseif ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.*\d*)?Z$/', $ts, $da ) ) {
# TS_ISO_8601
+ } elseif ( preg_match( '/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(?\.*\d*)?Z$/', $ts, $da ) ) {
+ #TS_ISO_8601_BASIC
} elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d*[\+\- ](\d\d)$/', $ts, $da ) ) {
# TS_POSTGRES
} elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/', $ts, $da ) ) {
return gmdate( 'Y-m-d H:i:s', $uts );
case TS_ISO_8601:
return gmdate( 'Y-m-d\TH:i:s\Z', $uts );
+ case TS_ISO_8601_BASIC:
+ return gmdate( 'Ymd\THis\Z', $uts );
// This shouldn't ever be used, but is included for completeness
case TS_EXIF:
return gmdate( 'Y:m:d H:i:s', $uts );
// Create a fake request based on the one we are about to make so modules return correct times
$context = new ResourceLoaderContext( $this->mResourceLoader, new FauxRequest( $query ) );
// Get the maximum timestamp
- $timestamp = 0;
+ $timestamp = 1;
foreach ( $modules as $module ) {
$timestamp = max( $timestamp, $module->getModifiedTime( $context ) );
}
// Add a version parameter so cache will break when things change
- $query['version'] = wfTimestamp( TS_ISO_8601, round( $timestamp, -2 ) );
+ $query['version'] = wfTimestamp( TS_ISO_8601_BASIC, round( $timestamp, -2 ) );
}
// Make queries uniform in order
ksort( $query );
if ( ( $loader = $module->getLoaderScript() ) !== false ) {
$deps = FormatJson::encode( $module->getDependencies() );
$group = FormatJson::encode( $module->getGroup() );
- $version = wfTimestamp( TS_ISO_8601, round( $module->getModifiedTime( $context ), -2 ) );
+ $version = wfTimestamp( TS_ISO_8601_BASIC, round( $module->getModifiedTime( $context ), -2 ) );
$out .= ResourceLoader::makeCustomLoaderScript( $name, $version, $deps, $group, $loader );
}
// Automatically register module
'lang' => $context->getLanguage(),
'skin' => $context->getSkin(),
'debug' => $context->getDebug() ? 'true' : 'false',
- 'version' => wfTimestamp( TS_ISO_8601, round( max(
+ 'version' => wfTimestamp( TS_ISO_8601_BASIC, round( max(
$context->getResourceLoader()->getModule( 'jquery' )->getModifiedTime( $context ),
$context->getResourceLoader()->getModule( 'mediawiki' )->getModifiedTime( $context )
), -2 ) )
/* Private Methods */
/**
- * Generates an ISO8601 string from a UNIX timestamp
+ * Generates an ISO8601 "basic" string from a UNIX timestamp
*/
function formatVersionNumber( timestamp ) {
- var date = new Date();
- date.setTime( timestamp * 1000 );
- function pad1( n ) {
- return n < 10 ? '0' + n : n
- }
- function pad2( n ) {
- return n < 10 ? '00' + n : ( n < 100 ? '0' + n : n );
- }
- return date.getUTCFullYear() + '-' +
- pad1( date.getUTCMonth() + 1 ) + '-' +
- pad1( date.getUTCDate() ) + 'T' +
- pad1( date.getUTCHours() ) + ':' +
- pad1( date.getUTCMinutes() ) + ':' +
- pad1( date.getUTCSeconds() ) +
- 'Z';
+ function pad( a, b, c ) {
+ return [a < 10 ? '0' + a : a, b < 10 ? '0' + b : b, c < 10 ? '0' + c : c].join();
+ }
+ var d = new Date()
+ d.setTime( timestamp * 1000 );
+ return [
+ pad( d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() ), 'T',
+ pad( d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds() ), 'Z'
+ ].join();
}
/**