Manual:Hooks

From MediaWiki.org
Jump to: navigation, search
Gnome-preferences-other.svg Extensions: Development Tag Extensions Parser Functions Hooks Special Pages Skins Magic Words API
MediaWiki extensions

Hooks allow custom code to be executed when some defined event (such as saving a page or a user logging in) occurs. For example, the following code snippet will trigger a call to the function MyExtensionHooks::pageContentSaveComplete whenever the PageContentSaveComplete hook runs, passing it function arguments specific to PageContentSaveComplete:

$wgHooks['PageContentSaveComplete'][] = 'MyExtensionHooks::pageContentSaveComplete';

MediaWiki provides many hooks like this to extend the functionality of the MediaWiki software. Assigning a function (known as an event handler) to a hook will cause that function to be called at the appropriate point in the main MediaWiki code, to perform whatever additional task(s) the developer thinks would be useful at that point. Each hook can have multiple handlers assigned to it, in which case it will call the functions in the order that they are assigned, with any modifications made by one function passed on to subsequent functions in the chain.

Assign functions to hooks at the end of LocalSettings.php or in your own extension file at the file scope (not in a $wgExtensionFunctions function or the ParserFirstCallInit hook). For extensions, if the hook function's behavior is conditioned on a setting in LocalSettings.php, the hook should be assigned and the function should terminate early if the condition was not met.

You can also create new hooks in your own extension; if you do so, add them to the Extension hook registry.

Background[edit | edit source]

A hook is triggered by a call to the function wfRunHooks (described in file hooks.txt, and defined in GlobalFunctions.php), which in turn calls Hooks::Run(). The first argument to wfRunHooks is the name of the hook, the second is the array of arguments for that hook. Function wfRunHooks finds the event handlers to run in the array $wgHooks. It calls the PHP function call_user_func_array with arguments being the function to be called and its arguments.

See also the hook specification in core.

In this example from the doEditContent function in WikiPage.php, doEditContent calls wfRunHooks to run the PageContentSaveComplete hook, passing $hook_args as argument:

	wfRunHooks( 'PageContentSaveComplete', $hook_args );

The core calls many hooks, but extensions can also call hooks.

Writing an event handler[edit | edit source]

An event handler is a function you assign to a hook, which will be run whenever the event represented by that hook occurs. It consists of:

  • a function with some optional accompanying data, or
  • an object with a method and some optional accompanying data.

Register the event handler by adding it to the global $wgHooks array for a given event. Hooks can be added from any point in the execution before the hook is called, but are most commonly added in LocalSettings.php or its included files. All the following are valid ways to define a hook function for the event EventName that is passed two parameters, showing the code that will be executed when EventName happens:

Format Syntax Resulting function call.
Function, no data $wgHooks['EventName'][] = 'someFunction'; someFunction( $param1, $param2 );
Function with data $wgHooks['EventName'][] = array( 'someFunction', $someData ); someFunction( $someData, $param1, $param2 );
Function, no data
(weird syntax, but OK)
$wgHooks['EventName'][] = array( 'someFunction' ); someFunction( $param1, $param2 );
inline anonymous function $wgHooks['EventName'][] = function( $param1, $param2 ) {
  ... function body
};
(the anonymous function is called with the hook's parameters)
Object only $wgHooks['EventName'][] = $object; $object->onEventName( $param1, $param2 );
Object with method $wgHooks['EventName'][] = array( $object, 'someMethod' ); $object->someMethod( $param1, $param2 );
Object with method and data $wgHooks['EventName'][] = array( $object, 'someMethod', $someData ); $object->someMethod( $someData, $param1, $param2 );
Object only
(weird syntax, but OK)
$wgHooks['EventName'][] = array( $object ); $object->onEventName( $param1, $param2 );

When an event occurs, the function (or object method) that you registered will be called the event's parameters along with any optional data you provided at registration. Note that when an object is the hook and you didn't specify a method, the method called is 'onEventName'. For other events this would be 'onArticleSave', 'onUserLogin', etc.

The optional data is useful if you want to use the same function or object for different purposes. For example:

$wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'TimStarling' );
$wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'brion' );

This code would result in ircNotify being run twice when a page is saved: once for 'TimStarling', and once for 'brion'.

Event handlers can return one of three possible values:

  • true: the hook has operated successfully
  • "some string": an error occurred; processing should stop and the error should be shown to the user
  • false: the hook has successfully done the work necessary and the calling function should skip
In many cases where an error message is expected, the hook will define a variable passed as a reference for extensions to store an error message and this is preferred over returning a string that will simply be displayed as an "internal error." In some cases hooks are only provided as a convenient way for extensions to read or modify data (e.g. EditPageBeforeEditButtons) and there is little difference between returning true and false. (Returning false causes any remaining functions assigned to the same hook to not run. However, hooks are added in the order extensions are run in LocalSettings, so relying on this for interactions between extensions can lead to inconsistent results.)


The last result would be for cases where the hook function replaces the main functionality. For example, if you wanted to authenticate users to a custom system (LDAP, another PHP program, whatever), you could do:

$wgHooks['UserLogin'][] = array( 'ldapLogin', $ldapServer );
 
$ldap['server'] = "ldaps://ldap.company.com/";
$ldap['port'] = 636;
$ldap['base'] = ",ou=Staff,dc=company,dc=com";
 
function ldapLogin( $username, $password ) {
	global $ldap;
	$auth_user = "uid=" . $username . $ldap[ 'base' ];
	wfSupressWarnings();
	if ( $connect = ldap_connect( $ldap[ 'server' ], $ldap[ 'port' ] ) ){
		if ( $bind = ldap_bind( $connect, $auth_user, $password ) ){
			ldap_close( $connect );
			return true;
		} else { // if bound to ldap
			echo 'Error on ldap_bind';
		}
	} else { // if connected to ldap
		echo 'Error on ldap_connect';
	}
	ldap_close( $connect );
	wfRestoreWarnings();
	return false;
}

Returning false makes less sense for events where the action is complete, and will normally be ignored.

Documentation[edit | edit source]

Currently, hooks in MediaWiki core have to be documented both in docs/hooks.txt (in the source code repository) and here on MediaWiki.org. In some cases, one of these steps may not yet have been completed, so if a hook appears undocumented, check both.

To document a hook on-wiki, use {{MediaWikiHook}}.

Available hooks[edit | edit source]

This page contains a list of hooks that are made available by the MediaWiki software, and is known to be complete to version 1.8.2. There is a lot of detail missing for the more recent hooks in particular, as their purpose/usage has not yet been documented by the developers. If you have any further information on any of these then please add it in the appropriate place.

In the tables, the first column gives the MediaWiki version that the hook was introduced in; use the link in the second column to find out more information about the hook and how to use it.

For a complete list of hooks, use the category, which should be kept more up to date

Hooks grouped by function[edit | edit source]

Some of these hooks can be grouped into multiple functions.

