From 19ab538705cbdd5661b278e00a97e3f25e12fd42 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 29 May 2019 10:55:57 -0700 Subject: [PATCH] parser: list the vary-* flags in the NewPP report HTML comment Change-Id: I5a4afba2bfdb5b5b56ba0a01ed8ff444a67fbb1a --- includes/parser/Parser.php | 1 + includes/parser/ParserOutput.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 27c34a6dd3..6249791580 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -678,6 +678,7 @@ class Parser { $limitReport .= 'Dynamic content: ' . ( $this->mOutput->hasDynamicContent() ? 'true' : 'false' ) . "\n"; + $limitReport .= 'Complications: [' . implode( ', ', $this->mOutput->getAllFlags() ) . "]\n"; foreach ( $this->mOutput->getLimitReportData() as $key => $value ) { if ( Hooks::run( 'ParserLimitReportFormat', diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index ef22a1f235..ab7348f25b 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -895,17 +895,30 @@ class ParserOutput extends CacheTime { } /** - * Fairly generic flag setter thingy. + * Attach a flag to the output so that it can be checked later to handle special cases + * * @param string $flag */ public function setFlag( $flag ) { $this->mFlags[$flag] = true; } + /** + * @param string $flag + * @return bool Whether the given flag was set to signify a special case + */ public function getFlag( $flag ) { return isset( $this->mFlags[$flag] ); } + /** + * @return string[] List of flags signifying special cases + * @since 1.34 + */ + public function getAllFlags() { + return array_keys( $this->mFlags ); + } + /** * Set a property to be stored in the page_props database table. * -- 2.20.1