Page MenuHomePhabricator

[EPIC] Deprecate SkinTemplateToolboxEnd hook in favor of SidebarBeforeOutput hook
Closed, ResolvedPublic

Description

The SkinTemplateToolboxEnd hook should be marked as deprecated given that the SidebarBeforeOutput hook has now been expanded to allow modification of the toolbox.

It is identified as a hack in the code:

// HACK: Compatibility with extensions still using SkinTemplateToolboxEnd
                $hookContents = null;
                if ( isset( $boxes['TOOLBOX'] ) ) {
                        ob_start();
                        // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox
                        // can abort and avoid outputting double toolbox links
                        // Avoid PHP 7.1 warning from passing $this by reference
                        $template = $this;
                        Hooks::run( 'SkinTemplateToolboxEnd', [ &$template, true ] );
                        $hookContents = ob_get_contents();
                        ob_end_clean();
                        if ( !trim( $hookContents ) ) {
                                $hookContents = null;
                        }
                }
                // END hack

Before we can mark this as deprecated we will have to patch the skins that are deployed into production to support the SidebarBeforeOutput hook

Acceptance criteria

[1] For modern and Monobook we'll need to remove:

		if ( !isset( $sidebar['TOOLBOX'] ) ) {
			$sidebar['TOOLBOX'] = true;
		}

[2] For Modern pass the data to its toolbox method rather than calling $this->getToolbox()

$this->toolbox( $content );

[3] For Monobook pass the data to the toolbox via $this->getToolboxBox rather than calling $this->getToolbox()

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 27 2020, 6:12 PM
Jdlrobson renamed this task from Deprecate SkinTemplateToolboxEnd hook in favor of SkinTemplateToolboxEnd to Deprecate SkinTemplateToolboxEnd hook in favor of SidebarBeforeOutput hook.May 27 2020, 6:13 PM
Jdlrobson updated the task description. (Show Details)May 27 2020, 6:22 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMay 27 2020, 6:22 PM
Jdlrobson updated the task description. (Show Details)May 27 2020, 6:40 PM
Jdlrobson renamed this task from Deprecate SkinTemplateToolboxEnd hook in favor of SidebarBeforeOutput hook to [EPIC] Deprecate SkinTemplateToolboxEnd hook in favor of SidebarBeforeOutput hook.May 28 2020, 9:00 PM
Jdlrobson updated the task description. (Show Details)

Change 601089 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/MonoBook@master] Monobook supports SidebarBeforeOutput hook

https://gerrit.wikimedia.org/r/601089

Change 601095 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/Modern@master] Modern: support SidebarBeforeOutput hook

https://gerrit.wikimedia.org/r/601095

Ammarpad claimed this task.Jun 1 2020, 1:04 AM

Change 601176 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/CologneBlue@master] Make CologneBlue work with SidebarBeforeOutPut hook

https://gerrit.wikimedia.org/r/601176

Jdlrobson updated the task description. (Show Details)Jun 1 2020, 7:07 PM

Change 601089 merged by jenkins-bot:
[mediawiki/skins/MonoBook@master] Monobook supports SidebarBeforeOutput hook

https://gerrit.wikimedia.org/r/601089

Ammarpad updated the task description. (Show Details)Jun 2 2020, 5:41 AM

Change 601095 merged by jenkins-bot:
[mediawiki/skins/Modern@master] Modern: support SidebarBeforeOutput hook

https://gerrit.wikimedia.org/r/601095

Change 601176 merged by jenkins-bot:
[mediawiki/skins/CologneBlue@master] Make CologneBlue work with SidebarBeforeOutPut hook

https://gerrit.wikimedia.org/r/601176

Jdlrobson updated the task description. (Show Details)Jun 2 2020, 10:33 PM

@Isarra would you be able to code review a patch for Timeless (or allow me to code review such a patch?) It should be a small one - swapping out a method for another method.

ashley added a subscriber: ashley.Jun 3 2020, 2:04 AM

SkinTemplateToolboxEnd is super legacy and basically all even remotely maintained code uses BaseTemplateToolbox instead. That being said, almost (if not) all skins implement SkinTemplateToolboxEnd currently, so we should remove that technical debt from all other skins as well while at it.

@Isarra would you be able to code review a patch for Timeless (or allow me to code review such a patch?) It should be a small one - swapping out a method for another method.

Patches are always welcome, and I'm sure the same is true for code review as well, especially since you have experience with skins. :) And given that unlike some things*cough* Social-Tools *cough* Timeless operates on a more normal development model (e.g. master targets master version of MW core, REL1_34 for MW 1.34, etc.), so making breaking changes is not that big of a deal either.

Jdlrobson updated the task description. (Show Details)Jun 4 2020, 12:50 AM

Change 602760 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/Modern@master] Modern: Drop SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/602760

Change 602762 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/MonoBook@master] MonoBook: Drop SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/602762

Jdlrobson triaged this task as Medium priority.Jun 5 2020, 8:49 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)

Change 602760 merged by jenkins-bot:
[mediawiki/skins/Modern@master] Modern: Drop SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/602760

Change 602762 merged by jenkins-bot:
[mediawiki/skins/MonoBook@master] MonoBook: Drop SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/602762

Jdlrobson updated the task description. (Show Details)Jun 11 2020, 11:00 PM

Change 605311 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/Vector@master] Vector: Drop support for SkinTemplateToolboxEnd

https://gerrit.wikimedia.org/r/605311

Change 605316 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/MonoBook@master] Drop MonoBookTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/605316

Change 605317 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/Modern@master] Modern: Drop MonoBookTemplateToolboxEnd

https://gerrit.wikimedia.org/r/605317

Change 605311 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Vector: Drop support for SkinTemplateToolboxEnd

https://gerrit.wikimedia.org/r/605311

Change 605317 merged by jenkins-bot:
[mediawiki/skins/Modern@master] Modern: Drop MonoBookTemplateToolboxEnd

https://gerrit.wikimedia.org/r/605317

Change 605316 merged by jenkins-bot:
[mediawiki/skins/MonoBook@master] Drop MonoBookTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/605316

Jdlrobson updated the task description. (Show Details)Jun 12 2020, 9:23 PM
Jdlrobson updated the task description. (Show Details)Jun 12 2020, 9:41 PM
Jdlrobson raised the priority of this task from Medium to High.Jun 13 2020, 3:49 PM
Jdlrobson updated the task description. (Show Details)

One last remaining task - we need to mark the SkinTemplateToolboxEnd hook as deprecated and resolve this task.

Change 605697 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Hard deprecated SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/605697

Change 605697 merged by jenkins-bot:
[mediawiki/core@master] Deprecate SkinTemplateToolboxEnd hook

https://gerrit.wikimedia.org/r/605697

Jdlrobson closed this task as Resolved.Jun 15 2020, 11:51 PM
Jdlrobson updated the task description. (Show Details)