X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=ae55d3fb304e982ad682cda3def6f25248a55fd1;hb=16647dd966c5820ef4047f2d1e80395cda778c87;hp=70a8c53d229ff7b795afe7e30d978fb19f2ac1c5;hpb=978f299e03db0e388417a70e9fb926e76917c50b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 70a8c53d22..ae55d3fb30 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1075,7 +1075,7 @@ class OutputPage extends ContextSource { /** * Add new language links * - * @param $newLinkArray Associative array mapping language code to the page + * @param $newLinkArray array Associative array mapping language code to the page * name */ public function addLanguageLinks( $newLinkArray ) { @@ -1085,7 +1085,7 @@ class OutputPage extends ContextSource { /** * Reset the language links and add new language links * - * @param $newLinkArray Associative array mapping language code to the page + * @param $newLinkArray array Associative array mapping language code to the page * name */ public function setLanguageLinks( $newLinkArray ) { @@ -1309,7 +1309,7 @@ class OutputPage extends ContextSource { /** * Get/set the ParserOptions object to use for wikitext parsing * - * @param $options either the ParserOption to use or null to only get the + * @param $options ParserOptions|null either the ParserOption to use or null to only get the * current ParserOption object * @return ParserOptions object */ @@ -1366,7 +1366,7 @@ class OutputPage extends ContextSource { /** * Set the displayed file version * - * @param $file File|false + * @param $file File|bool * @return Mixed: previous value */ public function setFileVersion( $file ) { @@ -2344,7 +2344,7 @@ $templates * Add a "return to" link pointing to a specified title, * or the title indicated in the request, or else the main page * - * @param $unused No longer used + * @param $unused * @param $returnto Title or String to return to * @param $returntoquery String: query string for the return to link */ @@ -2439,12 +2439,12 @@ $templates * Add the default ResourceLoader modules to this object */ private function addDefaultModules() { - global $wgIncludeLegacyJavaScript, $wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest; + global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax, + $wgAjaxWatch, $wgEnableMWSuggest; // Add base resources $this->addModules( array( 'mediawiki.user', - 'mediawiki.util', 'mediawiki.page.startup', 'mediawiki.page.ready', ) ); @@ -2452,6 +2452,12 @@ $templates $this->addModules( 'mediawiki.legacy.wikibits' ); } + if ( $wgPreloadJavaScriptMwUtil ) { + $this->addModules( 'mediawiki.util' ); + } + + MWDebug::addModules( $this ); + // Add various resources if required if ( $wgUseAjax ) { $this->addModules( 'mediawiki.legacy.ajax' ); @@ -2675,6 +2681,8 @@ $templates ); // Load embeddable private modules before any loader links + // This needs to be TYPE_COMBINED so these modules are properly wrapped + // in mw.loader.implement() calls and deferred until mw.user is available $embedScripts = array( 'user.options', 'user.tokens' ); $scripts .= $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED ); @@ -2689,9 +2697,7 @@ $templates if ( $modules ) { $scripts .= Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( - "mw.loader.setBlocking( true );\n" . - Xml::encodeJsCall( 'mw.loader.load', array( $modules ) ) . - "\nmw.loader.setBlocking( false );" + Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) ) ) ); } @@ -2782,6 +2788,7 @@ $templates /** * JS stuff to put at the bottom of the + * @return string */ function getBottomScripts() { global $wgResourceLoaderExperimentalAsyncLoading; @@ -2825,13 +2832,20 @@ $templates public function getJSVars() { global $wgUseAjax, $wgEnableMWSuggest; + $latestRevID = 0; + $pageID = 0; + $canonicalName = false; # bug 21115 + $title = $this->getTitle(); $ns = $title->getNamespace(); $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText(); + if ( $ns == NS_SPECIAL ) { list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); - } else { - $canonicalName = false; # bug 21115 + } elseif ( $this->canUseWikiPage() ) { + $wikiPage = $this->getWikiPage(); + $latestRevID = $wikiPage->getLatest(); + $pageID = $wikiPage->getId(); } $lang = $title->getPageLanguage(); @@ -2856,8 +2870,8 @@ $templates 'wgNamespaceNumber' => $title->getNamespace(), 'wgPageName' => $title->getPrefixedDBKey(), 'wgTitle' => $title->getText(), - 'wgCurRevisionId' => $title->getLatestRevID(), - 'wgArticleId' => $title->getArticleId(), + 'wgCurRevisionId' => $latestRevID, + 'wgArticleId' => $pageID, 'wgIsArticle' => $this->isArticle(), 'wgAction' => Action::getActionName( $this->getContext() ), 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(), @@ -2919,7 +2933,7 @@ $templates } /** - * @param $unused Unused + * @param $unused * @param $addContentType bool * * @return string HTML tag links to be put in the header. @@ -3257,7 +3271,7 @@ $templates // Per-user preference styles if ( $wgAllowUserCssPrefs ) { - $moduleStyles[] = 'user.options'; + $moduleStyles[] = 'user.cssprefs'; } foreach ( $moduleStyles as $name ) {