- $limitReport = "NewPP limit report\n";
- if ( $wgShowHostnames ) {
- $limitReport .= 'Parsed by ' . wfHostname() . "\n";
- }
- $limitReport .= 'Cached time: ' . $this->mOutput->getCacheTime() . "\n";
- $limitReport .= 'Cache expiry: ' . $this->mOutput->getCacheExpiry() . "\n";
- $limitReport .= 'Dynamic content: ' .
- ( $this->mOutput->hasDynamicContent() ? 'true' : 'false' ) .
- "\n";
-
- foreach ( $this->mOutput->getLimitReportData() as $key => $value ) {
- if ( Hooks::run( 'ParserLimitReportFormat',
- [ $key, &$value, &$limitReport, false, false ]
- ) ) {
- $keyMsg = wfMessage( $key )->inLanguage( 'en' )->useDatabase( false );
- $valueMsg = wfMessage( [ "$key-value-text", "$key-value" ] )
- ->inLanguage( 'en' )->useDatabase( false );
- if ( !$valueMsg->exists() ) {
- $valueMsg = new RawMessage( '$1' );
- }
- if ( !$keyMsg->isDisabled() && !$valueMsg->isDisabled() ) {
- $valueMsg->params( $value );
- $limitReport .= "{$keyMsg->text()}: {$valueMsg->text()}\n";
- }
- }
- }
- // Since we're not really outputting HTML, decode the entities and
- // then re-encode the things that need hiding inside HTML comments.
- $limitReport = htmlspecialchars_decode( $limitReport );