Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399908 )

Change subject: Remove wrapclass from parser cache key
......................................................................

Remove wrapclass from parser cache key

This will result in an exception from WikiPage::getParserOutput() if
anything was missed.

This also hard-deprecates ParserOptions::setWrapOutputClass( false )

Bug: T181846
Change-Id: Ica541e1f6b52f5eec6d28cff60ba64bf525258c7
Depends-On: Ie5d6c5ce34c05b8fe2353d3bb36b2a3a4166ec4b
Depends-On: Ibfaefde2f3811151ec712554cbc9cf2415ed017f
Depends-On: I55048bbae5d4d2d0c79c241c1784448b82db3bb4
Depends-On: I23a26ba0dfbe83007cd40e97d71a2139a5ecddc7
Depends-On: Ibc013a41f4a463f4014fbbce7ce27f8690161728
Depends-On: Ie936dff918dc0869503a924298b4580402038b52
---
M RELEASE-NOTES-1.31
M includes/parser/ParserOptions.php
M tests/phpunit/includes/parser/ParserOptionsTest.php
3 files changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/08/399908/1

diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index 31d3f51..c6ae6dc 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -148,6 +148,9 @@
   * WatchedItem::DEPRECATED_USAGE_TIMESTAMP
 * Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the
   'unwrap' transform to ParserOutput::getText() instead.
+* ParserOutput objects generated using a non-default value for
+  ParserOptions::setWrapOutputClass() can no longer be added to the parser
+  cache.
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for
diff --git a/includes/parser/ParserOptions.php 
b/includes/parser/ParserOptions.php
index a40ef12..21dfcb2 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -65,7 +65,6 @@
                'stubthreshold' => true,
                'printable' => true,
                'userlang' => true,
-               'wrapclass' => true,
        ];
 
        /**
@@ -788,6 +787,9 @@
                if ( $className === true ) { // DWIM, they probably want the 
default class name
                        $className = 'mw-parser-output';
                }
+               if ( $className === false ) {
+                       wfDeprecated( __METHOD__ . '( false )', '1.31' );
+               }
                return $this->setOption( 'wrapclass', $className );
        }
 
diff --git a/tests/phpunit/includes/parser/ParserOptionsTest.php 
b/tests/phpunit/includes/parser/ParserOptionsTest.php
index f941b8d..a8f542f 100644
--- a/tests/phpunit/includes/parser/ParserOptionsTest.php
+++ b/tests/phpunit/includes/parser/ParserOptionsTest.php
@@ -18,7 +18,6 @@
                        'stubthreshold' => true,
                        'printable' => true,
                        'userlang' => true,
-                       'wrapclass' => true,
                ];
        }
 
@@ -63,6 +62,9 @@
                        ] ],
                        'Non-in-key options are not ok' => [ false, [
                                'removeComments' => false,
+                       ] ],
+                       'Non-in-key options are not ok (2)' => [ false, [
+                               'wrapclass' => 'foobar',
                        ] ],
                        'Canonical override, not default (1)' => [ true, [
                                'tidy' => true,
@@ -210,7 +212,7 @@
                $wgHooks['ParserOptionsRegister'] = [];
                $this->assertSame( [
                        'dateformat', 'numberheadings', 'printable', 
'stubthreshold',
-                       'thumbsize', 'userlang', 'wrapclass',
+                       'thumbsize', 'userlang'
                ], ParserOptions::allCacheVaryingOptions() );
 
                self::clearCache();
@@ -228,7 +230,7 @@
                };
                $this->assertSame( [
                        'dateformat', 'foo', 'numberheadings', 'printable', 
'stubthreshold',
-                       'thumbsize', 'userlang', 'wrapclass',
+                       'thumbsize', 'userlang'
                ], ParserOptions::allCacheVaryingOptions() );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/399908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica541e1f6b52f5eec6d28cff60ba64bf525258c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to