X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=702a4796355fea5f47b53bdb1aa21def85b70d72;hb=8cf5c2a37ce8c9bd915c19c8216684d47feea76a;hp=5b2daddd2311d77d67285c98aad8cfad5f83a1c2;hpb=9da9bfde775cbef2bae1cccd795bb91926f82ff1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 5b2daddd23..702a479635 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -547,18 +547,32 @@ class Parser { $limitReport = str_replace( [ '-', '&' ], [ '‐', '&' ], $limitReport ); $text .= "\n\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"; + $text .= "\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 . ' ' . @@ -1183,7 +1197,8 @@ class Parser { # T2553: Note that a '|' inside an invalid link should not # be mistaken as delimiting cell parameters - if ( strpos( $cell_data[0], '[[' ) !== false ) { + # Bug T153140: Neither should language converter markup. + if ( preg_match( '/\[\[|-\{/', $cell_data[0] ) === 1 ) { $cell = "{$previous}<{$last_tag}>{$cell}"; } elseif ( count( $cell_data ) == 1 ) { $cell = "{$previous}<{$last_tag}>{$cell_data[0]}"; @@ -1932,18 +1947,6 @@ class Parser { return $attribs; } - /** - * Replace unusual escape codes in a URL with their equivalent characters - * - * @deprecated since 1.24, use normalizeLinkUrl - * @param string $url - * @return string - */ - public static function replaceUnusualEscapes( $url ) { - wfDeprecated( __METHOD__, '1.24' ); - return self::normalizeLinkUrl( $url ); - } - /** * Replace unusual escape codes in a URL with their equivalent characters * @@ -2797,6 +2800,9 @@ class Parser { case 'contentlanguage': global $wgLanguageCode; return $wgLanguageCode; + case 'pagelanguage': + $value = $pageLang->getCode(); + break; case 'cascadingsources': $value = CoreParserFunctions::cascadingsources( $this ); break; @@ -4989,7 +4995,7 @@ class Parser { $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; @@ -5257,7 +5263,7 @@ class Parser { case 'framed': case 'thumbnail': // use first appearing option, discard others. - $validated = ! $seenformat; + $validated = !$seenformat; $seenformat = true; break; default: