diff --git a/RELEASE-NOTES-1.38 b/RELEASE-NOTES-1.38 index 47187e8aa6e..2d0fa91ebda 100644 --- a/RELEASE-NOTES-1.38 +++ b/RELEASE-NOTES-1.38 @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a32766588ac..ac3cd106f0e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 = []; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index f55b520270c..7a506e9d559 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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; diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index d46080f1059..a1a536cedb1 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -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 ]; }