HomePhabricator

Hook Container

Description

Hook Container

New classes and modificatons to existing classes to support the new Hooks system. All changes are documented in RFC https://phabricator.wikimedia.org/T240307.

  • HookContainer.php: Class for doing much of what Hooks.php has historically done, but enabling new-style hooks to be processed and registered. Changes include new ways of defining hook handler functions as an object with defined dependencies in extension.json, removing runWithoutAbort() and addit it to an $options parameter to be passed to HookContainer::run(), being able to decipher whether a hook handler is legacy or non-legacy style and run them in the appropriate way, etc.
  • DeprecatedHooks.php: For marking hooks deprecated and verifying if one is deprecated
  • DeprecatedHooksTest.php: Unit tests for DeprecatedHooks.php
  • Hooks.php: register() will now additionally register hooks with handlers in new HooksContainer.php. getHandlers() will be a legacy wrapper for calling the newer HookContainer::getHandlers()
  • MediaWikiServices.php: Added getHookContainer() for retrieving HookContainer singleton
  • ExtensionProcessor.php: modified extractHooks() to be able to extract new style handler objects being registered in extension.json
  • ServiceWiring.php: Added HookContainer to list of services to return
  • HookContainerTest.php: Unit tests for HookContainer.php
  • ExtensionProcessorTest.php: Moved file out of /unit folder and now extends MediaWikiTestCase instead of MediaWikiUnitTestCase (as the tests are not truly unit tests). Modified existing tests for ExtensionProcessor::extractHooks() to include a test case for new style handler

Bug: T240307
Change-Id: I432861d8995cfd7180e77e115251d8055b7eceec

Details

Provenance
nnikkhouiAuthored on Feb 10 2020, 2:47 PM
tstarlingCommitted on Apr 17 2020, 5:48 AM
Parents
rMW99a84628f422: Merge "Hard deprecate Parser::OutputType and Parser::Options"
Branches
Unknown
Tags
Unknown
ChangeId
I432861d8995cfd7180e77e115251d8055b7eceec