Merge "parser: list the vary-* flags in the NewPP report HTML comment"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 29 May 2019 19:11:38 +0000 (19:11 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 May 2019 19:11:38 +0000 (19:11 +0000)
includes/parser/Parser.php
includes/parser/ParserOutput.php

index 27c34a6..6249791 100644 (file)
@@ -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',
index ef22a1f..ab7348f 100644 (file)
@@ -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.
         *