Docker Wikibase Import Issue

118 Views Asked by At

So I installed a Docker Wikibase instance and imported a dump from a WAMP64 Wikibase instance. It imported correctly and everything seems to work, except I can't create new items or properties anymore and I always get a "Could not create a new page. It already exists." error.

Any ideas on how to diagnose or fix? I'm thinking the it's trying to create an item "Q1" where a "Q1" already exists maybe? Any help would be much appreciated!

1

There are 1 best solutions below

0
On

I figured it out!

Thanks to step 4 here (https://wikibase.consulting/transferring-wikibase-data-between-wikis/), I found out I was right and that Wikibase was trying to create a Q1 where a Q1 already existed. Therefore, I just needed to move the counter to the appropriate number.

Luckily, the above link has access to a script which will do this quick and easy. You can download the link into the root directory of the Wikibase instance using:

curl https://gist.githubusercontent.com/JeroenDeDauw/c86a5ab7e2771301eb506b246f1af7a6/raw/rebuildWikibaseIdCounters.sql -o rebuildWikibaseIdCounters.sql

And execute it with:

php maintenance/sql.php rebuildWikibaseIdCounters.sql

Super fast and painless!

(The raw script is also available here if curl isn't an option for some reason: https://gist.githubusercontent.com/JeroenDeDauw/c86a5ab7e2771301eb506b246f1af7a6/raw/88cdccb1adcdf420d17a3a21296a99f153b95a21/rebuildWikibaseIdCounters.sql)

This is what the script looks like in full:

-- By Jeroen De Dauw / https://Professional.Wiki
-- License: GPL-2.0-or-later

SELECT * FROM /*_*/wb_id_counters;

REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 120), 'wikibase-item');

REPLACE INTO /*_*/wb_id_counters VALUE((SELECT COALESCE(MAX(CAST(SUBSTRING(`page_title`, 2) AS UNSIGNED)), 0) FROM `page` WHERE `page_namespace` = 122), 'wikibase-property');

SELECT * FROM /*_*/wb_id_counters;