Predefinição:MediaWikiHook

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Template:MediaWikiHook and the translation is 100% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎dansk • ‎español • ‎français • ‎polski • ‎português do Brasil • ‎română • ‎čeština • ‎македонски • ‎русский • ‎العربية • ‎नेपाली • ‎中文 • ‎日本語
Documentação da predefinição

Predefinição para copiar e colar

MyHook
Disponível a partir da version ???

Função de definição:
public static function onMyHook( $x, $y ) { ... }
Anexar hook: Na extension.json:
{
	"Hooks": {
		"MyHook": "MyExtensionHooks::onMyHook"
	}
}
Chamado a partir de: Arquivo(s):
Interface: MyHookHook.php

Para mais informações sobre anexar hooks, consulte Manual:Ganchos .
Para exemplos de extensões que usam este hook, consulte Category:MyHook extensions/pt-br.

{{MediaWikiHook
|name = MyHook
|version =
|gerrit =
|removed =
|summary =
|args = $x, $y
|source =
|sourcefunction =
|sourceclass =
|newvarname =
|newvarlink =
|nocatdesc =
}}

Notas de uso

[ver · discutir · editar]

This is the TemplateData documentation for this template used by VisualEditor and other tools.

MediaWikiHook

A card which describes the information of a MediaWiki-registered hook.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Template modetemplatemode

Set to nocats if hook documentation should not appear in standard MediaWiki Categories. By default, using this template places the documentation page into categories: MediaWiki hooks Hooks added in MediaWiki... There are times when it is undesirable to automatically categorize the hook documentation. Examples would include when documenting a hook in an extension, or when documenting the template itself.

Stringoptional
Namename

The name of the hook. This is usually the same name as the sub-page.

Stringoptional
Versionversion

The version of MediaWiki this hook was first introduced in.

Stringsuggested
Version removedremoved

If the hook has been removed, the version of MediaWiki that it was removed in.

Stringoptional
Message for removed hookremoved-msg

If it is not suitable to use either the "newvarname" or the "newvarlink" template parameter, use this parameter. This parameter can be used to explain why it was removed, or for example, explain why there is no suitable replacement.

Stringoptional
Version deprecateddeprecated

If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in.

Stringoptional
Message for deprecated hookdeprecated-msg

If it is not suitable to use either the "newvarname" or the "newvarlink" template parameter, use this parameter. This parameter can be used to explain why it was removed, or for example, explain why there is no suitable replacement.

Stringoptional
New variable namenewvarname

For removed or deprecated hooks, the name of the hook that should be used instead

Stringoptional
New variable linknewvarlink

For removed or deprecated hooks, the link to the hook that should be used instead

Page nameoptional
SVN revision introducedrev

SVN revision in which this hook was first introduced. If this parameter is given, it'll link to the appropriate CodeReview page (e.g. [[phabricator:rSVN1]]).

URLoptional
Gerrit changesetgerrit

Gerrit change number in which this hook was first introduced. If this parameter is given, it'll link to the appropriate Gerrit changeset page (e.g. Gerrit change 1)

URLsuggested
Summarysummary

A short description of the hook's purpose. More detailed descriptions are desirable, and should be added to the main page content. If you update the short description, please also update the two tables on [[Special:MyLanguage/Manual:Hooks]].

Stringrequired
Argumentsargs

The arguments, as used at the top of the function.

Stringrequired
extensionextension

no description

Stringoptional
File source 1source

Location (file name/path not including <code>includes/</code>) which calls this hook in the code. Further locations can be added via source2...source10.

Filesuggested
File source 2source2

see source

Fileoptional
File source 3source3

see source

Fileoptional
File source 4source4

see source

Fileoptional
File source 5source5

see source

Fileoptional
File source 6source6

see source

Fileoptional
File source 7source7

see source

Fileoptional
File source 8source8

see source

Fileoptional
File source 9source9

see source

Fileoptional
File source 10source10

see source

Fileoptional
Function source 1sourcefunction

Name of the function which calls this hook. Another can be added via sourcefunction2.

Stringsuggested
Function source 2sourcefunction2

see sourcefunction

Stringoptional
Class sourcesourceclass

Name of the class which calls this hook.

Stringsuggested
nocatdescnocatdesc

If a hook is removed completely from MediaWiki version by setting yes, it will not show up the category description.

Stringoptional

Encontrando a versão do hook e o ID do Gerrit

Para popular os atributos version e gerrit da predefinição, será necessário encontrar o histórico do arquivo docs/hooks.txt.

  1. (A partir do nível-topo (principal) de um clone do Git do código-fonte do MediaWiki)
  2. Encontre o commit mais antigo ao hooks.txt que mencione o hook:
    • git grep <nome-do-hook-aqui> $(git rev-list --all -- docs/hooks.txt) -- docs/hooks.txt | tail -n 1
  3. Encontre o ID do Gerrit:
    • git log <o-commit-da-etapa-anterior>
    1. Copie o change-id do registro na caixa de pesquisa do Gerrit
    2. Selecione a mudança relevante, e nela estará o ID
  4. Encontre a release na qual o hook foi lançado:
    • git tag --contains <aquele-mesmo-commit>