Fixing T229092
While upgrading a MediaWiki installation I ran into the error
Query: INSERT INTO `actor` (actor_name) VALUES ('RedirectBot')
Function: MigrateActors::addActorsForRows
Error: 1062 Duplicate entry 'RedirectBot' for key 'actor_name' (localhost)
while running maintenance/upgrade.php
. The problem bit quite a lot of people with
older MediaWiki installations. And while the official bug report
is mildly interesting to read, there hasn’t been a solution since July 2019.
In my case it was rather easy to identify the problem. MediaWiki saves the
username
and user_id
with every revision. In this case the user RedirectBot
had two different user_ids
, 860 and 200012. I fixed this by making sure that
all revision
entries for RedirectBot
have the same rev_user
:
delete from actor where actor_name like 'Redi%';
update revision set rev_user=200012 where rev_user=860;
Afterwards update.php
worked as it should.