Manual:Hooks/BeforeInitialize

From MediaWiki.org
Jump to navigation Jump to search
BeforeInitialize
Available from version 1.16.0
Occurs before anything is initialized in MediaWiki::performRequest().
Define function:
public static function onBeforeInitialize( \Title &$title, $unused = null, \OutputPage $output, \User $user, \WebRequest $request, \MediaWiki $mediaWiki ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"BeforeInitialize": "MyExtensionHooks::onBeforeInitialize"
	}
}

For MediaWiki ≤1.25:

$wgHooks['BeforeInitialize'][] = 'MyExtensionHooks::onBeforeInitialize';
Called from:File(s): MediaWiki.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:BeforeInitialize extensions.

Details[edit]

  • &$title: Title being used for request
  • $unused: Always null. Historically an Article object to be passed back, or null. Unused since 2011.
  • $output: OutputPage object.
  • $user: User object
  • $request: WebRequest object
  • $mediaWiki: Current MediaWiki instance calling this hook handler.

See also[edit]