MediaWiki REL1_37
MediaWiki\HookContainer\StaticHookRegistry Class Reference

This is a simple immutable HookRegistry which can be used to set up a local HookContainer in tests and for similar purposes. More...

Inheritance diagram for MediaWiki\HookContainer\StaticHookRegistry:
Collaboration diagram for MediaWiki\HookContainer\StaticHookRegistry:

Public Member Functions

 __construct (array $globalHooks=[], array $extensionHooks=[], array $deprecatedHooksArray=[])
 
 getDeprecatedHooks ()
 
 getExtensionHooks ()
 Get the current contents of the Hooks attribute in the ExtensionRegistry.
 
 getGlobalHooks ()
 Get the current contents of the $wgHooks variable or a mocked substitute.
 

Private Attributes

DeprecatedHooks $deprecatedHooks
 
array $extensionHooks
 
array $globalHooks
 

Detailed Description

This is a simple immutable HookRegistry which can be used to set up a local HookContainer in tests and for similar purposes.

Definition at line 9 of file StaticHookRegistry.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\HookContainer\StaticHookRegistry::__construct ( array  $globalHooks = [],
array  $extensionHooks = [],
array  $deprecatedHooksArray = [] 
)
Parameters
array$globalHooksAn array of legacy hooks in the same format as $wgHooks
array$extensionHooksAn array of modern hooks in the format described in HookRegistry::getExtensionHooks()
array$deprecatedHooksArrayAn array of deprecated hooks in the format expected by DeprecatedHooks::__construct(). These hooks are added to the core deprecated hooks list which is always present.

Definition at line 27 of file StaticHookRegistry.php.

References MediaWiki\HookContainer\StaticHookRegistry\$extensionHooks, and MediaWiki\HookContainer\StaticHookRegistry\$globalHooks.

Member Function Documentation

◆ getDeprecatedHooks()

MediaWiki\HookContainer\StaticHookRegistry::getDeprecatedHooks ( )
Returns
DeprecatedHooks

Implements MediaWiki\HookContainer\HookRegistry.

Definition at line 48 of file StaticHookRegistry.php.

References MediaWiki\HookContainer\StaticHookRegistry\$deprecatedHooks.

◆ getExtensionHooks()

MediaWiki\HookContainer\StaticHookRegistry::getExtensionHooks ( )

Get the current contents of the Hooks attribute in the ExtensionRegistry.

The contents is extended and normalized from the value of the corresponding attribute in extension.json. It does not contain "legacy" handlers, those are extracted into $wgHooks.

It is a three dimensional array:

  • The outer level is an array of hooks keyed by hook name.
  • The second level is an array of handlers, with integer indexes.
  • The third level is an associative array with the following members:
    • handler: An ObjectFactory spec, except that it also has an element "name" which is a unique string identifying the handler, for the purposes of sharing handler instances.
    • deprecated: A boolean value indicating whether the extension is acknowledging deprecation of the hook, to activate call filtering.
    • extensionPath: The path to the extension.json file in which the handler was defined. This is only used for deprecation messages.
Returns
array

Implements MediaWiki\HookContainer\HookRegistry.

Definition at line 41 of file StaticHookRegistry.php.

References MediaWiki\HookContainer\StaticHookRegistry\$extensionHooks.

◆ getGlobalHooks()

MediaWiki\HookContainer\StaticHookRegistry::getGlobalHooks ( )

Get the current contents of the $wgHooks variable or a mocked substitute.

Returns
array

Implements MediaWiki\HookContainer\HookRegistry.

Definition at line 37 of file StaticHookRegistry.php.

References MediaWiki\HookContainer\StaticHookRegistry\$globalHooks.

Member Data Documentation

◆ $deprecatedHooks

DeprecatedHooks MediaWiki\HookContainer\StaticHookRegistry::$deprecatedHooks
private

◆ $extensionHooks

array MediaWiki\HookContainer\StaticHookRegistry::$extensionHooks
private

◆ $globalHooks

array MediaWiki\HookContainer\StaticHookRegistry::$globalHooks
private

The documentation for this class was generated from the following file: