X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderStartUpModule.php;h=2e3c6fc161da73cf335cbf4612caed6350fab219;hb=de6dab71e3ea0166095b6c6e3837255d1e56b887;hp=8b9feeb8f04122a2725996b13e14184d432a1b82;hpb=23f0ce46d46d06e4aa71b9bfe6d47bc5aaa63e68;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 8b9feeb8f0..2e3c6fc161 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -1,7 +1,5 @@ + * + * The startup module, as being called only from ResourceLoaderClientHtml, has + * the ability to vary based extra query parameters, in addition to those + * from ResourceLoaderContext: + * + * - target: Only register modules in the client allowed within this target. + * Default: "desktop". + * See also: OutputPage::setTarget(), ResourceLoaderModule::getTargets(). + */ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // Cache for getConfigSettings() as it's called by multiple methods @@ -66,6 +77,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { } $illegalFileChars = $conf->get( 'IllegalFileChars' ); + $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; // Build list of variables $vars = [ @@ -76,7 +88,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get( 'ArticlePath' ), 'wgScriptPath' => $conf->get( 'ScriptPath' ), - 'wgScriptExtension' => '.php', 'wgScript' => wfScript(), 'wgSearchType' => $conf->get( 'SearchType' ), 'wgVariantArticlePath' => $conf->get( 'VariantArticlePath' ), @@ -89,8 +100,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgContentLanguage' => $wgContLang->getCode(), 'wgTranslateNumerals' => $conf->get( 'TranslateNumerals' ), 'wgVersion' => $conf->get( 'Version' ), - 'wgEnableAPI' => $conf->get( 'EnableAPI' ), - 'wgEnableWriteAPI' => $conf->get( 'EnableWriteAPI' ), + 'wgEnableAPI' => true, // Deprecated since MW 1.32 + 'wgEnableWriteAPI' => true, // Deprecated since MW 1.32 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, @@ -113,6 +124,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ), 'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ), 'wgEnableUploads' => $conf->get( 'EnableUploads' ), + 'wgCommentByteLimit' => $oldCommentSchema ? 255 : null, + 'wgCommentCodePointLimit' => $oldCommentSchema ? null : CommentStore::COMMENT_CHARACTER_LIMIT, ]; Hooks::run( 'ResourceLoaderGetConfigVars', [ &$vars ] ); @@ -192,7 +205,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { */ public function getModuleRegistrations( ResourceLoaderContext $context ) { $resourceLoader = $context->getResourceLoader(); - $target = $context->getRequest()->getVal( 'target', 'desktop' ); + // Future developers: Use WebRequest::getRawVal() instead getVal(). + // The getVal() method performs slow Language+UTF logic. (f303bb9360) + $target = $context->getRequest()->getRawVal( 'target', 'desktop' ); // Bypass target filter if this request is Special:JavaScriptTest. // To prevent misuse in production, this is only allowed if testing is enabled server-side. $byPassTargetFilter = $this->getConfig()->get( 'EnableJavaScriptTest' ) && $target === 'test';