Erweiterung:IDProvider
![]() Freigabestatus: stabil |
|
---|---|
Einbindung | Parser-Funktion |
Beschreibung | Provides IDs using different ID algorithms |
Autor(en) | Simon Heimler, Alexander Gesinn |
Betreuer | gesinn.it |
Letzte Version | 2.0.2 (2022-02-02) |
MediaWiki | 1.31+ |
Datenbankänderungen | Ja |
Composer | gesinn-it/id-provider |
Lizenz | MIT-Lizenz |
Herunterladen | GitHub: Hinweis: |
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
- Die Download, extract und die Datei(en) in ein Verzeichnis namens
IDProvider
im Ordnerextensions/
ablegen. - Folgenden Code am Ende der
LocalSettings.php
einfügen:wfLoadExtension( 'IDProvider' );
- Führe das Aktualisierungsskript aus, welches automatisch die notwendigen Datenbanktabellen erstellt, die diese Erweiterung braucht.
- Erledigt – Zu Special:Version in dem Wiki (bei Einstellung auf deutsch nach Spezial:Version) navigieren, um die erfolgreiche Installierung der Erweiterung zu überprüfen.
Installation mit Composer ist kaputt.
Verwendung
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.
Durch Parser-Funktionen
This makes most sense in combination with Erweiterung:Seitenformulare . 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
For more examples, take a look at the unit-tests.
IDProviderFunctions::getIncrement
$id = IDProviderFunctions::getIncrement(array(
'prefix' => '___TEST___',
'padding' => 8,
));
IDProviderFunctions::getRandom
$id = IDProviderFunctions::getRandom(array(
'type' => 'fakeid',
'prefix' => 'PREFIX_',
));
Siehe auch
- Extension:IDGenerator - Provides a parser function for numeric IDs. Alternative to IDProvider that can be installed via Composer.
- Extension:Substitutor – Allows to substitute the IDs generated
Diese Erweiterung ist in den folgenden Paketen und/oder WikiFarmen beinhalten: This is not an authoritative list. Some wiki farms/hosts may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |