The Preprocessor_DOM implementation doesn't interact well with PHP memory
profiling, and has some limitations not present in the Preprocessor_Hash
implementation (see T216664). There is no reason to keep around two
versions of the preprocessor: it just complicates on-going wikitext
feature development.
Hard deprecate use of Preprocessor_DOM, so we can remove the redundant
code in a future release.
Bug: T204945
Depends-On: Id38c9360e4d02b570996dbf7a660f964f02f1a2c
Change-Id: Ica5d1ad5b1e677542962fc36d582a793f941155e
* ResourceLoaderContext::getConfig and ResourceLoaderContext::getLogger have
been deprecated. Inside ResourceLoaderModule subclasses, use the local methods
instead. Elsewhere, use the methods from the ResourceLoader class.
* ResourceLoaderContext::getConfig and ResourceLoaderContext::getLogger have
been deprecated. Inside ResourceLoaderModule subclasses, use the local methods
instead. Elsewhere, use the methods from the ResourceLoader class.
+* The Preprocessor_DOM implementation has been deprecated. It will be
+ removed in a future release. Use the Preprocessor_Hash implementation
+ instead.
=== Other changes in 1.34 ===
* …
=== Other changes in 1.34 ===
* …
* If this parameter is not given, it uses Preprocessor_DOM if the
* DOM module is available, otherwise it uses Preprocessor_Hash.
*
* If this parameter is not given, it uses Preprocessor_DOM if the
* DOM module is available, otherwise it uses Preprocessor_Hash.
*
+ * The Preprocessor_DOM class is deprecated, and will be removed in a future
+ * release.
+ *
* The entire associative array will be passed through to the constructor as
* the first parameter. Note that only Setup.php can use this variable --
* the configuration will change at runtime via Parser member functions, so
* The entire associative array will be passed through to the constructor as
* the first parameter. Note that only Setup.php can use this variable --
* the configuration will change at runtime via Parser member functions, so
/**
* Expansion frame with custom arguments
/**
* Expansion frame with custom arguments
+ * @deprecated since 1.34, use PPCustomFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
/**
* An expansion frame, used as a context to expand the result of preprocessToObj()
/**
* An expansion frame, used as a context to expand the result of preprocessToObj()
+ * @deprecated since 1.34, use PPFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
+ * @deprecated since 1.34, use PPNode_Hash_{Tree,Text,Array,Attr}
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
/**
* Expansion frame with template arguments
/**
* Expansion frame with template arguments
+ * @deprecated since 1.34, use PPTemplateFrame_Hash
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* @ingroup Parser
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
* Which class should we use for the preprocessor if not otherwise specified?
*
* @since 1.34
* Which class should we use for the preprocessor if not otherwise specified?
*
* @since 1.34
+ * @deprecated since 1.34, removing configurability of preprocessor
* @return string
*/
public static function getDefaultPreprocessorClass() {
* @return string
*/
public static function getDefaultPreprocessorClass() {
- if ( wfIsHHVM() ) {
- # Under HHVM Preprocessor_Hash is much faster than Preprocessor_DOM
- return Preprocessor_Hash::class;
- }
- if ( extension_loaded( 'domxml' ) ) {
- # PECL extension that conflicts with the core DOM extension (T15770)
- wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" );
- return Preprocessor_Hash::class;
- }
- if ( extension_loaded( 'dom' ) ) {
- return Preprocessor_DOM::class;
- }
return Preprocessor_Hash::class;
}
return Preprocessor_Hash::class;
}
*
* @file
* @ingroup Parser
*
* @file
* @ingroup Parser
+ * @deprecated since 1.34, use Preprocessor_Hash
const CACHE_PREFIX = 'preprocess-xml';
public function __construct( $parser ) {
const CACHE_PREFIX = 'preprocess-xml';
public function __construct( $parser ) {
+ wfDeprecated( __METHOD__, '1.34' ); // T204945
$this->parser = $parser;
$mem = ini_get( 'memory_limit' );
$this->memoryLimit = false;
$this->parser = $parser;
$mem = ini_get( 'memory_limit' );
$this->memoryLimit = false;
$class = $wgParserConf['class'];
$parser = new $class( [ 'preprocessorClass' => $preprocessor ] + $wgParserConf );
$class = $wgParserConf['class'];
$parser = new $class( [ 'preprocessorClass' => $preprocessor ] + $wgParserConf );
+ if ( $preprocessor ) {
+ # Suppress deprecation warning for Preprocessor_DOM while testing
+ Wikimedia\suppressWarnings();
+ wfDeprecated( 'Preprocessor_DOM::__construct' );
+ Wikimedia\restoreWarnings();
+ $parser->getPreprocessor();
+ }
ParserTestParserHook::setup( $parser );
return $parser;
ParserTestParserHook::setup( $parser );
return $parser;
$this->mOptions = ParserOptions::newFromUserAndLang( new User,
MediaWikiServices::getInstance()->getContentLanguage() );
$this->mOptions = ParserOptions::newFromUserAndLang( new User,
MediaWikiServices::getInstance()->getContentLanguage() );
+ # Suppress deprecation warning for Preprocessor_DOM while testing
+ $this->hideDeprecated( 'Preprocessor_DOM::__construct' );
+
$this->mPreprocessors = [];
foreach ( self::$classNames as $className ) {
$this->mPreprocessors[$className] = new $className( $this );
$this->mPreprocessors = [];
foreach ( self::$classNames as $className ) {
$this->mPreprocessors[$className] = new $className( $this );