Sections: Article Management - Edit Page - Page Rendering - User Interface - Special Pages - User Management - Logging - Skinning Templates - API - Miscellaneous
Function Version Hook Description
Article Management 1.4.0 ArticleDelete Occurs whenever the software receives a request to delete an article
1.4.0 ArticleDeleteComplete Occurs after the delete article request has been processed
1.9.1 ArticleUndelete When one or more revisions of an article are restored
1.12.0 ArticleRevisionUndeleted Occurs after an article revision is restored
1.8.0 ArticleFromTitle Called to determine the class to handle the article rendering, based on title
1.4.0 ArticleProtect Occurs whenever the software receives a request to protect an article
1.4.0 ArticleProtectComplete Occurs after the protect article request has been processed
1.6.0 ArticleInsertComplete Occurs after a new article has been created
1.11.0 RevisionInsertComplete Called after a revision is inserted into the DB
1.4.0 ArticleSave (Deprecated; use PageContentSave) Occurs whenever the software receives a request to save an article
1.21.0 PageContentSave Occurs whenever the software receives a request to save an article
1.4.0 ArticleSaveComplete (deprecated; use PageContentSaveComplete) Occurs after the save article request has been processed
1.21.0 PageContentSaveComplete Occurs after the save article request has been processed
1.11.0 ArticleUpdateBeforeRedirect Occurs after a page is updated (usually on save), before the user is redirected back to the page
1.5.7 ArticleEditUpdateNewTalk Allows an extension to prevent user notification when a new message is added to their talk page.
1.14.0 ArticleEditUpdates Called when edit updates (mainly link tracking) are made when an article has been changed.
1.6.0 ArticleEditUpdatesDeleteFromRecentchanges Occurs before saving to the database. If returning false old entries are not deleted from the recentchangeslist.
1.8.0 RecentChange_save Called after a "Recent Change" is committed to the DB
1.6.0 SpecialMovepageAfterMove Called after a page is moved.
1.22.0 TitleMove Occurs before a requested pagemove is performed
1.4.0 TitleMoveComplete Occurs whenever a request to move an article is completed
1.12.0 AbortMove Allows to abort moving page from one title to another
1.12.0 ArticleRollbackComplete Occurs after an article rollback is completed
1.12.0 ArticleMergeComplete after merging to article using Special:Mergehistory
1.6.0 ArticlePurge Allows an extension to cancel a purge.
1.13.0 ArticleRevisionVisibilitySet called when changing visibility of one or more revisions of an article
1.21.0 ContentHandlerDefaultModelFor called when deciding the default content model for a given title.
1.23.0 Article::MissingArticleConditions called when showing a page.
Edit Page 1.6.0 AlternateEdit Used to replace the entire edit page, altogether.
1.21.0 AlternateEditPreview Allows replacement of the edit preview
1.6.0 EditFilter Perform checks on an edit
1.12.0 EditFilterMerged Perform checks on an edit
1.7.0 EditFormPreloadText Called when edit page for a new article is shown. This lets you fill the text-box of a new page with initial wikitext.
1.8.3 EditPage::attemptSave Called before an article is saved, that is before insertNewArticle() is called
1.6.0 EditPage::showEditForm:fields Allows injection of form field into edit form.
1.6.0 EditPage::showEditForm:initial Allows injection of HTML into edit form
1.21.0 EditPage::showStandardInputs:options Allows injection of form fields into the editOptions area
1.13.0 EditPageBeforeConflictDiff Allows modifying the EditPage object and output when there's an edit conflict.
1.12.0 EditPageBeforeEditButtons Used to modify the edit buttons on the edit form
1.14.0 EditPageBeforeEditChecks Allows modifying the edit checks below the textarea in the edit form
Page Rendering 1.6.0 ArticlePageDataBefore Executes before data is loaded for the article requested.
1.6.0 ArticlePageDataAfter Executes after loading the data of an article from the database.
1.6.0 ArticleViewHeader Called after an articleheader is shown.
1.6.0 PageRenderingHash Alter the parser cache option hash key.
1.6.0 ArticleAfterFetchContent Used to process raw wiki code after most of the other parser processing is complete.
1.6.0 ParserClearState Called at the end of Parser::clearState()
1.21.0 ParserCloned Called when the Parser object is cloned.
1.5.0 ParserBeforeStrip Used to process the raw wiki code before any internal processing is applied.
1.5.0 ParserAfterStrip (Deprecated) Before version 1.14.0, used to process raw wiki code after text surrounded by <nowiki> tags have been protected but before any other wiki text has been processed. In version 1.14.0 and later, runs immediately after ParserBeforeStrip.
1.6.0 ParserBeforeInternalParse Replaces the normal processing of stripped wiki text with custom processing. Used primarily to support alternatives (rather than additions) to the core MediaWiki markup syntax.
1.6.0 ParserGetVariableValueVarCache Use this to change the value of the variable cache or return false to not use it.
1.6.0 ParserGetVariableValueTs Use this to change the value of the time for the {{LOCAL...}} magic word.
1.6.0 ParserGetVariableValueSwitch Assigns a value to a user defined variable.
1.10.0 InternalParseBeforeLinks Used to process the expanded wiki code after <nowiki>, HTML-comments, and templates have been treated. Suitable for syntax extensions that want to customize the treatment of internal link syntax, i.e. [[....]].
1.13.0 LinkerMakeExternalLink Called before the HTML for external links is returned. Used for modifying external link HTML.
1.13.0 LinkerMakeExternalImage Called before external image HTML is returned. Used for modifying external image HTML.
1.23.0 LinkerMakeMediaLinkFile Called before the HTML for media links is returned. Used for modifying media link HTML.
1.11.0 EditSectionLink (Deprecated) Override the return value of Linker::editSectionLink(). Called after creating [edit] link in header in Linker::editSectionLink but before HTML is displayed.
1.11.0 EditSectionLinkForOther (Deprecated) Override the return value of Linker::editSectionLinkForOther(). Called after creating [edit] link in header in Linker::editSectionLinkForOther but before HTML is displayed.
1.5.0 ParserBeforeTidy Used to process the nearly-rendered html code for the page (but before any html tidying occurs).
1.5.0 ParserAfterTidy Used to add some final processing to the fully-rendered page output.
1.24.0 ContentGetParserOutput Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content.
1.8.0 OutputPageParserOutput Called after parse, before the HTML is added to the output.
1.6.0 OutputPageBeforeHTML Called every time wikitext is added to the OutputPage, after it is parsed but before it is added. Called after the page has been rendered, but before the HTML is displayed.
1.4.3 CategoryPageView Called before viewing a categorypage in CategoryPage::view
1.5.1 ArticleViewRedirect Allows an extension to prevent the display of a "Redirected From" link on a redirect page.
1.10.0 IsFileCacheable Allow an extension to disable file caching on pages.
1.10.1 BeforeParserFetchTemplateAndtitle Allows an extension to specify a version of a page to get for inclusion in a template.
1.18.0 BeforeParserFetchFileAndTitle Allows an extension to select a different version of an image to link to.
1.10.1 BeforeParserrenderImageGallery Allows an extension to modify an image gallery before it is rendered.
1.17.0 ResourceLoaderRegisterModules Allows registering modules with ResourceLoader
User Interface 1.5.4 AutoAuthenticate Called to authenticate users on external/environmental means
1.4.0 UserLoginComplete Occurs after a user has successfully logged in
1.18.0 BeforeWelcomeCreation Allows an extension to change the message displayed upon a successful login.
1.4.0 UserLogout Occurs when the software receives a request to log out
1.4.0 UserLogoutComplete Occurs after a user has successfully logged out
1.6.0 userCan To interrupt/advise the "user can do X to Y article" check
1.4.0 WatchArticle Occurs whenever the software receives a request to watch an article
1.4.0 WatchArticleComplete Occurs after the watch article request has been processed
1.4.0 UnwatchArticle Occurs whenever the software receives a request to unwatch an article
1.4.0 UnwatchArticleComplete Occurs after the unwatch article request has been processed
1.6.0 MarkPatrolled Called before an edit is marked patrolled
1.6.0 MarkPatrolledComplete Called after an edit is marked patrolled
1.4.0 EmailUser Occurs whenever the software receives a request to send an email from one user to another
1.4.0 EmailUserComplete Occurs after an email has been sent from one user to another
1.6.0 SpecialMovepageAfterMove Called after a page is moved.
1.19.0 SpecialSearchCreateLink Called when making the message to create a page or go to an existing page
1.17.0 SpecialSearchGo
1.6.0 SpecialSearchNogomatch
1.19.0 SpecialSearchPowerBox the equivalent of SpecialSearchProfileForm for the advanced form
1.5.7 ArticleEditUpdateNewTalk
1.5.7 UserRetrieveNewTalks
1.5.7 UserClearNewTalkNotification
1.6.0 ArticlePurge
File Upload 1.6.0 UploadVerification Called when a file is uploaded, to allow extra file verification to take place (deprecated)
1.17 UploadVerifyFile Called when a file is uploaded, to allow extra file verification to take place (preferred)
1.6.4 UploadComplete Called when a file upload has completed.
Special pages 1.6.0 SpecialPageGetRedirect
1.13.0 SpecialListusersDefaultQuery Called right before the end of UsersPager::getDefaultQuery()
1.13.0 SpecialListusersFormatRow Called right before the end of UsersPager::formatRow()
1.13.0 SpecialListusersHeader Called before closing the <fieldset> in UsersPager::getPageHeader()
1.13.0 SpecialListusersHeaderForm Called before adding the submit button in UsersPager::getPageHeader()
1.13.0 SpecialListusersQueryInfo Called right before the end of UsersPager::getQueryInfo()
1.6.0 SpecialPageExecuteBeforeHeader
1.6.0 SpecialPageExecuteBeforePage
1.6.0 SpecialPageExecuteAfterPage
1.6.0 SpecialVersionExtensionTypes
SpecialPage_initList Called after the Special Page list is populated
1.9.0 UploadForm:initial Called just before the upload form is generated
1.9.0 UploadForm:BeforeProcessing Called just before the file data (for example description) are processed, so extensions have a chance to manipulate them.
1.14.0 UserrightsChangeableGroups Called after the list of groups that can be manipulated via Special:UserRights is populated, but before it is returned.
User Management 1.5.0 AddNewAccount Called after a user account is created
1.5.8 AbortNewAccount Can be used to cancel user account creation
1.4.0 BlockIp Occurs whenever the software receives a request to block an IP address or user
1.4.0 BlockIpComplete Occurs after the request to block an IP or user has been processed
1.6.0 UserRights Called after a user's group memberships are changed
1.6.0 GetBlockedStatus Fired after the user's getBlockStatus is set
Logging 1.6.0 LogPageActionText
1.5.0 LogPageLogHeader
1.5.0 LogPageLogName
1.5.0 LogPageValidTypes
Skinning / Templates 1.7.0 BeforePageDisplay Allows last minute changes to the output page, e.g. adding of CSS or Javascript by extensions.
1.6.0 MonoBookTemplateToolboxEnd Called by Monobook skin after toolbox links have been rendered (useful for adding more)
1.7.0 PersonalUrls (SkinTemplate.php) Called after the list of personal URLs (links at the top in Monobook) has been populated.
1.24.0 PostLoginRedirect (SpecialUserlogin.php) Modify the post login redirect behavior.
1.23.0 BaseTemplateAfterPortlet (SkinTemplate.php) After rendering of portlets.
1.11.0 SkinAfterBottomScripts (Skin.php) At the end of Skin::bottomScripts()
1.12.0 SkinSubPageSubtitle (Skin.php) Called before the list of subpage links on top of a subpage is generated
1.5.0 SkinTemplateContentActions Called after the default tab list is populated (list is context dependent i.e. "normal" article or "special page").
1.16.0 SkinTemplateNavigation Called on content pages only after tabs have been added, but before variants have been added. See the other two SkinTemplateNavigation hooks for other points tabs can be modified at.
1.18.0 SkinTemplateNavigation::Universal Called on both content and special pages after variants have been added
1.18.0 SkinTemplateNavigation::SpecialPage Called on special pages after the special tab is added but before variants have been added
1.6.0 SkinTemplatePreventOtherActiveTabs Called to enable/disable the inclusion of additional tabs to the skin.
1.6.0 SkinTemplateSetupPageCss
1.6.0 SkinTemplateBuildContentActionUrlsAfterSpecialPage
1.6.0 SkinTemplateBuildNavUrlsNav_urlsAfterPermalink Called after the permalink has been entered in navigation URL array.
1.23.0 SkinTemplateGetLanguageLink Called after building the data for a language link from which the actual html is constructed.
1.6.0 UserCreateForm Allows for last minute updates to the UserCreateForm (SpecialUserlogin.php).
1.6.0 UserLoginForm Allows for last minute updates to the UserLoginForm (SpecialUserlogin.php).
API 1.23.0 ApiBeforeMain Called before ApiMain is executed
1.13.0 APIEditBeforeSave Called right before saving an edit submitted through api.php?action=edit
1.13.0 APIQueryInfoTokens Use this hook to add custom tokens to prop=info
1.13.0 APIQueryRevisionsTokens Use this hook to add custom tokens to prop=revisions
1.14.0 APIQueryRecentChangesTokens Use this hook to add custom tokens to list=recentchanges
1.14.0 APIGetAllowedParams Use this hook to modify a module's parameters
1.14.0 APIGetParamDescription Use this hook to modify a module's parameter descriptions
1.14.0 APIAfterExecute Use this hook to extend core API modules
1.14.0 APIQueryAfterExecute Use this hook to extend core API query modules
1.14.0 APIQueryGeneratorAfterExecute Use this hook to extend core API query modules
1.23.0 GetExtendedMetadata Allows including additional file metadata information in the imageinfo API.
Miscellaneous 1.6.0 ArticleEditUpdatesDeleteFromRecentchanges
1.19.0 Collation::factory Allows extensions to register new collation names, to be used with $wgCategoryCollation
1.18.0 GetDefaultSortkey Allows to override what the default sortkey is, which is used to order pages in a category.
1.6.0 GetInternalURL Used to modify fully-qualified URLs (useful for squid cache purging)
1.6.0 GetLocalURL Used to modify local URLs as output into page links
1.6.0 GetFullURL Used to modify fully-qualified URLs used in redirects/export/offsite data
1.16.0 ImgAuthBeforeStream Executed before file is streamed to user, but only when using img_auth
1.14.0 LinkBegin Used when generating internal and interwiki links in Linker::link()
1.14.0 LinkEnd Used when generating internal and interwiki links in Linker::link(), just before the function returns a value.
1.6.0 MagicWordMagicWords
1.6.0 MagicWordwgVariableIDs
1.5.7 MessagesPreLoad Occurs when loading a message from the database
1.6.0 ParserTestParser
1.5.0 SpecialContributionsBeforeMainOutput
1.12.0 MediaWikiPerformAction Override MediaWiki::performAction()
1.4.0 UnknownAction Used to add new query-string actions
1.6.0 wgQueryPages
1.8.0 DisplayOldSubtitle
1.8.0 LoadAllMessages
1.8.0 RecentChange_save Called after a "Recent Change" is committed to the DB
1.8.0 UserToggles (Deprecated) Called before returning user preference names. Use the GetPreferences hook instead.

