'wgDBname' => $conf->get( 'DBname' ),
// This sucks, it is only needed on Special:Upload, but I could
// not find a way to add vars only for a certain module
- 'wgFileCanRotate' => BitmapHandler::canRotate(),
+ 'wgFileCanRotate' => SpecialUpload::rotationEnabled(),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $conf->get( 'ExtensionAssetsPath' ),
// MediaWiki sets cookies to have this prefix by default
* @param string $moduleName
* @return array
*/
- protected static function getImplicitDependencies( Array $registryData, $moduleName ) {
+ protected static function getImplicitDependencies( array $registryData, $moduleName ) {
static $dependencyCache = array();
// The list of implicit dependencies won't be altered, so we can
* - string 'source'
* - string|false 'loader'
*/
- public static function compileUnresolvedDependencies( Array &$registryData ) {
+ public static function compileUnresolvedDependencies( array &$registryData ) {
foreach ( $registryData as $name => &$data ) {
if ( $data['loader'] !== false ) {
continue;
continue;
}
+ if ( $module->isRaw() ) {
+ // Don't register "raw" modules (like 'jquery' and 'mediawiki') client-side because
+ // depending on them is illegal anyway and would only lead to them being reloaded
+ // causing any state to be lost (like jQuery plugins, mw.config etc.)
+ continue;
+ }
+
// 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 ) );
return true;
}
+ /**
+ * Base modules required for the the base environment of ResourceLoader
+ *
+ * @return array
+ */
+ public static function getStartupModules() {
+ return array( 'jquery', 'mediawiki' );
+ }
+
/**
* Get the load URL of the startup modules.
*
* @return string
*/
public static function getStartupModulesUrl( ResourceLoaderContext $context ) {
- // The core modules:
- $moduleNames = array( 'jquery', 'mediawiki' );
+ $moduleNames = self::getStartupModules();
// Get the latest version
$loader = $context->getResourceLoader();