SkinTemplateOutputPageBeforeExec and BaseTemplateAfterPortlet will be deprecated as part of the existing work on Vector as Vector is dropping use of the BaseTemplate altogether.
The use case in Wikibase is a legitimate one, but is currently not done in an obvious way, which led to the recent regression in T252800.
Currently Wikidata uses these two hook for two things (see [[ https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/fafca1f24bfab9e7e0419f1d9a43503a66b5adb0/client/includes/Hooks/SkinTemplateOutputPageBeforeExecHandler.php#L52 | code reference]] )
# Add this link at the end of the languages portal:
# to enable the languages portal on pages which do not have any language links, however
Link:
{F31833383}
# Proposed solution
The link should be added using SkinAfterPortlet hook. This hook can do the work done by the two hooks. But note that for the second case, Wikibase will no longer force creation of the section. (It does so now by claiming there are languages, even though there are not).
The correct thing to do, and what Wikibase will do now is to just add ( the edit action string) to the 'lang' portlet, this will alerts skin to display the section, although ultimately it's upto skins to show it or not.