$wgEnableAPI, $wgEnableWriteAPI, $wgDBname,
$wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength,
- $wgResourceLoaderStorageEnabled, $wgResourceLoaderStorageVersion;
+ $wgResourceLoaderStorageEnabled, $wgResourceLoaderStorageVersion,
+ $wgSearchType;
$mainPage = Title::newMainPage();
'wgScriptPath' => $wgScriptPath,
'wgScriptExtension' => $wgScriptExtension,
'wgScript' => $wgScript,
+ 'wgSearchType' => $wgSearchType,
'wgVariantArticlePath' => $wgVariantArticlePath,
// Force object to avoid "empty" associative array from
// becoming [] instead of {} in JS (bug 34604)
// 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, a group or a foreign source pass two arguments (name, timestamp) to
- // mw.loader.register()
+
if ( !count( $deps ) && $group === null && $source === 'local' ) {
+ // Modules without dependencies, a group or a foreign source pass two arguments (name, timestamp) to
+ // mw.loader.register()
$registrations[] = array( $name, $mtime );
- }
- // Modules with dependencies but no group or foreign source pass three arguments
- // (name, timestamp, dependencies) to mw.loader.register()
- elseif ( $group === null && $source === 'local' ) {
+ } elseif ( $group === null && $source === 'local' ) {
+ // Modules with dependencies but no group or foreign source pass three arguments
+ // (name, timestamp, dependencies) to mw.loader.register()
$registrations[] = array( $name, $mtime, $deps );
- }
- // Modules with a group but no foreign source pass four arguments (name, timestamp, dependencies, group)
- // to mw.loader.register()
- elseif ( $source === 'local' ) {
+ } elseif ( $source === 'local' ) {
+ // Modules with a group but no foreign source pass four arguments (name, timestamp, dependencies, group)
+ // to mw.loader.register()
$registrations[] = array( $name, $mtime, $deps, $group );
- }
- // Modules with a foreign source pass five arguments (name, timestamp, dependencies, group, source)
- // to mw.loader.register()
- else {
+ } else {
+ // Modules with a foreign source pass five arguments (name, timestamp, dependencies, group, source)
+ // to mw.loader.register()
$registrations[] = array( $name, $mtime, $deps, $group, $source );
}
}
return wfAppendQuery( wfScript( 'load' ), $query );
}
-
/**
* @param $context ResourceLoaderContext
* @return string
// Startup function
$configuration = $this->getConfig( $context );
$registrations = self::getModuleRegistrations( $context );
- $registrations = str_replace( "\n", "\n\t", trim( $registrations ) ); // fix indentation
- $out .= "var startUp = function() {\n" .
+ // Fix indentation
+ $registrations = str_replace( "\n", "\n\t", trim( $registrations ) );
+ $out .= "var startUp = function () {\n" .
"\tmw.config = new " . Xml::encodeJsCall( 'mw.Map', array( $wgLegacyJavaScriptGlobals ) ) . "\n" .
"\t$registrations\n" .
"\t" . Xml::encodeJsCall( 'mw.config.set', array( $configuration ) ) .
$scriptTag = Html::linkedScript( self::getStartupModulesUrl( $context ) );
$out .= "if ( isCompatible() ) {\n" .
"\t" . Xml::encodeJsCall( 'document.write', array( $scriptTag ) ) .
- "}\n" .
- "delete isCompatible;";
+ "}";
}
return $out;
$loader = $context->getResourceLoader();
$loader->preloadModuleInfo( $loader->getModuleNames(), $context );
- $this->modifiedTime[$hash] = filemtime( "$IP/resources/startup.js" );
- // ATTENTION!: Because of the line above, this is not going to cause
+ $time = max(
+ wfTimestamp( TS_UNIX, $wgCacheEpoch ),
+ filemtime( "$IP/resources/startup.js" )
+ );
+
+ // ATTENTION!: Because of the line below, this is not going to cause
// infinite recursion - think carefully before making changes to this
// code!
- $time = wfTimestamp( TS_UNIX, $wgCacheEpoch );
+ // Pre-populate modifiedTime with something because the the loop over
+ // all modules below includes the the startup module (this module).
+ $this->modifiedTime[$hash] = 1;
+
foreach ( $loader->getModuleNames() as $name ) {
$module = $loader->getModule( $name );
$time = max( $time, $module->getModifiedTime( $context ) );
}
+
$this->modifiedTime[$hash] = $time;
return $this->modifiedTime[$hash];
}
- /* Methods */
-
/**
* @return string
*/