Extension:IDProvider/fi

This page is a translated version of the page Extension:IDProvider and the translation is 23% complete.
MediaWikin laajennukset-ohje
OOjs UI icon advanced-invert.svg
IDProvider
Julkaisustatus: vakaa
Toteutus Jäsennintoiminto
Kuvaus Provides IDs using different ID algorithms
Tekijä(t) Simon Heimler, Alexander Gesinn
Ylläpitäjä(t) gesinn.it
Viimeisin versio 1.1.2 (2019-02-06)
MediaWiki 1.27+
PHP 5.3+
Tietokantamuutokset Kyllä
Composer gesinn-it/id-provider
Lisenssi MIT License
Lataa

Check usage and version matrix.

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 and place the file(s) in a directory called IDProvider in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'IDProvider' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  •   TehtyNavigate to Special:Version on your wiki to verify that the extension is successfully installed.


Installation via Composer is broken.

Käyttö

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

 

Through a static PHP call

Lisäesimerkkejä varten, katso unit-tests.

IDProviderFunctions::getIncrement

$id = IDProviderFunctions::getIncrement(array(
	'prefix' => '___TEST___',
	'padding' => 8,
));

IDProviderFunctions::getRandom

$id = IDProviderFunctions::getRandom(array(
	'type' => 'fakeid',
	'prefix' => 'PREFIX_',
));

Katso myös