Extension:IDProvider/ru

From mediawiki.org
This page is a translated version of the page Extension:IDProvider and the translation is 8% complete.
Справка по расширениям MediaWiki
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
Скачать

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

  • Download, extract и распакуйте файл(ы) в папку с названием IDProvider в вашей папке extensions/.
  • Добавьте следующий код в конце вашего файла LocalSettings.php :
    wfLoadExtension( 'IDProvider' );
    
  • Выполните скрипт обновления, который автоматически создаст необходимые таблицы, используемые расширением.
  • Yes Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.


Installation via Composer is broken.

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.

You should avoid spaces within the parser functions if you use it as a parameter of a Page Form info tag.
{{{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

IDProvider Example

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.