Deprecate SkinTemplateOutputPageBeforeExec hook

All Wikimedia production extensions are no longer using this hook. The
hook is very generic and very dangerous per ticket and I would like to
close up future usages while we still can.

Bug: T60137
Change-Id: I294a420763e4c5a06a6692339efd28614a17d3c0
This commit is contained in:
jdlrobson 2020-05-14 09:54:23 -07:00
parent 7ba77c21c8
commit 5e9604f429
5 changed files with 14 additions and 4 deletions

View file

@ -234,7 +234,7 @@ For notes on 1.34.x and older releases, see HISTORY.
to the <html> element on page load.
* The SkinAddFooterLinks hook is added to allow extensions to add items to skin
footers. Previously this had to be done via SkinTemplateOutputPageBeforeExec.
Doing so using that hook is now soft deprecated.
Doing so using that hook is now hard deprecated.
* A new BlockPermissionChecker service was introduced for checking
block-related permissions.
* …
@ -1255,6 +1255,10 @@ because of Phabricator reports.
that's extending QuickTemplate class. The hook associated with this method,
BaseTemplateToolbox, has been hard deprecated. To add items to the toolbox,
use SidebarBeforeOutput hook instead.
* The SkinTemplateOutputPageBeforeExec hook is deprecated.
The page [[mw:Manual:Hooks/SkinTemplateOutputPageBeforeExec]] and T60137
for recommendations for alternative approaches based on how developers
previously used this hook.
* SkinTemplateToolboxEnd hook has been deprecated. Use SidebarBeforeOutput hook
instead.
* Using Skin::addToBodyAttributes() method to add body attributes has been

View file

@ -3213,8 +3213,8 @@ after variants have been added.
&$links: Structured navigation links. This is used to alter the navigation for
skins which use buildNavigationUrls such as Vector.
'SkinTemplateOutputPageBeforeExec': Before SkinTemplate::outputPage() starts
page output.
'SkinTemplateOutputPageBeforeExec': DEPRECATED since 1.35.
Before SkinTemplate::outputPage() starts page output.
[&]$sktemplate: SkinTemplate object
[&]$tpl: QuickTemplate engine object

View file

@ -68,6 +68,7 @@ class DeprecatedHooks {
'SecondaryDataUpdates' => [ 'deprecatedVersion' => '1.32', 'silent' => true ],
'SpecialMuteSubmit' => [ 'deprecatedVersion' => '1.35', 'silent' => true ],
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' => [ 'deprecatedVersion' => '1.35' ],
'SkinTemplateOutputPageBeforeExec' => [ 'deprecatedVersion' => '1.35' ],
'SkinTemplatePreventOtherActiveTabs' => [ 'deprecatedVersion' => '1.35' ],
'SkinTemplateTabAction' => [ 'deprecatedVersion' => '1.35' ],
'SkinTemplateToolboxEnd' => [ 'deprecatedVersion' => '1.35' ],

View file

@ -6,7 +6,11 @@ use QuickTemplate;
use SkinTemplate;
/**
* @stable for implementation
* @deprecated since 1.35. See
* https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec
* for migration notes.
* @see https://phabricator.wikimedia.org/T60137 for details on the deprecation
*
* @ingroup Hooks
*/
interface SkinTemplateOutputPageBeforeExecHook {

View file

@ -443,6 +443,7 @@ class SkinTemplate extends Skin {
$tpl->set( 'reporttime', wfReportTime( $out->getCSP()->getNonce() ) );
// original version by hansm
// See T60137 for information on deprecation.
if ( !$this->getHookRunner()->onSkinTemplateOutputPageBeforeExec( $this, $tpl ) ) {
wfDebug( __METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!" );
}