Warn if stateful ParserOutput transforms are used
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 22 Nov 2017 23:11:43 +0000 (18:11 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 30 Nov 2017 19:27:49 +0000 (14:27 -0500)
This should help clean up any missed uses.

Change-Id: I371f3b27d245d6927c74ea52f1df9fd5c675b94a
Depends-On: I30f162aa43c7f513df1153e0884a4339e4279aeb
Depends-On: Iff28b00638c15de7307a130196bbb91cda91c3d1
Depends-On: I432da8c0686c279b3c2e770f7f9e20248589d6db
Depends-On: I404f064b93573e80b61a228e3cf2b5d2add65c39
Depends-On: Ia54a9e3d11c9ab28975947148d0841819f3a8e3c
Depends-On: I2cd7519186f2319f32cf6288655ddb873337a638
Depends-On: I28b46cf4da66cc6e1f04045939a243faa30bc9bf
Depends-On: I3565868af824a08235ab5ce4a34145895ed0e74d
Depends-On: I0d05ce2f565778a4bf39d3d25d26acd0b8043788
Depends-On: I100fae755ae7e729d11163377fbddaebeaa020a6
Depends-On: I38e56d04f7ffbe8796dbda6500106a028a459980
Depends-On: Id6ad08a0b1f8575e7ee98916217a84c09e72dd3b
Depends-On: I2794430f6bc076f073e79e662701403f7e063c35
Depends-On: I39b599246759baad2164a29244150c99f0920684
Depends-On: Ic7aa606b7d697e06c74c1e9207efc77442f5b0c3
Depends-On: I140ff32373430b61b92226689ef9b58cca317450
Depends-On: I9b082e37f19c8baa182b0583c7d70d692fafc16e

includes/parser/ParserOutput.php
tests/phpunit/includes/parser/ParserOutputTest.php

index ff9c28d..be574f0 100644 (file)
@@ -271,13 +271,16 @@ class ParserOutput extends CacheTime {
         * @return string HTML
         */
        public function getText( $options = [] ) {
         * @return string HTML
         */
        public function getText( $options = [] ) {
-               // @todo Warn if !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled )
+               if ( !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled ) ) {
+                       wfDeprecated( 'ParserOutput stateful allowTOC', '1.31' );
+               }
 
 
-               // @todo Warn if !array_key_exists( 'enableSectionEditLinks', $options )
-               //     && !$this->mEditSectionTokens
                //  Note that while $this->mEditSectionTokens formerly defaulted to false,
                //  ParserOptions->getEditSection() defaults to true and Parser copies
                //  that to us so true makes more sense as the stateless default.
                //  Note that while $this->mEditSectionTokens formerly defaulted to false,
                //  ParserOptions->getEditSection() defaults to true and Parser copies
                //  that to us so true makes more sense as the stateless default.
+               if ( !array_key_exists( 'enableSectionEditLinks', $options ) && !$this->mEditSectionTokens ) {
+                       wfDeprecated( 'ParserOutput stateful enableSectionEditLinks', '1.31' );
+               }
 
                $options += [
                        // empty() here because old cached versions might lack the field somehow.
 
                $options += [
                        // empty() here because old cached versions might lack the field somehow.
index 441d60d..6854a27 100644 (file)
@@ -105,6 +105,8 @@ class ParserOutputTest extends MediaWikiTestCase {
                        'wgScriptPath' => '/w',
                        'wgScript' => '/w/index.php',
                ] );
                        'wgScriptPath' => '/w',
                        'wgScript' => '/w/index.php',
                ] );
+               $this->hideDeprecated( 'ParserOutput stateful allowTOC' );
+               $this->hideDeprecated( 'ParserOutput stateful enableSectionEditLinks' );
 
                $po = new ParserOutput( $text );
 
 
                $po = new ParserOutput( $text );