Extension:IDProvider/ru
IDProvider Статус релиза: стабильно |
|
---|---|
Реализация | Функция парсера |
Описание | Provides IDs using different ID algorithms |
Автор(ы) | Simon Heimler, Alexander Gesinn |
Поддерживающий(ие) | gesinn.it |
Последняя версия | 2.0.3 (2022-12-07) |
MediaWiki | 1.31+ |
Изменения в БД | Да |
Composer | gesinn-it/id-provider |
Лицензия | MIT License |
Скачать | GitHub:
<translate> Note:</translate> |
Expand | |
Ежеквартальные загрузки | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Использование общедоступными вики | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The IDProvider extension provides the generation of (unique) IDs through different ID algorithms. They can be accessed through parser functions, API or as a static PHP function.
Installation
- <translate> <tvar name=1>Download, extract</tvar> and place the file(s) in a directory called <tvar name=name>
IDProvider/ru
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'IDProvider/ru' );
- <translate> Run the [[<tvar name=update>Special:MyLanguage/Manual:Update.php</tvar>|update script]] which will automatically create the necessary database tables that this extension needs.</translate>
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Usage
The ApiSandbox will display and document all available options. All parameters are given as key values and work the same way whether you use the parser function, api or a static php call.
Through parser functions
This makes most sense in combination with Расширение:Page Forms . There it can be used for auto-creating unique page titles.
{{{info|page name={{#idprovider-increment:Feature_|padding=5}} }}}
#idprovider-increment
{{#idprovider-increment:}}
{{#idprovider-increment:Issue_}}
{{#idprovider-increment:
|prefix=Issue_
|padding=5
|skipUniqueTest=true
}}
#idprovider-random
{{#idprovider-random:}}
{{#idprovider-random:uuid}}
{{#idprovider-random:fakeid}}
{{#idprovider-random:
|type=uuid
|skipUniqueTest=true
}}
Through the API
#idprovider-increment
- api.php?action=idprovider-increment
- api.php?action=idprovider-increment&prefix=Issue_&padding=8&skipUniqueTest=true
#idprovider-random
- api.php?action=idprovider-random&type=uuid
- api.php?action=idprovider-random&type=fakeid&prefix=Issue_&skipUniqueTest=true
Through a static PHP call
For more examples, take a look at the unit-tests.
IDProviderFunctions::getIncrement
$id = IDProviderFunctions::getIncrement([
'prefix' => '___TEST___',
'padding' => 8,
]);
IDProviderFunctions::getRandom
$id = IDProviderFunctions::getRandom([
'type' => 'fakeid',
'prefix' => 'PREFIX_',
]);
См. также
- Extension:IDGenerator - Provides a parser function for numeric IDs. Alternative to IDProvider that can be installed via Composer.
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
- Pages with script errors
- Pages with broken file links
- Stable extensions/ru
- Parser function extensions/ru
- Extensions with manual MediaWiki version
- Extensions supporting Composer/ru
- MIT licensed extensions/ru
- Extensions in GitHub version control/ru
- ParserFirstCallInit extensions/ru
- BeforePageDisplay extensions/ru
- All extensions/ru
- Extensions not in ExtensionJson
- Extensions by gesinn.it/ru