$limitReport = str_replace( [ '-', '&' ], [ '‐', '&' ], $limitReport );
$text .= "\n<!-- \n$limitReport-->\n";
- // Add on template profiling data
+ // Add on template profiling data in human/machine readable way
$dataByFunc = $this->mProfiler->getFunctionStats();
uasort( $dataByFunc, function ( $a, $b ) {
return $a['real'] < $b['real']; // descending order
} );
- $profileReport = "Transclusion expansion time report (%,ms,calls,template)\n";
+ $profileReport = [];
foreach ( array_slice( $dataByFunc, 0, 10 ) as $item ) {
- $profileReport .= sprintf( "%6.2f%% %8.3f %6d - %s\n",
+ $profileReport[] = sprintf( "%6.2f%% %8.3f %6d %s",
$item['%real'], $item['real'], $item['calls'],
htmlspecialchars( $item['name'] ) );
}
- $text .= "\n<!-- \n$profileReport-->\n";
+ $text .= "<!--\nTransclusion expansion time report (%,ms,calls,template)\n";
+ $text .= implode( "\n", $profileReport ) . "\n-->\n";
+
+ $this->mOutput->setLimitReportData( 'limitreport-timingprofile', $profileReport );
+
+ // Add other cache related metadata
+ if ( $wgShowHostnames ) {
+ $this->mOutput->setLimitReportData( 'cachereport-origin', wfHostname() );
+ }
+ $this->mOutput->setLimitReportData( 'cachereport-timestamp',
+ $this->mOutput->getCacheTime() );
+ $this->mOutput->setLimitReportData( 'cachereport-ttl',
+ $this->mOutput->getCacheExpiry() );
+ $this->mOutput->setLimitReportData( 'cachereport-transientcontent',
+ $this->mOutput->hasDynamicContent() );
if ( $this->mGeneratedPPNodeCount > $this->mOptions->getMaxGeneratedPPNodeCount() / 10 ) {
wfDebugLog( 'generated-pp-node-count', $this->mGeneratedPPNodeCount . ' ' .
case 'contentlanguage':
global $wgLanguageCode;
return $wgLanguageCode;
+ case 'pagelanguage':
+ $value = $pageLang->getCode();
+ break;
case 'cascadingsources':
$value = CoreParserFunctions::cascadingsources( $this );
break;
$descQuery = false;
Hooks::run( 'BeforeParserFetchFileAndTitle',
[ $this, $title, &$options, &$descQuery ] );
- # Don't register it now, as ImageGallery does that later.
+ # Don't register it now, as TraditionalImageGallery does that later.
$file = $this->fetchFileNoRegister( $title, $options );
$handler = $file ? $file->getHandler() : false;
case 'framed':
case 'thumbnail':
// use first appearing option, discard others.
- $validated = ! $seenformat;
+ $validated = !$seenformat;
$seenformat = true;
break;
default: