diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /docs/hooks.txt | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'docs/hooks.txt')
-rw-r--r-- | docs/hooks.txt | 528 |
1 files changed, 380 insertions, 148 deletions
diff --git a/docs/hooks.txt b/docs/hooks.txt index 5aaf5961..910d812e 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -250,6 +250,7 @@ $block: The block from which the autoblock is coming. 'AbortEmailNotification': Can be used to cancel email notifications for an edit. $editor: The User who made the change. $title: The Title of the page that was edited. +$rc: The current RecentChange object. 'AbortLogin': Return false to cancel account login. $user: the User object being authenticated against @@ -269,11 +270,19 @@ $reason: the reason for the move (added in 1.13) 'AbortNewAccount': Return false to cancel explicit account creation. $user: the User object about to be created (read-only, incomplete) &$msg: out parameter: HTML to display on abort +&$status: out parameter: Status object to return, replaces the older $msg param (added in 1.23) + Create the object with Status::newFatal() to ensure proper API error messages + are returned when creating account through API clients. 'AbortTalkPageEmailNotification': Return false to cancel talk page email notification $targetUser: the user whom to send talk page email notification $title: the page title +'SendWatchlistEmailNotification': Return true to send watchlist email notification +$targetUser: the user whom to send watchlist email notification +$title: the page title +$enotif: EmailNotification object + 'AbortChangePassword': Return false to cancel password change. $user: the User object to which the password change is occuring $mOldpass: the old password provided by the user @@ -295,18 +304,14 @@ $article: Article object $user: the User object that was created. (Parameter added in 1.7) $byEmail: true when account was created "by email" (added in 1.12) -'AfterFinalPageOutput': At the end of OutputPage::output() but before final -ob_end_flush() which will send the buffered output to the client. This allows -for last-minute modification of the output within the buffer by using -ob_get_clean(). -&$output: OutputPage object +'AddNewAccountApiForm': Allow modifying internal login form when creating an account via API. +$apiModule: the ApiCreateAccount module calling +$loginForm: the LoginForm used -'AfterImportPage': When a page import is completed. -$title: Title under which the revisions were imported -$origTitle: Title provided by the XML file -$revCount: Number of revisions in the XML file -$sRevCount: Number of successfully imported revisions -$pageInfo: associative array of page information +'AddNewAccountApiResult': Modify API output when creating a new account via API. +$apiModule: the ApiCreateAccount module calling +$loginForm: the LoginForm used +&$result: associative array for API result data 'AfterFinalPageOutput': Nearly at the end of OutputPage::output() but before OutputPage::sendCacheControl() and final ob_end_flush() which @@ -314,10 +319,19 @@ will send the buffered output to the client. This allows for last-minute modification of the output within the buffer by using ob_get_clean(). $output: The OutputPage object where output() was called -'AjaxAddScript': Called in output page just before the initialisation -of the javascript ajax engine. The hook is only called when ajax -is enabled ( $wgUseAjax = true; ). -&$output: OutputPage object +'AfterImportPage': When a page import is completed. +$title: Title under which the revisions were imported +$origTitle: Title provided by the XML file +$revCount: Number of revisions in the XML file +$sRevCount: Number of successfully imported revisions +$pageInfo: associative array of page information + +'AfterParserFetchFileAndTitle': After an image gallery is formed by Parser, +just before adding its HTML to parser output. +$parser: Parser object that called the hook +$ig: Gallery, an object of one of the gallery classes (inheriting from +ImageGalleryBase) +$html: HTML generated by the gallery 'AlternateEdit': Before checking if a user can edit a page and before showing the edit form ( EditPage::edit() ). This is triggered on &action=edit. @@ -347,6 +361,9 @@ $body: Body of the message this to extend core API modules. &$module: Module object +'ApiBeforeMain': Before calling ApiMain's execute() method in api.php. +&$main: ApiMain object + 'ApiCheckCanExecute': Called during ApiMain::checkCanExecute. Use to further authenticate and authorize API clients before executing the module. Return false and set a message to cancel the request. @@ -376,16 +393,6 @@ descriptions. &$module: ApiBase Module object &$desc: Array of parameter descriptions -'APIGetResultProperties': Use this hook to modify the properties in a module's -result. -&$module: ApiBase Module object -&$properties: Array of properties - -'APIGetPossibleErrors': Use this hook to modify the module's list of possible -errors. -$module: ApiBase Module object -&$possibleErrors: Array of possible errors - 'APIQueryAfterExecute': After calling the execute() method of an action=query submodule. Use this to extend core API modules. &$module: Module object @@ -395,36 +402,39 @@ an action=query submodule. Use this to extend core API modules. &$module: Module object &$resultPageSet: ApiPageSet object -'APIQueryInfoTokens': Use this hook to add custom tokens to prop=info. Every -token has an action, which will be used in the intoken parameter and in the -output (actiontoken="..."), and a callback function which should return the -token, or false if the user isn't allowed to obtain it. The prototype of the -callback function is func($pageid, $title), where $pageid is the page ID of the -page the token is requested for and $title is the associated Title object. In -the hook, just add your callback to the $tokenFunctions array and return true -(returning false makes no sense). +'APIQueryInfoTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +Use this hook to add custom tokens to prop=info. Every token has an action, +which will be used in the intoken parameter and in the output +(actiontoken="..."), and a callback function which should return the token, or +false if the user isn't allowed to obtain it. The prototype of the callback +function is func($pageid, $title), where $pageid is the page ID of the page the +token is requested for and $title is the associated Title object. In the hook, +just add your callback to the $tokenFunctions array and return true (returning +false makes no sense). $tokenFunctions: array(action => callback) -'APIQueryRevisionsTokens': Use this hook to add custom tokens to prop=revisions. -Every token has an action, which will be used in the rvtoken parameter and in -the output (actiontoken="..."), and a callback function which should return the -token, or false if the user isn't allowed to obtain it. The prototype of the -callback function is func($pageid, $title, $rev), where $pageid is the page ID -of the page associated to the revision the token is requested for, $title the +'APIQueryRevisionsTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +Use this hook to add custom tokens to prop=revisions. Every token has an +action, which will be used in the rvtoken parameter and in the output +(actiontoken="..."), and a callback function which should return the token, or +false if the user isn't allowed to obtain it. The prototype of the callback +function is func($pageid, $title, $rev), where $pageid is the page ID of the +page associated to the revision the token is requested for, $title the associated Title object and $rev the associated Revision object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). $tokenFunctions: array(action => callback) -'APIQueryRecentChangesTokens': Use this hook to add custom tokens to -list=recentchanges. Every token has an action, which will be used in the rctoken -parameter and in the output (actiontoken="..."), and a callback function which -should return the token, or false if the user isn't allowed to obtain it. The -prototype of the callback function is func($pageid, $title, $rc), where $pageid -is the page ID of the page associated to the revision the token is requested -for, $title the associated Title object and $rc the associated RecentChange -object. In the hook, just add your callback to the $tokenFunctions array and -return true (returning false makes no sense). +'APIQueryRecentChangesTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +Use this hook to add custom tokens to list=recentchanges. Every token has an +action, which will be used in the rctoken parameter and in the output +(actiontoken="..."), and a callback function which should return the token, or +false if the user isn't allowed to obtain it. The prototype of the callback +function is func($pageid, $title, $rc), where $pageid is the page ID of the +page associated to the revision the token is requested for, $title the +associated Title object and $rc the associated RecentChange object. In the +hook, just add your callback to the $tokenFunctions array and return true +(returning false makes no sense). $tokenFunctions: array(action => callback) 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the @@ -436,13 +446,19 @@ $module: the current ApiQuerySiteInfo module sites statistics information. &$results: array of results, add things here -'APIQueryUsersTokens': Use this hook to add custom token to list=users. Every -token has an action, which will be used in the ustoken parameter and in the -output (actiontoken="..."), and a callback function which should return the -token, or false if the user isn't allowed to obtain it. The prototype of the -callback function is func($user) where $user is the User object. In the hook, -just add your callback to the $tokenFunctions array and return true (returning -false makes no sense). +'ApiQueryTokensRegisterTypes': Use this hook to add additional token types to +action=query&meta=tokens. Note that most modules will probably be able to use +the 'csrf' token instead of creating their own token types. +&$salts: array( type => salt to pass to User::getEditToken() ) + +'APIQueryUsersTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +Use this hook to add custom token to list=users. Every token has an action, +which will be used in the ustoken parameter and in the output +(actiontoken="..."), and a callback function which should return the token, or +false if the user isn't allowed to obtain it. The prototype of the callback +function is func($user) where $user is the User object. In the hook, just add +your callback to the $tokenFunctions array and return true (returning false +makes no sense). $tokenFunctions: array(action => callback) 'ApiMain::onException': Called by ApiMain::executeActionWithErrorHandling() when @@ -456,11 +472,18 @@ key for the array that represents the service data. In this data array, the key-value-pair identified by the apiLink key is required. &$apis: array of services -'ApiTokensGetTokenTypes': Use this hook to extend action=tokens with new token -types. +'ApiTokensGetTokenTypes': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +Use this hook to extend action=tokens with new token types. &$tokenTypes: supported token types in format 'type' => callback function used to retrieve this type of tokens. +'Article::MissingArticleConditions': Before fetching deletion & move log entries +to display a message of a non-existing page being deleted/moved, give extensions +a chance to hide their (unrelated) log entries. +&$conds: Array of query conditions (all of which have to be met; conditions will +AND in the final query) +$logTypes: Array of log types being queried + 'ArticleAfterFetchContent': After fetching content of an article from the database. DEPRECATED, use ArticleAfterFetchContentObject instead. $article: the article (object) being loaded from the database @@ -519,6 +542,7 @@ $wikiPage: WikiPage (object) being modified Wiki::articleFromTitle(). $title: Title (object) used to create the article object $article: Article (object) that will be returned +$context: IContextSource (object) 'ArticleInsertComplete': After a new article is created. DEPRECATED, use PageContentInsertComplete. @@ -609,6 +633,7 @@ $title: Title corresponding to the article restored $create: Whether or not the restoration caused the page to be created (i.e. it didn't exist before). $comment: The comment associated with the undeletion. +$oldPageId: ID of page previously deleted (from archive table) 'ArticleUndeleteLogEntry': When a log entry is generated but not yet saved. $pageArchive: the PageArchive object @@ -681,6 +706,12 @@ pages or galleries in category pages. $name: Image name being checked &$bad: Whether or not the image is "bad" +'BaseTemplateAfterPortlet': After output of portlets, allow injecting +custom HTML after the section. Any uses of the hook need to handle escaping. +$template BaseTemplate +$portlet: string portlet name +&$html: string + 'BeforeDisplayNoArticleText': Before displaying message key "noarticletext" or "noarticletext-nopermission" at Article::showMissingArticle(). $article: article object @@ -698,6 +729,13 @@ $mediaWiki: Mediawiki object &$out: OutputPage object &$skin: Skin object +'BeforeHttpsRedirect': Prior to forcing HTTP->HTTPS redirect. Gives a chance to +override how the redirect is output by modifying, or by returning false, and +letting standard HTTP rendering take place. +ATTENTION: This hook is likely to be removed soon due to overall design of the system. +$context: IContextSource object +&$redirect: string URL, modifiable + 'BeforePageRedirect': Prior to sending an HTTP redirect. Gives a chance to override how the redirect is output by modifying, or by returning false and taking over the output. @@ -753,6 +791,7 @@ $block: Block object (which is set to be autoblocking) 'BlockIp': Before an IP address or user is blocked. $block: the Block object about to be saved $user: the user _doing_ the block (not the one being blocked) +&$reason: if the hook is aborted, the error message to be returned in an array 'BlockIpComplete': After an IP address or user is blocked. $block: the Block object that was saved @@ -765,7 +804,7 @@ $output: OutputPage object in use 'CanIPUseHTTPS': Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS. $ip: The IP address in human-readable form -&$canDo: This reference should be set to false if the client may not be able +&$canDo: This reference should be set to false if the client may not be able to use HTTPS 'CanonicalNamespaces': For extensions adding their own namespaces or altering @@ -804,6 +843,34 @@ ChangePassword form via the Preferences form. $unpatrolled: Whether or not we are showing unpatrolled changes. $watched: Whether or not the change is watched by the user. +'ChangesListInitRows': Batch process change list rows prior to rendering. +$changesList: ChangesList instance +$rows: The data that will be rendered. May be a ResultWrapper instance or + an array. + +'ChangesListSpecialPageFilters': Called after building form options on pages inheriting from ChangesListSpecialPage (in core: RecentChanges, RecentChangesLinked and Watchlist). +$special: ChangesListSpecialPage instance +&$filters: associative array of filter definitions. The keys are the HTML + name/URL parameters. Each key maps to an associative array with a 'msg' + (message key) and a 'default' value. + +'ChangesListSpecialPageQuery': Called when building SQL query on pages inheriting from ChangesListSpecialPage (in core: RecentChanges, RecentChangesLinked and Watchlist). +$name: name of the special page, e.g. 'Watchlist' +&$tables: array of tables to be queried +&$fields: array of columns to select +&$conds: array of WHERE conditionals for query +&$query_options: array of options for the database request +&$join_conds: join conditions for the tables +$opts: FormOptions for this request + +'LoginUserMigrated': Called during login to allow extensions the opportunity to +inform a user that their username doesn't exist for a specific reason, instead +of letting the login form give the generic error message that the account does +not exist. For example, when the account has been renamed or deleted. +$user: the User object being authenticated against. +&$msg: the message identifier for abort reason, or an array to pass a message + key and parameters. + 'Collation::factory': Called if $wgCategoryCollation is an unknown collation. $collationName: Name of the collation in question &$collationObject: Null. Replace with a subclass of the Collation class that @@ -823,6 +890,28 @@ content model name, but no entry for that model exists in $wgContentHandlers. $modeName: the requested content model name &$handler: set this to a ContentHandler object, if desired. +'ContentModelCanBeUsedOn': Called to determine whether that content model can +be used on a given page. This is especially useful to prevent some content models +to be used in some special location. +$contentModel: ID of the content model in question +$title: the Title in question. +&$ok: Output parameter, whether it is OK to use $contentModel on $title. +Handler functions that modify $ok should generally return false to prevent further +hooks from further modifying $ok. + +'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. +$content: The Content to render +$title: Title of the page, as context +$revId: The revision ID, as context +$options: ParserOptions for rendering. To avoid confusing the parser cache, +the output can only depend on parameters provided to this hook function, not on global state. +$generateHtml: boolean, indicating whether full HTML should be generated. If false, +generation of HTML may be skipped, but other information should still be present in the +ParserOutput object. +&$output: ParserOutput, to manipulate or replace + 'ConvertContent': Called by AbstractContent::convert when a conversion to another content model is requested. $content: The Content object to be converted. @@ -875,8 +964,9 @@ $new: the ?new= param value from the url 'DiffRevisionTools': Override or extend the revision tools available from the diff view, i.e. undo, etc. -$rev: Revision object +$newRev: Revision object of the "new" revision &$links: Array of HTML links +$oldRev: Revision object of the "old" revision (may be null) 'DiffViewHeader': Called before diff display $diff: DifferenceEngine object that's calling @@ -891,7 +981,7 @@ $oldid: oldid (int) being viewed 'DoEditSectionLink': Override the HTML generated for section edit links $skin: Skin object rendering the UI $title: Title object for the title being linked to (may not be the same as - $wgTitle, if the section is included from a template) + the page title, if the section is included from a template) $section: The designation of the section being pointed to, to be included in the link, like "§ion=$section" $tooltip: The default tooltip. Escape before using. @@ -960,6 +1050,12 @@ yourself. Alternatively, modifying $error and returning true will cause the contents of $error to be echoed at the top of the edit form as wikitext. Return true without altering $error to allow the edit to proceed. +'EditPage::showReadOnlyForm:initial': similar to EditPage::showEditForm:initial +but for the read-only 'view source' variant of the edit form. +$editor: EditPage instance (object) +&$out: an OutputPage instance to write to +return value is ignored (should always return true) + 'EditPage::showStandardInputs:options': allows injection of form fields into the editOptions area $editor: EditPage instance (object) @@ -1157,6 +1253,16 @@ $title: Title object that we need to get a sortkey for underscore) magic words. Called by MagicWord. &$doubleUnderscoreIDs: array of strings +'GetExtendedMetadata': Get extended file metadata for the API +&$combinedMeta: Array of the form: 'MetadataPropName' => array( +'value' => prop value, 'source' => 'name of hook' ). +$file: File object of file in question +$context: RequestContext (including language to use) +$single: Only extract the current language; if false, the prop value should +be in the metadata multi-language array format: +mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format +&$maxCacheTime: how long the results can be cached + 'GetFullURL': Modify fully-qualified URLs used in redirects/export/offsite data. $title: Title object of page $url: string value as output (out parameter, can modify) @@ -1203,6 +1309,9 @@ without any fancy queries or variants. $title: Title object of page &$url: string value as output (out parameter, can modify) +'GetLogTypesOnUser': Add log types where the target is a userpage +&$types: Array of log types + 'GetMetadataVersion': Modify the image metadata version currently in use. This is used when requesting image metadata from a ForeignApiRepo. Media handlers that need to have versioned metadata should add an element to the end of the @@ -1267,6 +1376,10 @@ page history view, i.e. undo, rollback, etc. $rev: Revision object &$links: Array of HTML links +'HTMLFileCache::useFileCache': Override whether a page should be cached in file +cache. +$context: An IContextSource object with information about the request being served. + 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki image insertion. You can skip the default logic entirely by returning false, or just modify a few things using call-by-reference. @@ -1349,7 +1462,7 @@ $context: IContextSource object &$pageInfo: Array of information 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect. -$title: Title object ($wgTitle) +$title: Title object for the current page $request: WebRequest $ignoreRedirect: boolean to skip redirect check $target: Title/string of redirect target @@ -1383,6 +1496,7 @@ $user: user (object) whose email is being invalidated Callee may modify $url and $query, URL will be constructed as $url . $query &$url: URL to index.php &$query: Query string +$rc: RecentChange object that triggered url generation 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true) $article: article (object) being checked @@ -1395,7 +1509,7 @@ $result: Change this value to override the result of wfIsTrustedProxy() $url: URL used to upload from &$allowed: Boolean indicating if uploading is allowed for given URL -'isValidEmailAddr': Override the result of User::isValidEmailAddr(), for +'isValidEmailAddr': Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization. $addr: The e-mail address entered by the user &$result: Set this and return false to override the internal checks @@ -1440,6 +1554,10 @@ $title: The page's Title. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. +'LanguageSelector': Hook to change the language selector available on a page. +$out: The output page. +$cssClassName: CSS class name of the language selector. + 'LinkBegin': Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on @@ -1483,6 +1601,14 @@ before the return. &$attribs: the attributes to be applied. $linkType: The external link type +'LinkerMakeMediaLinkFile': At the end of Linker::makeMediaLinkFile() just +before the return. +$title: the Title object that the link is pointing to +$file: the File object or false if broken link +&$html: the link text +&$attribs: the attributes to be applied +&$ret: the value to return if your hook returns false + 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the actual update. &$linksUpdate: the LinksUpdate object @@ -1523,6 +1649,24 @@ cache. $cache: The LocalisationCache object $code: language code &$alldata: The localisation data from core and extensions +&purgeBlobs: whether to purge/update the message blobs via MessageBlobStore::clear() + +'LocalisationCacheRecacheFallback': Called for each language when merging +fallback data into the cache. +$cache: The LocalisationCache object +$code: language code +&$alldata: The localisation data from core and extensions. Note some keys may + be omitted if they won't be merged into the final result. + +'LocalisationChecksBlacklist': When fetching the blacklist of +localisation checks. +&$blacklist: array of checks to blacklist. See the bottom of + maintenance/language/checkLanguage.inc for the format of this variable. + +'LocalisationIgnoredOptionalMessages': When fetching the list of ignored and +optional localisation messages +&$ignored Array of ignored message keys +&$optional Array of optional message keys 'LogEventsListShowLogExtract': Called before the string is added to OutputPage. Returning false will prevent the string from being added to the OutputPage. @@ -1553,6 +1697,11 @@ $password: the password being submitted and found wanting $retval: a LoginForm class constant with authenticateUserData() return value (SUCCESS, WRONG_PASS, etc.). +'LoginPasswordResetMessage': User is being requested to reset their password on login. +Use this hook to change the Message that will be output on Special:ChangePassword. +&$msg: Message object that will be shown to the user +$username: Username of the user who's password was expired. + 'LogLine': Processes a single log entry on Special:Log. $log_type: string for the type of log entry (e.g. 'move'). Corresponds to logging.log_type database field. @@ -1567,6 +1716,12 @@ $paramArray: Array of parameters that corresponds to logging.log_params field. &$revert: string that is displayed in the UI, similar to $comment. $time: timestamp of the log entry (added in 1.12) +'LonelyPagesQuery': Allow extensions to modify the query used by +Special:LonelyPages. +&$tables: tables to join in the query +&$conds: conditions for the query +&$joinConds: join conditions for the query + 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance script. $refreshLinks: RefreshLinks object @@ -1574,8 +1729,8 @@ $refreshLinks: RefreshLinks object 'MagicWordwgVariableIDs': When defining new magic words IDs. $variableIDs: array of strings -'MakeGlobalVariablesScript': Called right before Skin::makeVariablesScript is -executed. Ideally, this hook should only be used to add variables that depend on +'MakeGlobalVariablesScript': Called at end of OutputPage::getJSVars. +Ideally, this hook should only be used to add variables that depend on the current page/request; static configuration should be added through ResourceLoaderGetConfigVars instead. &$vars: variable (or multiple variables) to be added into the output of @@ -1598,8 +1753,8 @@ $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a something completely different, after the basic globals have been set up, but before ordinary actions take place. $output: $wgOut -$article: $wgArticle -$title: $wgTitle +$article: Article on which the action will be performed +$title: Title on which the action will be performed $user: $wgUser $request: $wgRequest $mediaWiki: The $mediawiki object @@ -1608,11 +1763,41 @@ $mediaWiki: The $mediawiki object $title: title of the message (string) $message: value (string), change it to the message you want to define +'MessageCache::get': When fetching a message. Can be used to override the key +for customisations. Given and returned message key must be in special format: +1) first letter must be in lower case according to the content language. +2) spaces must be replaced with underscores +&$key: message key (string) + 'MessageCacheReplace': When a message page is changed. Useful for updating caches. $title: name of the page changed. $text: new contents of the page. +'MimeMagicInit': Before processing the list mapping MIME types to media types +and the list mapping MIME types to file extensions. +As an extension author, you are encouraged to submit patches to MediaWiki's +core to add new MIME types to mime.types. +$mimeMagic: Instance of MimeMagic. + Use $mimeMagic->addExtraInfo( $stringOfInfo ); + for adding new MIME info to the list. + Use $mimeMagic->addExtraTypes( $stringOfTypes ); + for adding new MIME types to the list. + +'MimeMagicImproveFromExtension': Allows MW extensions to further improve the +MIME type detected by considering the file extension. +$mimeMagic: Instance of MimeMagic. +$ext: File extension. +&$mime: MIME type (in/out). + +'MimeMagicGuessFromContent': Allows MW extensions guess the MIME by content. +$mimeMagic: Instance of MimeMagic. +&$head: First 1024 bytes of the file in a string (in - Do not alter!). +&$tail: More or equal than last 65558 bytes of the file in a string + (in - Do not alter!). +$file: File path. +&$mime: MIME type (out). + 'ModifyExportQuery': Modify the query used by the exporter. $db: The database object to be queried. &$tables: Tables in the query. @@ -1620,13 +1805,6 @@ $db: The database object to be queried. &$opts: Options for the query. &$join_conds: Join conditions for the query. -'MonoBookTemplateToolboxEnd': DEPRECATED. Called by Monobook skin after toolbox -links have been rendered (useful for adding more). Note: this is only run for -the Monobook skin. To add items to the toolbox you should use the -SkinTemplateToolboxEnd hook instead, which works for all "SkinTemplate"-type -skins. -$tools: array of tools - 'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array and returning it for the skin to output. You can add items to the toolbox while still letting the skin make final decisions on skin-specific markup conventions @@ -1743,7 +1921,7 @@ $isMinor: Whether or not the edit was marked as minor $isWatch: (No longer used) $section: (No longer used) $flags: Flags passed to WikiPage::doEditContent() -$revision: New Revision of the article +$revision: New Revision of the article (can be null for edits that change nothing) $status: Status object about to be returned by doEditContent() $baseRevId: the rev ID (or false) this edit was based on @@ -1751,7 +1929,7 @@ $baseRevId: the rev ID (or false) this edit was based on $article: the article that the history is loading for $context: RequestContext object -'PageHistoryLineEnding' : Right before the end <li> is added to a history line. +'PageHistoryLineEnding': Right before the end <li> is added to a history line. $row: the revision row for this line $s: the string representing this parsed line $classes: array containing the <li> element classes @@ -1764,7 +1942,8 @@ $queryInfo: the query parameters 'PageRenderingHash': Alter the parser cache option hash key. A parser extension which depends on user options should install this hook and append its values to the key. -$hash: reference to a hash key string which can be modified +&$confstr: reference to a hash key string which can be modified +$user: User (object) requesting the page 'ParserAfterParse': Called from Parser::parse() just after the call to Parser::internalParse() returns. @@ -1837,7 +2016,7 @@ needs formatting. If nothing handles this hook, the default is to use "$key" to get the label, and "$key-value" or "$key-value-text"/"$key-value-html" to format the value. $key: Key for the limit report item (string) -$value: Value of the limit report item +&$value: Value of the limit report item &$report: String onto which to append the data $isHTML: If true, $report is an HTML table with two columns; if false, it's text intended for display in a monospaced font. @@ -1845,7 +2024,8 @@ $localize: If false, $report should be output in English. 'ParserLimitReportPrepare': Called at the end of Parser:parse() when the parser will include comments about size of the text parsed. Hooks should use -$output->setLimitReportData() to populate data. +$output->setLimitReportData() to populate data. Functions for this hook should +not use $wgLang; do that in ParserLimitReportFormat instead. $parser: Parser object $output: ParserOutput object @@ -1883,6 +2063,7 @@ that tests continue to run properly. my talk page, my contributions" etc). &$personal_urls: Array of link specifiers (see SkinTemplate.php) &$title: Title object representing the current page +$skin: SkinTemplate object providing context (e.g. to check if the user is logged in, etc.) 'PingLimiter': Allows extensions to override the results of User::pingLimiter(). &$user : User performing the action @@ -1899,12 +2080,28 @@ $oldtext : the text of the article before editing $subject : subject of the new section &$text : text of the new section +'PostLoginRedirect': Modify the post login redirect behavior. +Occurs after signing up or logging in, allows for interception of redirect. +&$returnTo: The page name to return to, as a string +&$returnToQuery: array of url parameters, mapping parameter names to values +&$type: type of login redirect as string; + error: display a return to link ignoring $wgRedirectOnLogin + signup: display a return to link using $wgRedirectOnLogin if needed + success: display a return to link using $wgRedirectOnLogin if needed + successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed + 'PreferencesGetLegend': Override the text used for the <legend> of a preferences section. $form: the PreferencesForm object. This is a ContextSource as well $key: the section name &$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may be overridden +'PreferencesFormPreSave': Override preferences being saved + $formData: array of user submitted data + $form: PreferencesForm object, also a ContextSource + $user: User object with preferences to be saved set + &$result: boolean indicating success + 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and AJAX search suggestions. Put results into &$results outparam and return false. $ns : array of int namespace keys to search in @@ -1939,7 +2136,7 @@ $article: the page the form is shown for $out: OutputPage object 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw. -&$obj: RawPage object +&$obj: RawAction object &$text: The text that's going to be the output 'RecentChange_save': Called at the end of RecentChange::save(). @@ -1957,22 +2154,20 @@ IContextSource $context: The RequestContext the skin is being created for. &$skin: A variable reference you may set a Skin instance or string key on to override the skin that will be used for the context. +'ResetPasswordExpiration': Allow extensions to set a default password expiration +$user: The user having their password expiration reset +&$newExpire: The new expiration date + 'ResetSessionID': Called from wfResetSessionID $oldSessionID: old session id $newSessionID: new session id 'ResourceLoaderGetConfigVars': Called at the end of -ResourceLoaderStartUpModule::getConfig(). Use this to export static +ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static configuration variables to JavaScript. Things that depend on the current page or request state must be added through MakeGlobalVariablesScript instead. &$vars: array( variable name => value ) -'ResourceLoaderGetStartupModules': Run once the startup module is being -generated. This allows you to add modules to the startup module. This hook -should be used sparingly since any module added here will be loaded on all -pages. This hook is useful if you want to make code available to module loader -scripts. - 'ResourceLoaderRegisterModules': Right before modules information is required, such as when responding to a resource loader request or generating HTML output. @@ -2022,12 +2217,6 @@ searches. $term : Search term string &$title : Current Title object that is being returned (null if none found). -'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes(). -$searchEngine : The SearchEngine object. Users of this hooks will be interested -in the $searchEngine->namespaces array. -$query : Original query. -&$parsed : Resultant query with the prefixes stripped. - 'SearchResultInitFromTitle': Set the revision used when displaying a page in search results. $title : Current Title object being displayed in search results. @@ -2036,13 +2225,21 @@ $title : Current Title object being displayed in search results. 'SearchableNamespaces': An option to modify which namespaces are searchable. &$arr : Array of namespaces ($nsId => $name) which will be used. +'SelfLinkBegin': Called before a link to the current article is displayed to +allow the display of the link to be customized. +$nt: the Title object +&$html: html to display for the link +&$trail: optional text to display before $html +&$prefix: optional text to display after $html +&$ret: the value to return if your hook returns false + 'SetupAfterCache': Called in Setup.php, after cache objects are set 'ShowMissingArticle': Called when generating the output for a non-existent page. $article: The article object corresponding to the page 'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views. -DEPRECATED, use the ContentHandler facility to handle CSS and JavaScript! +DEPRECATED, use the ContentGetParserOutput hook instead! $text: Text being shown $title: Title of the custom script/stylesheet page $output: Current OutputPage object @@ -2097,6 +2294,12 @@ $skin: Skin object &$bar: Sidebar contents Modify $bar to add or modify sidebar portlets. +'SidebarBeforeOutput': Allows to edit sidebar just before its output by skins. +$skin Skin object +&$bar: Sidebar content +Modify $bar to add or modify sidebar portlets. +Warning: This hook is run on each display. You should consider to use 'SkinBuildSidebar' that is aggressively cached. + 'SkinCopyrightFooter': Allow for site and per-namespace customization of copyright notice. $title: displayed page title @@ -2105,12 +2308,18 @@ $type: 'normal' or 'history' for old/diff views message must be in HTML format, not wikitext! &$link: overridable HTML link to be passed into the message as $1 &$forContent: overridable flag if copyright footer is shown in content language. + This parameter is deprecated. 'SkinGetPoweredBy': TODO &$text: additional 'powered by' icons in HTML. Note: Modern skin does not use the MediaWiki icon but plain text instead. $skin: Skin object +'SkinPreloadExistence': Supply titles that should be added to link existence +cache before the page is rendered. +&$titles: Array of Title objects +$skin: Skin object + 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle(). &$subpages: Subpage links HTML $skin: Skin object @@ -2125,6 +2334,14 @@ link" tab. $sktemplate: SkinTemplate object $nav_urls: array of tabs +'SkinTemplateGetLanguageLink': After building the data for a language link from +which the actual html is constructed. +&$languageLink: array containing data about the link. The following keys can be + modified: href, text, title, class, lang, hreflang. Each of them is a string. +$languageLinkTitle: Title object belonging to the external language link. +$title: Title object of the page the link belongs to. +$outputPage: The OutputPage object the links are built from. + To alter the structured navigation links in SkinTemplates, there are three hooks called in different spots: @@ -2173,8 +2390,18 @@ software. $software: The array of software in format 'name' => 'version'. See SpecialVersion::softwareInformation(). +'SpecialPageBeforeFormDisplay': Before executing the HTMLForm object. +$name: name of the special page +&$form: HTMLForm object + +'SpecialBlockModifyFormFields': Add more fields to Special:Block +$sp: SpecialPage object, for context +&$fields: Current HTMLForm fields + 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions -$id: User identifier +$id: User id number, only provided for backwards-compatibility +$user: User object representing user contributions are being fetched for +$sp: SpecialPage instance, providing context 'SpecialListusersDefaultQuery': Called right before the end of UsersPager::getDefaultQuery(). @@ -2221,7 +2448,7 @@ $special: the special page object name/URL parameters. Each key maps to an associative array with a 'msg' (message key) and a 'default' value. -'SpecialPage_initList': Called when setting up SpecialPage::$mList, use this +'SpecialPage_initList': Called when setting up SpecialPageFactory::$list, use this hook to remove a core special page. $list: list (array) of core special pages @@ -2251,7 +2478,7 @@ use this to change some selection criteria or substitute a different title. result from the normal query 'SpecialRecentChangesFilters': Called after building form options at -RecentChanges. +RecentChanges. Deprecated, use ChangesListSpecialPageFilters instead. $special: the special page object &$filters: associative array of filter definitions. The keys are the HTML name/URL parameters. Each key maps to an associative array with a 'msg' @@ -2263,7 +2490,8 @@ SpecialRecentChanges. $opts: FormOptions for this request 'SpecialRecentChangesQuery': Called when building SQL query for -SpecialRecentChanges and SpecialRecentChangesLinked. +SpecialRecentChanges and SpecialRecentChangesLinked. Deprecated, use +ChangesListSpecialPageQuery instead. &$conds: array of WHERE conditionals for query &$tables: array of tables to be queried &$join_conds: join conditions for the tables @@ -2281,10 +2509,6 @@ go to the existing page. $t: title object searched for &$params: an array of the default message name and page title (as parameter) -'SpecialSearchGo': Called when user clicked the "Go". -&$title: title object generated from the text entered by the user -&$term: the search term entered by the user - 'SpecialSearchNogomatch': Called when user clicked the "Go" button but the target doesn't exist. &$title: title object generated from the text entered by the user @@ -2318,24 +2542,11 @@ $specialSearch: SpecialSearch object ($this) $output: $wgOut $term: Search term specified by the user -'SpecialSearchResultsAppend': 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). -$specialSearch: SpecialSearch object ($this) -$output: $wgOut -$term: Search term specified by the user - -'SpecialSearchResults': Called before search result display when there are -matches. +'SpecialSearchResults': Called before search result display $term: string of search term &$titleMatches: empty or SearchResultSet object &$textMatches: empty or SearchResultSet object -'SpecialSearchNoResults': Called before search result display when there are no -matches. -$term: string of search term - 'SpecialStatsAddExtra': Add extra statistic at the end of Special:Statistics. &$extraStats: Array to save the new stats ( $extraStats['<name of statistic>'] => <value>; ) @@ -2344,29 +2555,27 @@ $term: string of search term Special:Upload. $form: The SpecialUpload object -'SpecialVersionExtensionTypes': Called when generating the extensions credits, -use this to change the tables headers. -$extTypes: associative array of extensions types - 'SpecialVersionVersionUrl': Called when building the URL for Special:Version. $wgVersion: Current $wgVersion for you to use &$versionUrl: Raw url to link to (eg: release notes) 'SpecialWatchlistFilters': Called after building form options at Watchlist. +Deprecated, use ChangesListSpecialPageFilters instead. $special: the special page object &$filters: associative array of filter definitions. The keys are the HTML name/URL parameters. Each key maps to an associative array with a 'msg' (message key) and a 'default' value. 'SpecialWatchlistQuery': Called when building sql query for SpecialWatchlist. +Deprecated, use ChangesListSpecialPageQuery instead. &$conds: array of WHERE conditionals for query &$tables: array of tables to be queried &$join_conds: join conditions for the tables &$fields: array of query fields -$values: array of variables with watchlist options +$opts: A FormOptions object with watchlist options for the current request 'SpecialWatchlistGetNonRevisionTypes': Called when building sql query for -SpecialWatchlist. Allows extensions to register custom values they have +SpecialWatchlist. Allows extensions to register custom values they have inserted to rc_type so they can be returned as part of the watchlist. &$nonRevisionTypes: array of values in the rc_type field of recentchanges table @@ -2389,6 +2598,10 @@ database result. &$titleArray: set this to an object to override the default object returned $res: database result used to create the object +'TitleExists': Called when determining whether a page exists at a given title. +$title: The title being tested. +&$exists: Whether the title exists. + 'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to or override the quick permissions check. $title: The Title object being accessed @@ -2447,6 +2660,7 @@ $nt: new title $user: user who did the move $pageid: database ID of the page that's been moved $redirid: database ID of the created redirect +$reason: reason for the move 'TitleReadWhitelist': Called at the end of read permissions checks, just before adding the default error message if nothing allows the user to read the page. If @@ -2456,7 +2670,7 @@ $user: Current user object &$whitelisted: Boolean value of whether this title is whitelisted 'TitleSquidURLs': Called to determine which URLs to purge from HTTP caches. -$this: Title object to purge +$title: Title object to purge &$urls: An array of URLs to purge from the caches, to be manipulated. 'UndeleteForm::showHistory': Called in UndeleteForm::showHistory, after a @@ -2485,8 +2699,10 @@ actions). $action: action name $article: article "acted on" -'UnitTestsList': Called when building a list of files with PHPUnit tests. -&$files: list of files +'UnitTestsList': Called when building a list of paths containing PHPUnit tests. +Since 1.24: Paths pointing to a directory will be recursively scanned for +test case files matching the suffix "Test.php". +&$paths: list of test cases and directories to search. 'UnwatchArticle': Before a watch is removed from an article. $user: user watching @@ -2535,11 +2751,11 @@ string &$error: output: message key for message to show if upload canceled by returning false. May also be an array, where the first element is the message key and the remaining elements are used as parameters to the message. -'UploadVerifyFile': extra file verification, based on mime type, etc. Preferred +'UploadVerifyFile': extra file verification, based on MIME type, etc. Preferred in most cases over UploadVerification. object $upload: an instance of UploadBase, with all info about the upload -string $mime: The uploaded file's mime type, as detected by MediaWiki. Handlers - will typically only apply for specific mime types. +string $mime: The uploaded file's MIME type, as detected by MediaWiki. Handlers + will typically only apply for specific MIME types. object &$error: output: true if the file is valid. Otherwise, an indexed array representing the problem with the file, where the first element is the message key and the remaining elements are used as parameters to the message. @@ -2579,27 +2795,11 @@ $user: User (object) whose permission is being checked 'UserClearNewTalkNotification': Called when clearing the "You have new messages!" message, return false to not delete it. $user: User (object) that will clear the message - -'UserComparePasswords': Called when checking passwords, return false to -override the default password checks. -&$hash: String of the password hash (from the database) -&$password: String of the plaintext password the user entered -&$userId: Integer of the user's ID or Boolean false if the user ID was not - supplied -&$result: If the hook returns false, this Boolean value will be checked to - determine if the password was valid +$oldid: ID of the talk page revision being viewed (0 means the most recent one) 'UserCreateForm': change to manipulate the login form $template: SimpleTemplate instance for the form -'UserCryptPassword': Called when hashing a password, return false to implement -your own hashing method. -&$password: String of the plaintext password to encrypt -&$salt: String of the password salt or Boolean false if no salt is provided -&$wgPasswordSalt: Boolean of whether the salt is used in the default hashing - method -&$hash: If the hook returns false, this String will be used as the hash - 'UserEffectiveGroups': Called in User::getEffectiveGroups(). $user: User to get groups for &$groups: Current effective groups @@ -2709,6 +2909,15 @@ to be switched to HTTPS. $user: User in question. &$https: Boolean whether $user should be switched to HTTPS. +'UserResetAllOptions': Called in User::resetOptions() when user preferences +have been requested to be reset. This hook can be used to exclude certain +options from being reset even when the user has requested all prefs to be reset, +because certain options might be stored in the user_properties database table +despite not being visible and editable via Special:Preferences. +$user: the User (object) whose preferences are being reset +&$newOptions: array of new (site default) preferences +$options: array of the user's old preferences +$resetKinds: array containing the kinds of preferences to reset 'UserRetrieveNewTalks': Called when retrieving "You have new messages!" message(s). @@ -2743,6 +2952,17 @@ $userId: User id of the current user $userText: User name of the current user &$items: Array of user tool links as HTML fragments +'ValidateExtendedMetadataCache': Called to validate the cached metadata in +FormatMetadata::getExtendedMeta (return false means cache will be +invalidated and GetExtendedMetadata hook called again). +$timestamp: The timestamp metadata was generated +$file: The file the metadata is for + +'UserMailerChangeReturnPath': Called to generate a VERP return address +when UserMailer sends an email, with a bounce handling extension. +$to: Array of MailAddress objects for the recipients +&$returnPath: The return address string + 'WantedPages::getQueryInfo': Called in WantedPagesPage::getQueryInfo(), can be used to alter the SQL query which gets the list of wanted pages. &$wantedPages: WantedPagesPage object @@ -2757,12 +2977,18 @@ $page: WikiPage object to be watched $user: user that watched $page: WikiPage object watched +'WatchlistEditorBeforeFormRender': Before building the Special:EditWatchlist +form, used to manipulate the list of pages or preload data based on that list. +&$watchlistInfo: array of watchlisted pages in + [namespaceId => ['title1' => 1, 'title2' => 1]] format + 'WatchlistEditorBuildRemoveLine': when building remove lines in Special:Watchlist/edit. &$tools: array of extra links $title: Title object $redirect: whether the page is a redirect $skin: Skin object +&$link: HTML link to title 'WebRequestPathInfoRouter': While building the PathRouter to parse the REQUEST_URI. @@ -2775,6 +3001,12 @@ Return false to prevent setting of the cookie. &$expire: Cookie expiration, as for PHP's setcookie() $options: Options passed to WebResponse::setcookie() +'WhatLinksHereProps': Allows annotations to be added to WhatLinksHere +$row: The DB row of the entry. +$title: The Title of the page where the link comes FROM +$target: The Title of the page where the link goes TO +&$props: Array of HTML strings to display after the title. + 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions dumps. One, and only one hook should set this, and return false. &$tables: Database tables to use in the SELECT query @@ -2796,9 +3028,9 @@ run a MediaWiki cli script. &$options: Associative array of options, may contain the 'php' and 'wrapper' keys -'wgQueryPages': Called when initialising $wgQueryPages, use this to add new -query pages to be updated with maintenance/updateSpecialPages.php. -$query: $wgQueryPages itself +'wgQueryPages': Called when initialising list of QueryPage subclasses, use this +to add new query pages to be updated with maintenance/updateSpecialPages.php. +$qp: The list of QueryPages 'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow extra metadata to be added. @@ -2826,4 +3058,4 @@ data. Can be used to post-process the results. of values). More hooks might be available but undocumented, you can execute -'php maintenance/findHooks.php' to find hidden ones. +"php maintenance/findHooks.php" to find hidden ones. |