'How to initialize Mediawiki shared database tables?

I am trying to initialize a new Mediawiki family. I use this guide, of course. In the Upgrading section of the guide, it is mentioned:

As of MediaWiki 1.21, when upgrading MediaWiki from the web installer, $wgSharedTables must be temporarily cleared during upgrade. Otherwise, the shared tables are not touched at all (neither tables with $wgSharedPrefix, nor those with $wgDBprefix), which may lead to a failed upgrade.

It is right, because using this setting:

$wgSharedDB = 'wiki_shared';
$wgSharedTables[] = array('user','user_groups','actor');
$wgSharedPrefix = '';

I had no success in setting the db up; no shared tables are created in the wiki_shared db (it remains an empty db).

How should I "clear $wgSharedTables" to avoid facing this issue?



Solution 1:[1]

(Even though this is old, just in case someone will get here...)

First of all, this is how to clear $wgSharedTables:

$wgSharedTables = [];

All the other options just added a new empty array into the array.

Also, This is not the way you set $wgSharedTables. You essentially added an array inside the array; however, each table is supposed to be its own item. Either use array_merge():

$wgSharedTables = array_merge( $wgSharedTables, [ user','user_groups','actor' ] );

Or set each one separately:

$wgSharedTables[] = 'user';
$wgSharedTables[] = 'user_groups';
$wgSharedTables[] = 'actor';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dror S.