From: Timo Tijhof Date: Wed, 15 Feb 2017 00:25:39 +0000 (-0800) Subject: OutputPage: Log violations of module 'target' filter X-Git-Tag: 1.31.0-rc.0~4084^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=835833ea8a7e479d1c43a92f7dfb52381ab6557e;p=lhc%2Fweb%2Fwiklou.git OutputPage: Log violations of module 'target' filter Bug: T140675 Change-Id: Icf9a2e72b663e363e8c87d5d464892c2bbbe78b2 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index af8243646b..eb2f7e7069 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 *