साँचा:MediaWikiHook
साँचे की प्रतिलिपि बनाएँ और चिपकाएँ
MyHook | |
---|---|
संस्करण ??? से उपलब्ध | |
इस फंक्शन को परिभाषित करें: | public static function onMyHook( $x, $y ) { ... }
|
हुक जोड़ें: | extension.json में:
{
"Hooks": {
"MyHook": "MediaWiki\\Extension\\MyExtension\\Hooks::onMyHook"
}
}
|
यहाँ से बुलाया जाता है: | फाइल(एँ): |
इंटरफेस: | MyHookHook.php |
हुक जोड़ने के बारे में अधिक जानकारी के लिए Manual:Hooks देखें।
इस हुक का उपयोग कर रहे एक्सटेंशनों के उदाहरण के लिए Category:MyHook extensions/hi देखें।
{{MediaWikiHook |name = MyHook |version = |gerrit = |gerritremoved = |removed = |summary = |args = $x, $y |source = |sourcefunction = |sourceclass = |newvarname = |newvarlink = |nocatdesc = }}
उपयोग की टिप्पणियाँ
यह यथादृश्य सम्पादिका और दूसरे उपकरणों द्वारा उपयोग इस साँचे के TemplateData प्रलेख है।
MediaWikiHook
A card which describes the information of a MediaWiki-registered hook.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Template mode | templatemode | 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. | String | optional |
Name | name | The name of the hook. This is usually the same name as the sub-page. | String | optional |
Version | version | The version of MediaWiki this hook was first introduced in. Should always be a full version number (ie. ending with ".0").
| String | suggested |
Version removed | removed | If the hook has been removed, the version of MediaWiki that it was removed in. | String | optional |
Message for removed hook | removed-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. | String | optional |
Version deprecated | deprecated | If the hook has been deprecated (but not removed), the version of MediaWiki that it was deprecated in. | String | optional |
Message for deprecated hook | deprecated-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. | String | optional |
New variable name | newvarname | For removed or deprecated hooks, the name of the hook that should be used instead | String | optional |
New variable link | newvarlink | For removed or deprecated hooks, the link to the hook that should be used instead | Page name | optional |
SVN revision introduced | rev | 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]]).
| URL | optional |
Gerrit changeset | gerrit | 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) | Number | suggested |
Gerrit changeset removed | gerritremoved | Gerrit change number in which this hook was removed. If this parameter is given, it'll link to the appropriate Gerrit changeset page (e.g. Gerrit change 1) | Number | optional |
Summary | summary | 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]]. | String | required |
Arguments | args | The arguments, as used at the top of the function. | String | required |
extension | extension | The extension which defines this hook. | String | optional |
File source 1 | source | Location (file name/path not including <code>includes/</code>) which calls this hook in the code. Further locations can be added via source2...source10. | File | suggested |
File source 2 | source2 | see source | File | optional |
File source 3 | source3 | see source | File | optional |
File source 4 | source4 | see source | File | optional |
File source 5 | source5 | see source | File | optional |
File source 6 | source6 | see source | File | optional |
File source 7 | source7 | see source | File | optional |
File source 8 | source8 | see source | File | optional |
File source 9 | source9 | see source | File | optional |
File source 10 | source10 | see source | File | optional |
Function source 1 | sourcefunction | Name of the function which calls this hook. Another can be added via sourcefunction2. | String | suggested |
Function source 2 | sourcefunction2 | see sourcefunction | String | optional |
Class source | sourceclass | Name of the class which calls this hook. | String | suggested |
nocatdesc | nocatdesc | If a hook is removed completely from MediaWiki version by setting yes, it will not show up the category description. | String | optional |
हुक के संस्करण और Gerrit ID का पता लगाना
इस साँचे के version
और gerrit
एट्रीब्यूट्स को भरने के लिए आपको docs/hooks.txt फाइल के इतिहास में ढूँढ़ने की ज़रूरत पड़ सकती है।
- (मीडियाविकि के स्रोत कोड के सर्वोपरी गिट क्लोन से)
hooks.txt
पर हुक का उल्लेख करने वाले सबसे पुराना कमिट पाएँ:git grep <हुक-का-नाम> $(git rev-list --all -- docs/hooks.txt) -- docs/hooks.txt | tail -n 1
- इसका Gerrit ID खोजें:
git log <ऊपर-से-कमिट>
- Gerrit के खोज बॉक्स पर लॉग एंट्री से change-id की प्रतिलिपि बनाएँ
- प्रासंगिक बदलाव चुनें और उसका ID पाएँ
- पहली बार हुक का उल्लेख करने वाले प्रकाशन को ढूँढ़ें:
git tag --contains <ऊपर-से-कमिट>
Categories
The template automatically adds the page to the following categories:
Category:Hooks added in MediaWiki <version>
Category:MediaWiki hooks included in <file>
and links to the following category:
Category:<hook name> extensions
When creating a new hook documentation page, you should create this categories if they don't exist yet. The first two can be left with an empty body; the third one should contain {{HookUsage|<name>}}
.