Alphabetical list of hooks[edit | edit source]

Version Hook Called From Description
1.181.18.0 AbortAutoAccount SpecialUserlogin.php Allow to cancel automated local account creation, where normally authentication against an external auth plugin would be creating a local account.
1.130 1.13.0 AbortAutoblock Block.php Allow extension to cancel an autoblock
1.140 1.14.0 AbortDiffCache DifferenceEngine.php Can be used to cancel the caching of a diff
1.200 1.20.0 AbortEmailNotification RecentChange.php Can be used to cancel email notifications for an edit
1.100 1.10.0 AbortLogin SpecialUserlogin.php Allows an extension like a captcha to abort the login process
1.1201.12.0 AbortMove Title.php, SpecialMovepage.php Can be used to cancel page movement
1.0581.5.8 AbortNewAccount SpecialUserlogin.php Can be used to cancel user account creation
1.1801.18.0 ActionBeforeFormDisplay Action.php Before executing the HTMLForm object
1.1801.18.0 ActionModifyFormFields Action.php Before creating an HTMLForm object for a page action
1.0501.5.0 AddNewAccount SpecialUserlogin.php Called after a user account is created
1.2001.20.0 AfterFinalPageOutput OutputPage.php Nearly at the end of OutputPage::output().
1.1701.17.0 AfterImportPage ImportXMLReader.php When a page import is completed
1.1701.17.0 AfterUserMessage User.php After a user message has been left
1.0911.9.1 AjaxAddScript OutputPage.php Called in output page just before the initialisation
1.0601.6.0 AlternateEdit EditPage.php Occurs whenever action=edit is called
1.2101.21.0 AlternateEditPreview EditPage.php Allows replacement of the edit preview
1.1801.18.0 AlternateUserMailer UserMailer.php Called before mail is sent so that mail could be logged (or something else) instead of using PEAR or PHP's mail().
1.1401.14.0 APIAfterExecute ApiMain.php Use this hook to extend core API modules
1.2301.23.0 ApiBeforeMain api.php Called before ApiMain is executed
1.2001.20.0 ApiCheckCanExecute ApiMain.php Called during ApiMain::checkCanExecute().
1.1301.13.0 APIEditBeforeSave ApiEditPage.php Called right before saving an edit submitted through api.php?action=edit
1.1401.14.0 APIGetAllowedParams ApiBase.php Use this hook to modify a module's parameters
1.1901.19.0 APIGetDescription ApiBase.php Use this hook to modify a module's descriptions
1.1401.14.0 APIGetParamDescription ApiBase.php Use this hook to modify a module's parameter descriptions
1.2001.20.0 APIGetResultProperties ApiBase.php Use this hook to modify the properties in a module's result.
1.2001.20.0 ApiMain::onException ApiMain.php Called by ApiMain::executeActionWithErrorHandling() when an exception is thrown during API action execution.
1.2001.20.0 ApiTokensGetTokenTypes ApiTokens.php Use this hook to extend action=tokens with new token types
1.1401.14.0 APIQueryAfterExecute ApiQuery.php Use this hook to extend core API query modules
1.1401.14.0 APIQueryGeneratorAfterExecute ApiQuery.php Use this hook to extend core API query modules
1.1301.13.0 APIQueryInfoTokens ApiQueryInfo.php Use this hook to add custom tokens to prop=info.
1.1401.14.0 APIQueryRecentChangesTokens ApiQueryRecentChanges.php Use this hook to add custom tokens to list=recentchanges.
1.1301.13.0 APIQueryRevisionsTokens ApiQueryRevisions.php Use this hook to add custom tokens to prop=revisions.
1.1501.15.0 APIQueryUsersTokens ApiQueryUsers.php Use this hook to add custom tokens to list=users.
1.1701.17.0 ApiRsdServiceApis ApiRsd.php Add or remove APIs from the RSD services list.
1.2301.23.0 Article::MissingArticleConditions Article.php Called when an article is shown.
1.0601.6.0 ArticleAfterFetchContent Article.php Used to process raw wiki code after most of the other parser processing is complete.
1.1601.16.0 ArticleConfirmDelete Article.php Occurs before writing the confirmation form for article deletion.
1.1701.17.0 ArticleContentOnDiff DifferenceEngine.php Before showing the article content below a diff.
1.0401.4.0 ArticleDelete Article.php Occurs whenever the software receives a request to delete an article
1.0401.4.0 ArticleDeleteComplete Article.php Occurs after the delete article request has been processed
1.0571.5.7 ArticleEditUpdateNewTalk Article.php Allows an extension to prevent user notification when a new message is added to their talk page.
1.1401.14.0 ArticleEditUpdates Article.php Called when edit updates (mainly link tracking) are made when an article has been changed.
1.0601.6.0 ArticleEditUpdatesDeleteFromRecentchanges Article.php Occurs before saving to the database. If returning false old entries are not deleted from the recentchangeslist.
1.0801.8.0 ArticleFromTitle Wiki.php Called to determine the class to handle the article rendering, based on title.
1.0601.6.0 ArticleInsertComplete Article.php Called after an article is created
1.1201.12.0 ArticleMergeComplete SpecialMergeHistory.php after merging to article using Special:Mergehistory
1.0601.6.0 ArticlePageDataAfter Article.php after loading data of an article from the database
1.0601.6.0 ArticlePageDataBefore Article.php before loading data of an article from the database
1.1801.18.0 ArticlePrepareTextForEdit Article.php Called when preparing text to be saved.
1.0401.4.0 ArticleProtect Article.php Occurs whenever the software receives a request to protect an article
1.0401.4.0 ArticleProtectComplete Article.php Occurs after the protect article request has been processed
1.0601.6.0 ArticlePurge Article.php Allows an extension to cancel a purge.
1.1301.13.0 ArticleRevisionVisiblitySet SpecialRevisiondelete.php called when changing visibility of one or more revisions of an article
1.1201.12.0 ArticleRevisionUndeleted SpecialUndelete.php Occurs after an article revision is restored
1.1201.12.0 ArticleRollbackComplete Article.php Occurs after an article rollback is completed
1.0401.4.0 ArticleSave Article.php Occurs whenever the software receives a request to save an article
1.0401.4.0 ArticleSaveComplete Article.php Occurs after the save article request has been processed
1.0911.9.1 ArticleUndelete SpecialUndelete.php When one or more revisions of an article are restored
1.1101.11.0 ArticleUpdateBeforeRedirect Article.php Occurs after a page is updated (usually on save), before the user is redirected back to the page
1.1901.19.0 ArticleViewCustom Article.php Allows to output the text of the article in a different format than wikitext.
1.1801.18.0 ArticleViewFooter Article.php After showing the footer section of an ordinary page view.
1.0601.6.0 ArticleViewHeader Article.php Occurs when header is shown
1.0511.5.1 ArticleViewRedirect Article.php Allows an extension to prevent the display of a "Redirected From" link on a redirect page.
1.1301.13.0 AuthPluginAutoCreate SpecialUserlogin.php Called when creating a local account for an user logged in from an external authentication method
1.0911.9.1 AuthPluginSetup Setup.php Update or replace authentication plugin object ($wgAuth)
1.0541.5.4 AutoAuthenticate StubObject.php Called to authenticate users on external/environmental means.
1.1201.12.0 AutopromoteCondition Autopromote.php check autopromote condition for user.
1.1901.19.0 BacklinkCacheGetConditions BacklinkCache.php Allows to set conditions for query when links to certain title.
1.1901.19.0 BacklinkCacheGetPrefix BacklinkCache.php Allows to set prefix for a spefific link table.
1.0701.7.0 BadImage ImageFunctions.php Before bad image list is evaluated
1.2301.23.0 BaseTemplateAfterPortlet SkinTemplate.php Called after rendering of portlets.
1.1801.18.0 BaseTemplateToolbox SkinTemplate.php Called by BaseTemplate when building the toolbox array

