dnsbls, are now indicated as such and use a new i18n message when displayed.
* Added new $wgHTTPImportTimeout setting. Sets timeout for
downloading the XML dump during a transwiki import in seconds.
+* Parser limit report is now available in machine-readable format to JavaScript
+ via mw.config.get('wgPageParseReport').
=== External library changes in 1.29 ===
*/
private $copyrightUrl;
+ /** @var array Profiling data */
+ private $limitReportJSData = [];
+
/**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
}
}
- // enable OOUI if requested via ParserOutput
+ // Enable OOUI if requested via ParserOutput
if ( $parserOutput->getEnableOOUI() ) {
$this->enableOOUI();
}
+ // Include parser limit report
+ if ( !$this->limitReportJSData ) {
+ $this->limitReportJSData = $parserOutput->getLimitReportJSData();
+ }
+
// Link flags are ignored for now, but may in the future be
// used to mark individual language links.
$linkFlags = [];
}
}
+ if ( $this->limitReportJSData ) {
+ $chunks[] = ResourceLoader::makeInlineScript(
+ ResourceLoader::makeConfigSetScript(
+ [ 'wgPageParseReport' => $this->limitReportJSData ]
+ )
+ );
+ }
+
return self::combineWrappedStrings( $chunks );
}
$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 . ' ' .
*/
private $mLimitReportData = [];
+ /** @var array Parser limit report data for JSON */
+ private $mLimitReportJSData = [];
+
/**
* @var array $mParseStartTime Timestamps for getTimeSinceStart().
*/
return $this->mLimitReportData;
}
+ public function getLimitReportJSData() {
+ return $this->mLimitReportJSData;
+ }
+
public function getTOCEnabled() {
return $this->mTOCEnabled;
}
*/
public function setLimitReportData( $key, $value ) {
$this->mLimitReportData[$key] = $value;
+
+ if ( is_array( $value ) ) {
+ if ( array_keys( $value ) === [ 0, 1 ]
+ && is_numeric( $value[0] )
+ && is_numeric( $value[1] )
+ ) {
+ $data = [ 'value' => $value[0], 'limit' => $value[1] ];
+ } else {
+ $data = $value;
+ }
+ } else {
+ $data = $value;
+ }
+
+ if ( strpos( $key, '-' ) ) {
+ list( $ns, $name ) = explode( '-', $key, 2 );
+ $this->mLimitReportJSData[$ns][$name] = $data;
+ } else {
+ $this->mLimitReportJSData[$key] = $data;
+ }
}
/**