X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=fd74a8281861b6b99bf482daea602635cc83f198;hp=796c575885ab386f247f3d3e7c57524bb387a3c0;hb=e7b57d881a;hpb=bdfe02223205923d923923dd420ba0dd863cd0fe diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 796c575885..fd74a82818 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -22,6 +22,7 @@ * @author Roan Kattouw */ +use MediaWiki\MediaWikiServices; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -187,7 +188,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { public function getConfig() { if ( $this->config === null ) { // Ugh, fall back to default - $this->config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); + $this->config = MediaWikiServices::getInstance()->getMainConfig(); } return $this->config; @@ -330,14 +331,13 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } /** - * Where on the HTML page should this module's JS be loaded? - * - 'top': in the "" - * - 'bottom': at the bottom of the "" + * From where in the page HTML should this module be loaded? * + * @deprecated since 1.29 Obsolete. All modules load async from ``. * @return string */ public function getPosition() { - return 'bottom'; + return 'top'; } /** @@ -476,14 +476,18 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } $vary = $context->getSkin() . '|' . $context->getLanguage(); + // Use relative paths to avoid ghost entries when $IP changes (T111481) + $deps = FormatJson::encode( self::getRelativePaths( $localFileRefs ) ); $dbw = wfGetDB( DB_MASTER ); - $dbw->replace( 'module_deps', - [ [ 'md_module', 'md_skin' ] ], + $dbw->upsert( 'module_deps', [ 'md_module' => $this->getName(), 'md_skin' => $vary, - // Use relative paths to avoid ghost entries when $IP changes (T111481) - 'md_deps' => FormatJson::encode( self::getRelativePaths( $localFileRefs ) ), + 'md_deps' => $deps, + ], + [ 'md_module', 'md_skin' ], + [ + 'md_deps' => $deps, ] );