and returning it for the skin to output.

1.101 1.10.1 BeforeGalleryFindFile ImageGallery.php Allows extensions to specify a specific version of an image to display in a gallery.
1.190 1.19.0 BeforeDisplayNoArticleText Article.php Before displaying noarticletext or noarticletext-nopermission messages.
1.160 1.16.0 BeforeInitialize Wiki.php Occurs before anything is initialized in MediaWiki::performRequestForTitle().
1.0701.7.0 BeforePageDisplay OutputPage.php
SkinTemplate.php (< 1.12.0)
Allows last minute changes to the output page, e.g. adding of CSS or Javascript by extensions.
1.1901.19.0 BeforePageRedirect OutputPage.php Called prior to sending an HTTP redirect.
1.1801.18.0 BeforeParserFetchFileAndTitle Parser.php Before an image is rendered by Parser
1.1011.10.1 BeforeParserFetchTemplateAndtitle Parser.php Before a template is fetched by Parser
1.1011.10.1 BeforeParserrenderImageGallery Parser.php Before an image gallery is rendered by Parser
1.1201.12.0 BeforeWatchlist SpecialWatchlist.php Override watchlist display or add extra SQL clauses.
1.1801.18.0 BeforeWelcomeCreation SpecialUserlogin.php Allows an extension to change the message displayed upon a successful login.
1.1901.19.0 BitmapHandlerCheckImageArea Bitmap.php Called by BitmapHandler::normaliseParams(), after all normalizations have been performed, except for the $wgMaxImageArea check.
1.1801.18.0 BitmapHandlerTransform Bitmap.php Before a file is transformed, gives extension the possibility to transform it themselves.
1.0401.4.0 BlockIp SpecialBlockip.php Occurs whenever the software receives a request to block an IP address or user
1.0401.4.0 BlockIpComplete SpecialBlockip.php Occurs after the request to block an IP or user has been processed
1.0911.9.1 BookInformation SpecialBooksources.php Before information output on Special:Booksources
1.1301.13.0 BrokenLink Linker.php Before the HTML is created for a broken (i.e. red) link
1.1701.17.0 CanonicalNamespaces Namespace.php For extensions adding their own namespaces or altering the defaults.
1.0431.4.3 CategoryPageView CategoryPage.php Called before viewing a categorypage in CategoryPage::view
1.2001.20.0 ChangePasswordForm SpecialChangePassword.php For extensions that need to add a field to the ChangePassword form via the Preferences form
1.1201.12.0 ChangesListInsertArticleLink ChangesList.php Override or augment link to article in RC list.
1.1901.19.0 Collation::factory Collation.php Allows extensions to register new collation names, to be used with $wgCategoryCollation
1.1601.16.0 ConfirmEmailComplete User.php Called after a user's email has been confirmed successfully.
1.2401.24.0 ContentGetParserOutput AbstractContent.php Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content.
1.1301.13.0 ContribsPager::getQueryInfo SpecialContributions.php Before the contributions query is about to run
1.2001.20.0 ContribsPager::reallyDoQuery SpecialContributions.php Called before really executing the query for My Contributions
1.1301.13.0 ContributionsLineEnding SpecialContributions.php Called before a contributions HTML line is finished
1.1101.11.0 ContributionsToolLinks SpecialContributions.php Change tool links above Special:Contributions
1.0911.9.1 CustomEditor Wiki.php When invoking the page editor. Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc.
1.1601.16.0 DatabaseOraclePostInit DatabaseOracle.php Called after initialising an Oracle database connection
1.0701.7.0 DiffViewHeader DifferenceEngine.php Called before diff display
1.0801.8.0 DisplayOldSubtitle Article.php Allows extensions to modify the displaying of links to other revisions when browsing through revisions.
1.1401.14.0 DoEditSectionLink Linker.php Override the HTML generated for section edit links.
1.0601.6.0 EditFilter EditPage.php Perform checks on an edit
1.1201.12.0 EditFilterMerged EditPage.php Perform checks on an edit
1.0701.7.0 EditFormPreloadText EditPage.php Called when edit page for a new article is shown. This lets you fill the text-box of a new page with initial wikitext.
1.1601.16.0 EditFormInitialText EditPage.php Called when edit page for a existing article is shown. This lets you modify the content.
1.0831.8.3 EditPage::attemptSave EditPage.php Called before an article is saved, that is before insertNewArticle() is called
1.1601.16.0 EditPage::importFormData EditPage.php Allow extensions to read additional data posted in the form
1.0601.6.0 EditPage::showEditForm:fields EditPage.php Allows injection of form field into edit form.
1.0601.6.0 EditPage::showEditForm:initial EditPage.php before showing the edit form
1.2101.21.0 EditPage::showStandardInputs:options EditPage.php Allows injection of form fields into the editOptions area
1.1301.13.0 EditPageBeforeConflictDiff EditPage.php Allows modifying the EditPage object and output when there's an edit conflict.
1.1201.12.0 EditPageBeforeEditButtons EditPage.php Used to modify the edit buttons on the edit form
1.1401.14.0 EditPageBeforeEditChecks EditPage.php Allows modifying the edit checks below the textarea in the edit form
1.1601.16.0 EditPageBeforeEditToolbar EditPage.php Allows modifying the edit toolbar above the textarea
1.1601.16.0 EditPageCopyrightWarning EditPage.php Allow for site and per-namespace customization of contribution/copyright notice.
1.1601.16.0 EditPageGetDiffText EditPage.php Allow modifying the wikitext that will be used in "Show changes".
1.1601.16.0 EditPageGetPreviewText EditPage.php Allow modifying the wikitext that will be previewed.
1.1601.16.0 EditPageNoSuchSection EditPage.php When a section edit request is given for an non-existent section.
1.1601.16.0 EditPageTosSummary EditPage.php Give a chance for site and per-namespace customizations of terms of service summary link.
1.1101.11.0 EditSectionLink EditPage.php Override the return value of Linker::editSectionLink()
1.1101.11.0 EditSectionLinkForOther EditPage.php Override the return value of Linker::editSectionLink()
1.0701.7.0 EmailConfirmed User.php When checking that the user's email address is "confirmed"
1.0401.4.0 EmailUser SpecialEmailuser.php Occurs whenever the software receives a request to send an email from one user to another
1.1701.17.0 EmailUserCC SpecialEmailuser.php Occurs before sending the copy of the email to the author
1.0401.4.0 EmailUserComplete SpecialEmailuser.php Occurs after an email has been sent from one user to another
1.1701.17.0 EmailUserForm SpecialEmailuser.php Occurs after building the email user form object
1.1601.16.0 EmailUserPermissionsErrors SpecialEmailuser.php Retrieves permissions errors for emailing a user
1.1901.19.0 ExemptFromAccountCreationThrottle SpecialUserlogin.php To add an exemption from the account creation throttle
1.1801.18.0 ExtensionTypes SpecialVersion.php Called when generating the extensions credits, use this to change the tables headers
1.1901.19.0 ExtractThumbParameters thumb.php Called when extracting thumbnail parameters from a thumbnail file name.
1.0701.7.0 FetchChangesList ChangesList.php Allows extension to modify a recent changes list for a user.
1.130 1.13.0 FileDeleteComplete FileDeleteForm.php When a file is deleted
1.200 1.20.0 FileTransformed File.php When a file is transformed and moved into storage
1.110 1.11.0 FileUpload filerepo/LocalFile.php When a file upload occurs
1.130 1.13.0 FileUndeleteComplete SpecialUndelete.php When a file is undeleted
1.200 1.20.0 FormatAutocomments Linker.php When an autocomment is formatted by the Linker
1.170 1.17.0 FormatUserMessage User.php Hook to format a message if you want to override the internal formatter.
1.130 1.13.0 GetAutoPromoteGroups Autopromote.php When determining which autopromote groups a user is entitled to be in.
1.0601.6.0 GetBlockedStatus User.php Fired after the user's getBlockStatus is set.
1.1301.13.0 GetCacheVaryCookies OutputPage.php get cookies that should vary cache options
1.1801.18.0 GetCanonicalURL Title.php Allows to modify fully-qualified URLs used for IRC and e-mail notifications.
1.1801.18.0 GetDefaultSortkey Title.php Allows to override what the default sortkey is.
1.2301.23.0 GetExtendedMetadata FormatMetadata.php Allows including additional file metadata information in the imageinfo API.
1.0601.6.0 GetFullURL Title.php Used to modify fully-qualified URLs used in redirects/export/offsite data
1.0601.6.0 GetInternalURL Title.php Used to modify fully-qualified URLs (useful for squid cache purging)
1.170 1.17.0 GetIP ProxyTools.php Modify the ip of the current user (called only once).
1.1201.12.0 GetLinkColours LinkHolderArray.php modify the CSS class of an array of page links
1.0601.6.0 GetLocalURL Title.php Used to modify local URLs as output into page links
1.1901.19.0 GetLocalURL::Article Title.php Allows to modify local URLs specifically pointing to article paths without any fancy queries or variants.
1.1901.19.0 GetLocalURL::Internal Title.php Allows to modify local URLs to internal pages.
1.1801.18.0 GetMetadataVersion Generic.php Allows to modify the image metadata version currently in use.
1.1501.15.0 GetPreferences Preferences.php Modify user preferences
1.1201.12.0 getUserPermissionsErrors Title.php Add a permissions error when permissions errors are checked for.
1.1201.12.0 getUserPermissionsErrorsExpensive Title.php Absolutely the same, but is called only if expensive checks are enabled.
1.2001.20.0 GitViewers GitInfo.php Called when generating the list of git viewers for Special:Version, use this to change the list.
1.1401.14.0 HTMLCacheUpdate::doUpdate HTMLCacheUpdate.php After cache invalidation updates are inserted into the job queue
1.1301.13.0 ImageBeforeProduceHTML Linker.php Called before producing the HTML created by a wiki image insertion.
1.1101.11.0 ImageOpenShowImageInlineBefore ImagePage.php Call potential extension just before showing the image on an image page.
1.1601.16.0 ImagePageAfterImageLinks ImagePage.php Called after the image links section on an image page is built.
1.1301.13.0 ImagePageFileHistoryLine ImagePage.php Called when a file history line is contructed.
1.1301.13.0 ImagePageFindFile ImagePage.php Called when fetching the file associed with an image page.
1.1601.16.0 ImagePageShowTOC ImagePage.php Called when the file toc on an image page is generated.
1.170 1.17.0 ImportHandleLogItemXMLTag ImportXMLReader.php When parsing a XML tag in a log item
1.170 1.17.0 ImportHandlePageXMLTag ImportXMLReader.php When parsing a XML tag in a page
1.170 1.17.0 ImportHandleRevisionXMLTag ImportXMLReader.php When parsing a XML tag in a page revision
1.170 1.17.0 ImportHandleToplevelXMLTag ImportXMLReader.php When parsing a top level XML tag
1.170 1.17.0 ImportHandleUploadXMLTag ImportXMLReader.php When parsing a XML tag in a file upload
1.200 1.20.0 InfoAction InfoAction.php When building information to display on the action=info page
1.1101.11.0 InitPreferencesForm SpecialPreferences.php Called at the end of PreferencesForm's constructor
1.16.01.16.0 ImgAuthBeforeStream img_auth.php Executed before file is streamed to user, but only when using img_auth
1.1301.13.0 InitializeArticleMaybeRedirect Wiki.php Called when checking if title is a redirect
1.1001.10.0 InternalParseBeforeLinks Parser.php Used to process the expanded wiki code after <nowiki>, HTML-comments, and templates have been treated. Suitable for syntax extensions that want to support templates and comments.
1.160 1.16.0 InvalidateEmailComplete User.php Called after a user's email has been invalidated successfully.
1.180 1.18.0 IRCLineURL RecentChange.php When constructing the URL to use in an IRC notification.
1.100 1.10.0 IsFileCacheable Article.php Allow an extension to disable file caching on pages.
1.0901.9.0 IsTrustedProxy ProxyTools.php Allows an extension to set an IP as trusted or not.
1.120 1.12.0 isValidEmailAddr User.php Override the result of User::isValidEmailAddr()
1.110 1.11.0 isValidPassword User.php Override the result of User::isValidPassword()
1.1901.19.0 Language::getMessagesFileName languages/Language.php Use to change the path of a localisation file.
1.1901.19.0 LanguageGetNamespaces languages/Language.php Provide custom ordering for namespaces or

