MediaWiki  master
GlobalHookRegistry.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
11 class GlobalHookRegistry implements HookRegistry {
13  private $extensionRegistry;
15  private $deprecatedHooks;
16 
17  public function __construct(
18  ExtensionRegistry $extensionRegistry,
19  DeprecatedHooks $deprecatedHooks
20  ) {
21  $this->extensionRegistry = $extensionRegistry;
22  $this->deprecatedHooks = $deprecatedHooks;
23  }
24 
25  public function getGlobalHooks() {
26  global $wgHooks;
27  return $wgHooks;
28  }
29 
30  public function getExtensionHooks() {
31  return $this->extensionRegistry->getAttribute( 'Hooks' ) ?? [];
32  }
33 
34  public function getDeprecatedHooks() {
35  return $this->deprecatedHooks;
36  }
37 }
The Registry loads JSON files, and uses a Processor to extract information from them.
A HookRegistry which sources its data from dynamically changing sources: $wgHooks and an ExtensionReg...
getExtensionHooks()
Get the current contents of the Hooks attribute in the ExtensionRegistry.
__construct(ExtensionRegistry $extensionRegistry, DeprecatedHooks $deprecatedHooks)
getGlobalHooks()
Get the current contents of the $wgHooks variable or a mocked substitute.
$wgHooks
Config variable stub for the Hooks setting, for use by phpdoc and IDEs.