X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=9ecfa23e2a252842b0744165d67758816b386406;hb=d199da516c7ae96e0d52b9287db333d40d440b7a;hp=91fc75c9bd68de8ae0139aa0ea54e45cf04877bd;hpb=4dccfb5fac5b7facead8719d4015b0ee225ff01f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 91fc75c9bd..9ecfa23e2a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -534,14 +534,32 @@ class OutputPage extends ContextSource { if ( $module instanceof ResourceLoaderModule && $module->getOrigin() <= $this->getAllowedModules( $type ) && ( is_null( $position ) || $module->getPosition() == $position ) - && ( !$this->mTarget || in_array( $this->mTarget, $module->getTargets() ) ) ) { + if ( $this->mTarget && !in_array( $this->mTarget, $module->getTargets() ) ) { + $this->warnModuleTargetFilter( $module->getName() ); + continue; + } $filteredModules[] = $val; } } return $filteredModules; } + private function warnModuleTargetFilter( $moduleName ) { + static $warnings = []; + if ( isset( $warnings[$this->mTarget][$moduleName] ) ) { + return; + } + $warnings[$this->mTarget][$moduleName] = true; + $this->getResourceLoader()->getLogger()->debug( + 'Module "{module}" not loadable on target "{target}".', + [ + 'module' => $moduleName, + 'target' => $this->mTarget, + ] + ); + } + /** * Get the list of modules to include on this page * @@ -763,7 +781,7 @@ class OutputPage extends ContextSource { 'epoch' => $config->get( 'CacheEpoch' ) ]; if ( $config->get( 'UseSquid' ) ) { - // bug 44570: the core page itself may not change, but resources might + // T46570: the core page itself may not change, but resources might $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config->get( 'SquidMaxage' ) ); } Hooks::run( 'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] ); @@ -1448,7 +1466,7 @@ class OutputPage extends ContextSource { ResourceLoaderModule::ORIGIN_CORE_INDIVIDUAL ); - // Site-wide styles are controlled by a config setting, see bug 71621 + // Site-wide styles are controlled by a config setting, see T73621 // for background on why. User styles are never allowed. if ( $this->getConfig()->get( 'AllowSiteCSSOnRestrictedPages' ) ) { $styleOrigin = ResourceLoaderModule::ORIGIN_USER_SITEWIDE; @@ -2484,7 +2502,7 @@ class OutputPage extends ContextSource { ) { $displayReturnto = null; - # Due to bug 32276, if a user does not have read permissions, + # Due to T34276, if a user does not have read permissions, # $this->getTitle() will just give Special:Badtitle, which is # not especially useful as a returnto parameter. Use the title # from the request instead, if there was one. @@ -3066,7 +3084,7 @@ class OutputPage extends ContextSource { $curRevisionId = 0; $articleId = 0; - $canonicalSpecialPageName = false; # bug 21115 + $canonicalSpecialPageName = false; # T23115 $title = $this->getTitle(); $ns = $title->getNamespace(); @@ -3076,7 +3094,7 @@ class OutputPage extends ContextSource { $sk = $this->getSkin(); // Get the relevant title so that AJAX features can use the correct page name - // when making API requests from certain special pages (bug 34972). + // when making API requests from certain special pages (T36972). $relevantTitle = $sk->getRelevantTitle(); $relevantUser = $sk->getRelevantUser(); @@ -3697,6 +3715,8 @@ class OutputPage extends ContextSource { */ public static function transformResourcePath( Config $config, $path ) { global $IP; + + $localDir = $IP; $remotePathPrefix = $config->get( 'ResourceBasePath' ); if ( $remotePathPrefix === '' ) { // The configured base path is required to be empty string for @@ -3710,8 +3730,18 @@ class OutputPage extends ContextSource { // - Path is protocol-relative. Fixes T155310. Not supported by RelPath lib. return $path; } + // For files in resources, extensions/ or skins/, ResourceBasePath is preferred here. + // For other misc files in $IP, we'll fallback to that as well. There is, however, a fourth + // supported dir/path pair in the configuration (wgUploadDirectory, wgUploadPath) + // which is not expected to be in wgResourceBasePath on CDNs. (T155146) + $uploadPath = $config->get( 'UploadPath' ); + if ( strpos( $path, $uploadPath ) === 0 ) { + $localDir = $config->get( 'UploadDirectory' ); + $remotePathPrefix = $remotePath = $uploadPath; + } + $path = RelPath\getRelativePath( $path, $remotePath ); - return self::transformFilePath( $remotePathPrefix, $IP, $path ); + return self::transformFilePath( $remotePathPrefix, $localDir, $path ); } /** @@ -3825,7 +3855,7 @@ class OutputPage extends ContextSource { * $wgOut->addWikiText( "
\n" * . wfMessage( 'some-error' )->plain() . "\n
" ); * - * The newline after the opening div is needed in some wikitext. See bug 19226. + * The newline after the opening div is needed in some wikitext. See T21226. * * @param string $wrap */