Don’t track build statistics for unnamed modules
Module::getName() is allowed to return null (and there are some existing modules where it returns null, such as Wikibase’s SitesModule). Passing the null name directly into strtr() produces a warning in PHP 8.1, but more importantly, it will also result in tracking the metric `resourceloader_build.` without any stat name (under any PHP version). Fix this by not tracking the individual module in this case. Bug: T319219 Change-Id: I2b2905d7452bd2694c5c1af3272e0fb0e95ff144
This commit is contained in:
parent
8d785f979d
commit
2c93649672
1 changed files with 5 additions and 2 deletions
|
|
@ -883,9 +883,12 @@ abstract class Module implements LoggerAwareInterface {
|
|||
}
|
||||
|
||||
$statTiming = microtime( true ) - $statStart;
|
||||
$statName = strtr( $this->getName(), '.', '_' );
|
||||
$stats->timing( "resourceloader_build.all", 1000 * $statTiming );
|
||||
$stats->timing( "resourceloader_build.$statName", 1000 * $statTiming );
|
||||
$name = $this->getName();
|
||||
if ( $name !== null ) {
|
||||
$statName = strtr( $name, '.', '_' );
|
||||
$stats->timing( "resourceloader_build.$statName", 1000 * $statTiming );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue