Deleting all Wikibase Items and/or Properties
Do you wish to start over in your Wikibase after some experimentation? You could reinstall the entire wiki, but perhaps you wish to retain some content, users, uploads or similar. This post shows you how to get rid of all your Items and/or Properties without needing to bother with a full reinstall.
Step 1: Enable Nuke
We will delete Items and Properties via the
Nuke extension. Since this extension comes bundled
with MediaWiki, all you need to do is enable it. This takes a single line in LocalSettings.php:
wfLoadExtension( 'Nuke' );
Step 2: Delete pages
Go to Special:Nuke and delete the pages in the Items and Properties namespaces. Begin by selecting either the
Item or Property namespace. Leave the first field blank, and enter % in the “SQL LIKE pattern”
field. Then submit the form.
Optional Step 3: Reset Wikibase ID counters
Once you deleted the pages using step 2, you’ll be ready to create new Items and/or Properties. If you had 500 Items in your wiki already, creating a new one will now result in it getting ID Q501, rather than Q1. If you wish to also reset these numbers, so you can start with Q1 again, you also need to run the following commands before creating new Items:
echo 'SELECT * FROM /*_*/wb_id_counters;' | php maintenance/sql.php
echo 'UPDATE /*_*/wb_id_counters SET id_value = 0 WHERE id_type = "wikibase-item";' | php maintenance/sql.php
echo 'UPDATE /*_*/wb_id_counters SET id_value = 0 WHERE id_type = "wikibase-property";' | php maintenance/sql.php
echo 'SELECT * FROM /*_*/wb_id_counters;' | php maintenance/sql.php
Remove the wikibase-item or wikibase-property line if you are only deleting entities
of the other type.
- Use Wikidata and Wikibase with AI
- Chameleon 6: Now on Bootstrap 5
- Semantic MediaWiki 7.2.0 Released
- Native Markdown for MediaWiki
- Use Semantic MediaWiki with AI
- Semantic MediaWiki 7 Released
- Introducing NeoWiki and More at MUDCon
- MediaWiki Chatbot Extensions Compared
- Wikibase Faceted Search Released
- Semantic MediaWiki 5 Released
- Top Wikibase Extensions
- 2024 MediaWiki Conference Highlights
- Semantic Wikibase: 2024 Update
- We Partner with HalloWelt to Provide BlueSpice
- Semantic MediaWiki 4.2.0 Released
- Is Wikibase Right for Your Project?
- Sorting Wikibase Statements by Property
- New Extension: Wikibase Export
- Semantic MediaWiki 4.1.0 released
- Embedding External Content in MediaWiki
- Fast Bulk Import Into Wikibase
- SMWCon 2021
- WikidataCon 2021
- Deleting all Wikibase Items and/or Properties
- Restrict who can create items and properties
- Best Responsive MediaWiki Skins
- Medik MediaWiki Skin
- Happy 20th Anniversary Wikipedia
- Transferring Wikibase data between wikis
- Semantic MediaWiki 3.2
- Local Media Support for Wikibase
- Chameleon MediaWiki Skin
- Foreground MediaWiki Skin
- Pivot MediaWiki Skin
- Tweeki MediaWiki Skin
- Semantic Wikibase Released
- Visualizing Links Between Pages
- MediaWiki Survey
- SMW vs Wikibase vs Cargo
- Using Wikidata in Your Wiki
- Visual Map Editor for MediaWiki
- WikidataCon 2019 Berlin
- Installing Extensions with Composer
- SMWCon 2019 Paris