Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index f99089b..ff21ef0 100644 (file)
@@ -65,7 +65,6 @@ class ParserOptions {
                'stubthreshold' => true,
                'printable' => true,
                'userlang' => true,
-               'wrapclass' => true,
        ];
 
        /**
@@ -81,13 +80,6 @@ class ParserOptions {
         */
        private $mTimestamp;
 
-       /**
-        * The edit section flag is in ParserOptions for historical reasons, but
-        * doesn't actually affect the parser output since Feb 2015.
-        * @var bool
-        */
-       private $mEditSection = true;
-
        /**
         * Stored user object
         * @var User
@@ -780,13 +772,17 @@ class ParserOptions {
        /**
         * CSS class to use to wrap output from Parser::parse()
         * @since 1.30
-        * @param string|bool $className Set false to disable wrapping.
+        * @param string $className Class name to use for wrapping.
+        *   Passing false to indicate "no wrapping" was deprecated in MediaWiki 1.31.
         * @return string|bool Current value
         */
        public function setWrapOutputClass( $className ) {
                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 );
        }
 
@@ -873,7 +869,8 @@ class ParserOptions {
         * @return bool
         */
        public function getEditSection() {
-               return $this->mEditSection;
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        /**
@@ -883,7 +880,8 @@ class ParserOptions {
         * @return bool Old value
         */
        public function setEditSection( $x ) {
-               return wfSetVar( $this->mEditSection, $x );
+               wfDeprecated( __METHOD__, '1.31' );
+               return true;
        }
 
        /**
@@ -1059,8 +1057,8 @@ class ParserOptions {
                                'printable' => false,
                                'allowUnsafeRawHtml' => true,
                                'wrapclass' => 'mw-parser-output',
-                               'currentRevisionCallback' => [ 'Parser', 'statelessFetchRevision' ],
-                               'templateCallback' => [ 'Parser', 'statelessFetchTemplate' ],
+                               'currentRevisionCallback' => [ Parser::class, 'statelessFetchRevision' ],
+                               'templateCallback' => [ Parser::class, 'statelessFetchTemplate' ],
                                'speculativeRevIdCallback' => null,
                        ];
 
@@ -1256,7 +1254,7 @@ class ParserOptions {
                } elseif ( $value instanceof Language ) {
                        return $value->getCode();
                } elseif ( is_array( $value ) ) {
-                       return '[' . join( ',', array_map( [ $this, 'optionToString' ], $value ) ) . ']';
+                       return '[' . implode( ',', array_map( [ $this, 'optionToString' ], $value ) ) . ']';
                } else {
                        return (string)$value;
                }
@@ -1281,18 +1279,6 @@ class ParserOptions {
                $defaults = self::getCanonicalOverrides() + self::getDefaults();
                $inCacheKey = self::$inCacheKey;
 
-               // Historical hack: 'editsection' hasn't been a true parser option since
-               // Feb 2015 (instead the parser outputs a constant placeholder and post-parse
-               // processing handles the option). But Wikibase forces it in $forOptions
-               // and expects the cache key to still vary on it for T85252.
-               // @deprecated since 1.30, Wikibase should use addExtraKey() or something instead.
-               if ( in_array( 'editsection', $forOptions, true ) ) {
-                       $options['editsection'] = $this->mEditSection;
-                       $defaults['editsection'] = true;
-                       $inCacheKey['editsection'] = true;
-                       ksort( $inCacheKey );
-               }
-
                // We only include used options with non-canonical values in the key
                // so adding a new option doesn't invalidate the entire parser cache.
                // The drawback to this is that changing the default value of an option
@@ -1309,7 +1295,7 @@ class ParserOptions {
                        }
                }
 
-               $confstr = $values ? join( '!', $values ) : 'canonical';
+               $confstr = $values ? implode( '!', $values ) : 'canonical';
 
                // add in language specific options, if any
                // @todo FIXME: This is just a way of retrieving the url/user preferred variant