Page MenuHomePhabricator

Create a maintenance script in Flow to rename a wiki
Open, LowPublic

Description

When a wiki is renamed (=its database name and/or table prefix is changed) the existing Flow discussions are lost because the wiki ID (given by MediaWiki’s function wfWikiID() is changed.

I propose to create a maintenance script to change the database columns where this reference is written. Probably this script will have two mandatory arguments: the old name and the new name; possibly one can be automatically retrieved if the script is run before or after the rename operation.

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
StalledNone
OpenNone
OpenNone

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I did the following operations in database in a wiki and it globally works (*):

UPDATE flow_ext_ref SET ref_src_wiki = 'newWikiID' WHERE ref_src_wiki = 'oldWikiID';
UPDATE flow_revision SET rev_user_wiki = 'newWikiID' WHERE rev_user_wiki = 'oldWikiID';
UPDATE flow_revision SET rev_mod_user_wiki = 'newWikiID' WHERE rev_mod_user_wiki = 'oldWikiID';
UPDATE flow_revision SET rev_edit_user_wiki = 'newWikiID' WHERE rev_edit_user_wiki = 'oldWikiID';
UPDATE flow_tree_revision SET tree_orig_user_wiki = 'newWikiID' WHERE tree_orig_user_wiki = 'oldWikiID';
UPDATE flow_wiki_ref SET ref_src_wiki = 'newWikiID' WHERE ref_src_wiki = 'oldWikiID';
UPDATE flow_workflow SET workflow_wiki = 'newWikiID' WHERE workflow_wiki = 'oldWikiID';
UPDATE flow_subscription SET subscription_user_wiki = 'newWikiID' WHERE subscription_user_wiki = 'oldWikiID';

(The last table was empty, so I’m less sure, but it seems it should be changed too.)

(*) I have a minor issue because old topics have no entry in the MediaWiki table 'page' (and hence are red links), but possibly it is linked to activation process (I guess I ran the populateContentModel – transition to content models – before I executed the UPDATEs above and hence the script considered it was non-local pages). If a 'FlowRenameWiki.php' script is created it should be documented if it should run before or after the populateContentModel script in the case of a transition.