Deprecate the ParserOutputHook functionality

These hooks should be implemented in the OutputPageParserOutput hook
instead.

Bug: T292321
Change-Id: Ib6f457596ea9d193bc03e15a48f135db4f4a6b27
This commit is contained in:
C. Scott Ananian 2022-02-08 11:12:38 -05:00
parent ab7c86ba6b
commit 773801e439
4 changed files with 19 additions and 0 deletions

View file

@ -21,6 +21,8 @@ For notes on 1.37.x and older releases, see HISTORY.
=== Configuration changes for system administrators in 1.38 ===
* Deprecate $wgAjaxUploadDestCheck, act as always-true
* $wgInterwikiCache no longer supports the string value for CDB files.
* Deprecate $wgParserOutputHooks; These should be done with
OutputPageParserOutputHook instead. (T292321)
* …
==== New configuration ====
@ -483,6 +485,8 @@ because of Phabricator reports.
- ::setFlag() - use ::setOutputFlag()
- ::getAllFlags() - this method is now marked @internal
- ::addJsConfigVars() - use ::setJsConfigVar() or ::appendJsConfigVar()
- ::addOutputHook() / ::getOutputHooks() - these hooks should be migrated
to use the OutputPageParserOutput hook instead
* The use of ParserOutput::setExtensionData() to overwrite previous values
stored under a given key has been deprecated; use the new
::appendExtensionData() to collect multiple values in the ParserOutput

View file

@ -8546,6 +8546,8 @@ $wgExtensionEntryPointListFiles = [];
* @code
* function outputHook( $outputPage, $parserOutput, $data ) { ... }
* @endcode
* @deprecated since 1.38; should be done with extensionData and the
* OutputPageParserOutputHook (T292321).
*/
$wgParserOutputHooks = [];

View file

@ -1996,6 +1996,8 @@ class OutputPage extends ContextSource {
}
// Hooks registered in the object
// Deprecated! See T292321; should be done in the OutputPageParserOutput
// hook instead.
$parserOutputHooks = $this->getConfig()->get( 'ParserOutputHooks' );
foreach ( $parserOutput->getOutputHooks() as $hookInfo ) {
list( $hookName, $data ) = $hookInfo;

View file

@ -784,6 +784,11 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
return $result;
}
/**
* @return array
* @deprecated since 1.38; should be done in the OutputPageParserOutput
* hook (T292321).
*/
public function getOutputHooks(): array {
return (array)$this->mOutputHooks;
}
@ -949,6 +954,12 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
$this->mWarnings[$s] = 1;
}
/**
* @param callable $hook
* @param mixed $data
* @deprecated since 1.38; should be done in the OutputPageParserOutput
* hook (T292321).
*/
public function addOutputHook( $hook, $data = false ): void {
$this->mOutputHooks[] = [ $hook, $data ];
}