remove namespaces.

1.0901.9.0 LanguageGetSpecialPageAliases languages/Language.php Use to define aliases of special pages names depending of the language
1.1801.18.0 LanguageGetTranslatedLanguageNames languages/Language.php Provide translated language names.
1.1401.14.0 LinkBegin Linker.php Used when generating internal and interwiki links in Linker::link()
1.1401.14.0 LinkEnd Linker.php Used when generating internal and interwiki links in Linker::link(), just before the function returns a value.
1.1301.13.0 LinkerMakeExternalLink Linker.php At the end of Linker::makeExternalLink() just before the return
1.1301.13.0 LinkerMakeExternalImage Linker.php At the end of Linker::makeExternalImage() just before the return
1.120 1.12.0 LinksUpdate LinksUpdate.php At the beginning of LinksUpdate::doUpdate() just before the actual update.
1.120 1.12.0 LinksUpdateComplete LinksUpdate.php At the end of LinksUpdate::doUpdate() when updating has completed.
1.110 1.11.0 LinksUpdateConstructed LinksUpdate.php At the end of LinksUpdate() is construction.
1.150 1.15.0 ListDefinedTags ChangeTags.php When trying to find all defined tags.
1.0801.8.0 LoadAllMessages MessageCache.php called by MessageCache::loadAllMessages() to load extensions messages
1.101 1.10.1 LoadExtensionSchemaUpdates maintenance/updaters.inc Fired when MediaWiki is updated to allow extensions to update the database.
1.130 1.13.0 LocalFile::getHistory LocalFile.php Called before file history query performed
1.190 1.19.0 LocalFilePurgeThumbnails LocalFile.php Called before thumbnails for a local file a purged
1.190 1.19.0 LogEventsListShowLogExtract LogEventsList.php Called before the result of LogEventsList::showLogExtract() is added to OutputPage.
1.100 1.10.0 LoginAuthenticateAudit SpecialUserlogin.php A login attempt for a valid user account either succeeded or failed. No return data is accepted; this hook is for auditing only.
1.1201.12.0 LogLine SpecialLog.php Processes a single log entry on Special:Log
1.0601.6.0 LogPageActionText Setup.php Strings used by wfMsg as a header. DEPRECATED: Use $wgLogActions
1.0501.5.0 LogPageLogHeader Setup.php Strings used by wfMsg as a header. DEPRECATED: Use $wgLogHeaders
1.0501.5.0 LogPageLogName Setup.php Name of the logging page(s). DEPRECATED: Use $wgLogNames
1.0501.5.0 LogPageValidTypes Setup.php Action being logged. DEPRECATED: Use $wgLogTypes
1.0601.6.0 MagicWordwgVariableIDs MagicWord.php Allows extensions to add Magic Word IDs.
1.1801.18.0 MaintenanceRefreshLinksInit maintenance/refreshLinks.php Before executing the refreshLinks.php maintenance script.
1.1401.14.0 MakeGlobalVariablesScript Skin.php called right before Skin::makeVariablesScript() is executed
1.0601.6.0 MarkPatrolled Article.php Called before an edit is marked patrolled
1.0601.6.0 MarkPatrolledComplete Article.php Called after an edit is marked patrolled
1.0701.7.0 MathAfterTexvc Math.php After texvc is executed when rendering mathematics
1.1201.12.0 MediaWikiPerformAction Wiki.php Override MediaWiki::performAction().
1.1501.15.0 MessageCacheReplace MessageCache.php When a message page is changed. Useful for updating caches.
1.1601.16.0 MessageNotInMwNs MessageCache.php When trying to get a message that isn't found in the MediaWiki namespace
1.0571.5.7 MessagesPreLoad MessageCache.php Occurs when loading a message from the database
1.1601.16.0 ModifyExportQuery Export.php Modify the query used by the exporter.
1.0601.6.0 MonoBookTemplateToolboxEnd skins/Monobook.php Called by Monobook skin after toolbox links have been rendered (useful for adding more)
1.2001.20.0 NamespaceIsMovable Namespace.php Called when determining if it is possible to pages in a namespace.
1.1501.15.0 NewDifferenceEngine diff/DifferenceEngine.php Called when a new DifferenceEngine object is made.
1.1301.13.0 NewRevisionFromEditComplete (Various files) Called when a revision was inserted due to an edit
1.1301.13.0 NormalizeMessageKey MessageFunctions.php Called before the software gets the text of a message
1.1401.14.0 OldChangesListRecentChangesLine ChangesList.php Customize entire Recent Changes line
1.1301.13.0 OpenSearchUrls opensearch_desc.php Called when constructing the OpenSearch description XML.
1.1601.16.0 OtherBlockLogLink SpecialBlockip.php Get links to the block log from extensions which blocks users and/or IP addresses too
1.0601.6.0 OutputPageBeforeHTML OutputPage.php Called after the page has been rendered, but before the HTML is displayed.
1.1701.17.0 OutputPageBodyAttributes OutputPage.php Called when OutputPage::headElement() is creating the body tag.
1.1401.14.0 OutputPageCheckLastModified OutputPage.php When checking if the page has been modified since the last visit
1.1301.13.0 OutputPageMakeCategoryLinks OutputPage.php Called when links are about to be generated for the page's categories.
1.0801.8.0 OutputPageParserOutput OutputPage.php after adding a parserOutput to $wgOut
1.1901.19.0 PageContentLanguage Title.php Allows changing the page content language and the direction depending on that language.
1.1001.10.0 PageHistoryBeforeList PageHistory.php When a history page list is about to be constructed.
1.1001.10.0 PageHistoryLineEnding PageHistory.php Right before the end >li> is added to a history line
1.1301.13.0 PageHistoryPager::getQueryInfo PageHistory.php When a history pager query parameter set is constructed
1.0601.6.0 PageRenderingHash User.php Alter the parser cache option hash key
1.2001.20.0 ParserAfterParse Parser.php Called from Parser::parse() just after the call to Parser::internalParse() returns
1.0501.5.0 ParserAfterStrip Parser.php Same as ParserBeforeStrip
1.0501.5.0 ParserAfterTidy Parser.php Used to add some final processing to the fully-rendered page output
1.0601.6.0 ParserBeforeInternalParse Parser.php called at the beginning of Parser::internalParse()
1.0501.5.0 ParserBeforeStrip Parser.php Used to process the raw wiki code before any internal processing is applied
1.0501.5.0 ParserBeforeTidy Parser.php Used to process the nearly-rendered html code for the page (but before any html tidying occurs)
1.0601.6.0 ParserClearState Parser.php called at the end of Parser::clearState()
1.2101.21.0 ParserCloned Parser.php called when the Parser object is cloned
1.1201.12.0 ParserFirstCallInit Parser.php called when the parser initialises for the first time
1.0601.6.0 ParserGetVariableValueSwitch Parser.php called when the parser needs the value of a custom magic word
1.0601.6.0 ParserGetVariableValueTs Parser.php use this to change the value of the time for the {{LOCAL...}} magic word
1.0601.6.0 ParserGetVariableValueVarCache Parser.php use this to change the value of the variable cache or return false to not use it
1.1201.12.0 ParserLimitReport Parser.php called at the end of Parser::parse() when the parser will include comments about size of the text parsed
1.1201.12.0 ParserMakeImageParams Parser.php called at the end of Parser::makeImage(). Alter the parameters used to generate an image.
1.1901.19.0 ParserSectionCreate Parser.php Called each time the parser creates a document section from wikitext.
1.2001.20.0 ParserTestGlobals parserTest.inc, NewParserTest.php Allows to define globals for parser tests.
1.0601.6.0 ParserTestParser parserTest.inc, NewParserTest.php called when creating a new instance of Parser in maintenance/parserTests.inc
1.1001.10.0 ParserTestTables maintenance/parserTests.inc Alter the list of tables to duplicate when parser tests are run.
Use when page save hooks require the presence of custom tables to ensure that tests continue to run properly.
1.1801.18.0 PerformRetroactiveAutoblock Block.php Called before a retroactive autoblock is applied to a user.
1.0601.6.0 PersonalUrls SkinTemplate.php Alter the user-specific navigation links (e.g. "my page, my talk page, my contributions" etc).
1.0901.9.0 PingLimiter User.php Allows extensions to override the results of User::pingLimiter()
1.1901.19.0 PlaceNewSection WikiPage.php Allows extensions to control where new sections are added.
1.2401.24.0 PostLoginRedirect SpecialUserlogin.php Modify the post login redirect behavior.
1.2001.20.0 PreferencesGetLegend Preferences.php Override the text used for the <legend> of a preferences section.
1.0901.9.0 PreferencesUserInformationPanel SpecialPreferences.php Add HTML bits to user information list in preferences form
1.1201.12.0 PrefixSearchBackend PrefixSearch.php Override the title prefix search used for OpenSearch and AJAX search suggestions.
1.1101.11.0 PrefsEmailAudit SpecialPreferences.php called when user changes his email address
1.1101.11.0 PrefsPasswordAudit SpecialPreferences.php called when user changes his password
1.1601.16.0 ProtectionForm::buildForm ProtectionForm.php Called after all protection type fieldsets are made in the form
1.1601.16.0 ProtectionForm::save ProtectionForm.php Called when a protection form is submitted
1.1601.16.0 ProtectionForm::showLogExtract ProtectionForm.php Called after the protection log extract is shown
1.1001.10.0 RawPageViewBeforeOutput RawPage.php Right before the text is blown out in action=raw
1.0801.8.0 RecentChange_save RecentChange.php Called after a "Recent Change" is commited to the DB
1.2001.20.0 RedirectSpecialArticleRedirectParams SpecialPage.php Lets you alter the set of parameter names such as "oldid" that are preserved when using.
1.1101.11.0 RenderPreferencesForm SpecialPreferences.php Called at the end of PreferencesForm::mainPrefsForm
1.1901.19.0 RequestContextCreateSkin RequestContext.php Called when creating a skin instance.
1.1101.11.0 ResetPreferences SpecialPreferences.php Called at the end of PreferencesForm::resetPrefs
1.1701.17.0 ResourceLoaderGetConfigVars ResourceLoaderStartUpModule.php Called right before ResourceLoaderStartUpModule::getConfig() returns.
1.1801.18.0 ResourceLoaderGetStartupModules ResourceLoaderStartUpModule.php Run once the startup module is being generated.
1.1701.17.0 ResourceLoaderRegisterModules ResourceLoader.php Allows registering of modules with ResourceLoader.
1.1901.19.0 ResourceLoaderTestModules ResourceLoader.php Add new javascript testing modules. This is called after the addition of MediaWiki core test suites.
1.1101.11.0 RevisionInsertComplete Revision.php Called after a revision is inserted into the DB
1.1101.11.0 SavePreferences SpecialPreferences.php Called at the end of PreferencesForm::savePreferences; returning false prevents the preferences from being saved.
1.1601.16.0 SearchableNamespaces SearchEngine.php An option to modify which namespaces are searchable.
1.1601.16.0 SearchEngineReplacePrefixesComplete SearchEngine.php Run after SearchEngine::replacePrefixes().
1.1201.12.0 SearchGetNearMatch SearchEngine.php An extra chance for exact-title-matches in "go" searches.
1.1601.16.0 SearchGetNearMatchBefore SearchEngine.php Perform exact-title-matches in "go" searches before the normal operations.
1.1601.16.0 SearchGetNearMatchComplete SearchEngine.php A chance to modify exact-title-matches in "go" searches.
1.2001.20.0 SearchResultInitFromTitle SearchEngine.php Set the revision used when displaying a page in search results.
1.1001.10.0 SearchUpdate SearchUpdate.php Prior to search update completion
1.1401.14.0 SetupAfterCache Setup.php Called in Setup.php, after cache objects are set
1.1701.17.0 SetupUserMessageArticle User.php Called in User::leaveUserMessage() before anything has been posted to the article.
1.1601.16.0 ShowMissingArticle Article.php Called when generating the output for a non-existent page
1.1101.11.0 ShowRawCssJs Article.php Customise the output of raw CSS and JavaScript in page views
1.1601.16.0 ShowSearchHitTitle SpecialSearch.php Customise display of search hit title/link.
1.0701.7.0 SiteNoticeAfter GlobalFunctions.php After site notice is determined
1.0701.7.0 SiteNoticeBefore GlobalFunctions.php Before site notice is determined
1.1101.11.0 SkinAfterBottomScripts Skin.php At the end of Skin::bottomScripts()
1.1401.14.0 SkinAfterContent Skin.php Allows extensions to add text after the page content and article metadata.
1.1401.14.0 SkinBuildSidebar Skin.php At the end of Skin::buildSidebar()
1.1601.16.0 SkinCopyrightFooter Skin.php Allow for site and per-namespace customization of copyright notice.
1.1701.17.0 SkinGetPoweredBy Skin.php Called when generating the code used to display the "Powered by MediaWiki" icon.
1.1201.12.0 SkinSubPageSubtitle Skin.php Called before the list of subpage links on top of a subpage is generated
1.0601.6.0 SkinTemplateBuildContentActionUrlsAfterSpecialPage SkinTemplate.php after the single tab when showing a special page
1.0601.6.0 SkinTemplateBuildNavUrlsNav_urlsAfterPermalink SkinTemplate.php after creating the "permanent link" tab
1.0501.5.0 SkinTemplateContentActions SkinTemplate.php Alter the "content action" links in SkinTemplates
1.2301.23.0 SkinTemplateGetLanguageLink SkinTemplate.php Called after building the data for a language link from which the actual html is constructed.
1.1601.16.0 SkinTemplateNavigation SkinTemplate.php Alter the structured navigation links in SkinTemplate
1.1001.10.0 SkinTemplateOutputPageBeforeExec SkinTemplate.php Before SkinTemplate::outputPage() starts page output
1.0601.6.0 SkinTemplatePreventOtherActiveTabs SkinTemplate.php use this to prevent showing active tabs
1.0601.6.0 SkinTemplateSetupPageCss SkinTemplate.php use this to provide per-page CSS
1.1801.18.0 SkinTemplateNavigation::SpecialPage SkinTemplate.php Called on special pages after the special tab is added but before variants have been added
1.1201.12.0 SkinTemplateTabAction SkinTemplate.php Override SkinTemplate::tabAction().
1.0601.6.0 SkinTemplateTabs SkinTemplate.php called when finished to build the actions tabs
1.1301.13.0 SkinTemplateToolboxEnd skins/Monobook.php, skins/Modern.php Called by SkinTemplate skins after toolbox links have been rendered (useful for adding more)
1.1801.18.0 SkinTemplateNavigation::Universal SkinTemplate.php Called on both content and special pages after variants have been added
1.1501.15.0 SoftwareInfo SpecialVersion.php Called by Special:Version for returning information about the software
1.0501.5.0 SpecialContributionsBeforeMainOutput SpecialContributions.php Before the form on Special:Contributions
1.1301.13.0 SpecialListusersDefaultQuery SpecialListusers.php Called right before the end of UsersPager::getDefaultQuery()
1.1301.13.0 SpecialListusersFormatRow SpecialListusers.php Called right before the end of UsersPager::formatRow()
1.1301.13.0 SpecialListusersHeader SpecialListusers.php Called before closing the <fieldset> in UsersPager::getPageHeader()
1.1301.13.0 SpecialListusersHeaderForm SpecialListusers.php Called before adding the submit button in UsersPager::getPageHeader()
1.1301.13.0 SpecialListusersQueryInfo SpecialListusers.php Called right before the end of UsersPager::getQueryInfo()
1.0601.6.0 SpecialMovepageAfterMove SpecialMovepage.php Called after a page is moved.
1.1801.18.0 SpecialNewPagesFilters SpecialNewpages.php Called after building form options at NewPages.
1.0701.7.0 SpecialPage_initList SpecialPage.php Called when the list of Special Pages is populated. Hook gets a chance to change the list to hide/show pages
1.2001.20.0 SpecialPageAfterExecute SpecialPage.php Called after SpecialPage::execute().
1.2001.20.0 SpecialPageBeforeExecute SpecialPage.php Called before SpecialPage::execute().
1.0601.6.0 SpecialPageExecuteAfterPage SpecialPage.php called after executing a special page
1.0601.6.0 SpecialPageExecuteBeforeHeader SpecialPage.php called before setting the header text of the special page
1.0601.6.0 SpecialPageExecuteBeforePage SpecialPage.php called after setting the special page header text but before the main execution
1.1801.18.0 SpecialPasswordResetOnSubmit SpecialPasswordReset.php Called when executing a form submission on Special:PasswordReset.
1.1601.16.0 SpecialRandomGetRandomTitle SpecialRandompage.php Modify the selection criteria for Special:Random
1.1801.18.0 SpecialRecentChangesFilters SpecialRecentchanges.php Called after building form options at RecentChanges
1.1301.13.0 SpecialRecentChangesPanel SpecialRecentchanges.php called when building form options in SpecialRecentChanges
1.1301.13.0 SpecialRecentChangesQuery SpecialRecentchanges.php called when building sql query for SpecialRecentChanges
1.1901.19.0 SpecialSearchCreateLink SpecialSearch.php Called when making the message to create a page or go to the existing page.
1.0601.6.0 SpecialSearchNogomatch SpecialSearch.php called when user clicked the "Go" button but the target doesn't exist
1.1301.13.0 SpecialSearchNoResults SpecialSearch.php called before search result display when there are no matches
1.1901.19.0 SpecialSearchPowerBox SpecialSearch.php The equivalent of SpecialSearchProfileForm for the advanced form, a.k.a. power search box
1.1801.18.0 SpecialSearchProfileForm SpecialSearch.php allows modification of search profile forms
1.1601.16.0 SpecialSearchProfiles SpecialSearch.php allows modification of search profiles
1.1301.13.0 SpecialSearchResults SpecialSearch.php called before search result display when there are matches
1.2101.21.0 SpecialSearchResultsAppend SpecialSearch.php Called after all search results HTML has been output. Note that in some cases, this hook will not be called (no results, too many results, SpecialSearchResultsPrepend returned false, etc).
1.2101.21.0 SpecialSearchResultsPrepend SpecialSearch.php Called immediately before returning HTML on the search results page. Useful for including an external search provider. To disable the output of MediaWiki search output, return false.
1.1801.18.0 SpecialSearchSetupEngine SpecialSearch.php allows passing custom data to search engine
1.1601.16.0 SpecialStatsAddExtra SpecialStatistics.php Can be used to add extra statistic at the end of Special:Statistics
1.1601.16.0 SpecialUploadComplete SpecialUpload.php Called after successfully uploading a file from Special:Upload
1.0601.6.0 SpecialVersionExtensionTypes SpecialVersion.php called when generating the extensions credits, use this to change the tables headers
1.1801.18.0 SpecialWatchlistFilters SpecialWatchlist.php Called after building form options at Watchlist.
1.1401.14.0 SpecialWatchlistQuery SpecialWatchlist.php Called when building sql query for SpecialWatchlist
1.1801.18.0 TestCanonicalRedirect Wiki.php Called when about to force a redirect to a canonical URL for a title when we have no other parameters on the URL.
1.1401.14.0 TitleArrayFromResult TitleArray.php called when creating an TitleArray object from a database result
1.1601.16.0 TitleGetRestrictionTypes Title.php Allows to modify the types of protection that can be applied.
1.2001.20.0 TitleIsAlwaysKnown Title.php Allows overriding default behaviour for determining if a page exists.
1.1901.19.0 TitleIsCssOrJsPage Title.php Called when determining if a page is a CSS or JS page.
1.1901.19.0 TitleIsMovable Title.php Called when determining if it is possible to move a page.
1.1901.19.0 TitleIsWikitextPage Title.php Called when determining if a page is a wikitext or should be handled by seperate handler (via ArticleViewCustom).
1.0401.4.0 TitleMoveComplete Title.php Occurs whenever a request to move an article is completed
1.1901.19.0 TitleReadWhitelist Title.php Called at the end of read permissions checks, just before adding the default error message if nothing allows the user to read the page.
1.1801.18.0 UndeleteForm::showHistory SpecialUndelete.php Called in UndeleteForm::showHistory, after a PageArchive object has been created but before any further processing is done.
1.1801.18.0 UndeleteForm::showRevision SpecialUndelete.php Called in UndeleteForm::showRevision, after a PageArchive object has been created but before any further processing is done.
1.1801.18.0 UndeleteForm::undelete SpecialUndelete.php Called un UndeleteForm::undelete, after checking that the site is not in read-only mode, that the Title object is not null and after a PageArchive object has been constructed but before performing any further processing.
1.0901.9.0 UndeleteShowRevision SpecialUndelete.php called when showing a revision in Special:Undelete
1.0401.4.0 UnknownAction Wiki.php Used to add new query-string actions
1.0401.4.0 UnwatchArticle Article.php Occurs whenever the software receives a request to unwatch an article
1.0401.4.0 UnwatchArticleComplete Article.php Occurs after the unwatch article request has been processed
1.1601.16.0 UploadCreateFromRequest UploadBase.php When UploadBase::createFromRequest has been called.
1.0641.6.4 UploadComplete SpecialUpload.php Called when a file upload has completed.
1.1601.16.0 UploadFormInitDescriptor SpecialUpload.php Occurs after the descriptor for the upload form as been assembled.
1.1601.16.0 UploadFormSourceDescriptors SpecialUpload.php Occurs after the standard source inputs have been added to the descriptor.
1.0901.9.0 UploadForm:BeforeProcessing SpecialUpload.php Called just before the file data (for example description) are processed, so extensions have a chance to manipulate them.
1.0901.9.0 UploadForm:initial SpecialUpload.php Called just before the upload form is generated
1.0601.6.0 UploadVerification SpecialUpload.php Called when a file is uploaded, to allow extra file verification to take place (deprecated)
1.1701.17.0 UploadVerifyFile SpecialUpload.php Called when a file is uploaded, to allow extra file verification to take place (preferred)
1.1801.18.0 UserAddGroup User.php Called when adding a group to an user.
1.1301.13.0 UserArrayFromResult UserArray.php called when creating an UserArray object from a database result
1.0601.6.0 userCan Title.php To interrupt/advise the "user can do X to Y article" check
1.1201.12.0 UserCanSendEmail User.php To override User::canSendEmail() permission check
1.0571.5.7 UserClearNewTalkNotification User.php called when clearing the "You have new messages!" message
1.0601.6.0 UserCreateForm SpecialUserlogin.php Change to manipulate the login form
1.110 1.11.0 UserEffectiveGroups User.php Called in User::getEffectiveGroups()
1.130 1.13.0 UserGetAllRights User.php After calculating a list of all available rights
1.180 1.18.0 UserGetDefaultOptions User.php Called after fetching the core default user options.
1.130 1.13.0 UserGetEmail User.php Called when getting an user email address
1.130 1.13.0 UserGetEmailAuthenticationTimestamp User.php Called when getting the timestamp of email authentification
1.110 1.11.0 UserGetImplicitGroups User.php Called in User::getImplicitGroups()
1.180 1.18.0 UserGetLanguageObject User.php Called when getting user's interface language object.
1.140 1.14.0 UserGetReservedNames User.php Allows to modify $wgReservedUsernames at run time.
1.1101.11.0 UserGetRights User.php Called in User::getRights()
1.1601.16.0 UserIsBlockedFrom User.php Check if a user is blocked from a specific page (for specific block exemptions).
1.1401.14.0 UserIsBlockedGlobally User.php Check if user is blocked on all wikis.
1.1401.14.0 UserLoadAfterLoadFromSession User.php Called to authenticate users on external/environmental means; occurs after session is loaded
1.1301.13.0 UserLoadDefaults User.php Called when loading a default user
1.1501.15.0 UserLoadFromDatabase User.php Called when loading a user from the database
1.1301.13.0 UserLoadFromSession User.php Called to authenticate users on external/environmental means
1.1501.15.0 UserLoadOptions User.php Called when user options/preferences are being loaded from the database
1.0401.4.0 UserLoginComplete SpecialUserlogin.php Occurs after a user has successfully logged in
1.0601.6.0 UserLoginForm SpecialUserlogin.php Change to manipulate the login form
1.0401.4.0 UserLogout SpecialUserlogin.php Occurs when the software receives a request to log out
1.0401.4.0 UserLogoutComplete SpecialUserlogin.php Occurs after a user has successfully logged out
1.1401.14.0 User::mailPasswordInternal SpecialUserlogin.php Before creation and mailing of a user's new temporary password
1.1801.18.0 UserRemoveGroup User.php Called when removing a group from an user.
1.0571.5.7 UserRetrieveNewTalks User.php called when retrieving "You have new messages!" message(s)
1.0601.6.0 UserRights SpecialUserrights.php Called after a user's group memberships are changed
1.1401.14.0 UserrightsChangeableGroups SpecialUserrights.php Called after the list of groups that can be manipulated via Special:UserRights is populated, but before it is returned.
1.1501.15.0 UserSaveOptions User.php Called just before saving user preferences/options
1.1301.13.0 UserSaveSettings User.php Called when saving user settings
1.1301.13.0 UserSetCookies User.php Called when setting user cookies
1.1301.13.0 UserSetEmail User.php Called when changing user email address
1.1301.13.0 UserSetEmailAuthenticationTimestamp User.php Called when setting the timestamp of email authentification
1.0801.8.0 UserToggles User.php Called before returning "user toggle names"
1.1901.19.0 UserToolLinksEdit Linker.php Contribs | Block)"
1.1801.18.0 WantedPages::getQueryInfo SpecialWantedPages.php Called in WantedPagesPage::getQueryInfo(), can be used to alter the SQL query which gets the list of wanted pages.
1.1501.15.0 WantedPages::getSQL SpecialWantedPages.php Called in WantedPagesPage::getSQL(), can be used to alter the SQL query which gets the list of wanted pages DEPRECATED: Use WantedPages::getQueryInfo
1.0401.4.0 WatchArticle Article.php Occurs whenever the software receives a request to watch an article
1.0401.4.0 WatchArticleComplete Article.php Occurs after the watch article request has been processed
1.1701.17.0 WatchlistEditorBuildRemoveLine WatchlistEditor.php Occurs when building remove lines in Special:Watchlist/edit
1.1901.19.0 WebRequestPathInfoRouter WebRequest.php While building the PathRouter to parse the REQUEST_URI.
1.2001.20.0 wfShellWikiCmd GlobalFunctions.php Called when generating a shell-escaped command line string to run a maintenance script.
1.1501.15.0 WikiExporter::dumpStableQuery Export.php Get the SELECT query for "stable" revisions dumps
1.0601.6.0 wgQueryPages QueryPage.php called when initialising $wgQueryPages
1.1601.16.0 XmlDumpWriterOpenPage Export.php Called at the end of XmlDumpWriter::openPage, to allow extra metadata to be added.
1.1601.16.0 XmlDumpWriterWriteRevision Export.php Called at the end of a revision in an XML dump, to add extra metadata.
1.1801.18.0 XMPGetInfo media/XMPInfo.php Called when obtaining the list of XMP tags to extract.
1.1801.18.0 XMPGetResults media/XMP.php Called just before returning the results array of parsing xmp data.

Hooks grouped by version[edit | edit source]

To see hooks grouped by version go to the table above and click the arrow symbol in the version table header.

See also[edit | edit source]

Language: English  • Deutsch • Bahasa Indonesia • 日本語