+ $moduleStyles = $this->getModuleStyles( /*filter*/ true );
+
+ // Batch preload getTitleInfo for isKnownEmpty() calls below
+ $exemptModules = array_filter( $moduleStyles,
+ function ( $name ) use ( $rl, &$exemptGroups ) {
+ $module = $rl->getModule( $name );
+ return $module && isset( $exemptGroups[ $module->getGroup() ] );
+ }
+ );
+ ResourceLoaderWikiModule::preloadTitleInfo(
+ $context, wfGetDB( DB_REPLICA ), $exemptModules );
+
+ // Filter out modules handled by buildExemptModules()
+ $moduleStyles = array_filter( $moduleStyles,