Last modified: 2014-01-14 13:38:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T25348, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23348 - --wiki works only for wizards and Wikipedia
--wiki works only for wizards and Wikipedia
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-29 15:46 UTC by Svip
Modified: 2014-01-14 13:38 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Svip 2010-04-29 15:46:55 UTC
It seems the --wiki switch on maintenance scripts, which is supposed to be intended for wiki farms with the use of $wgConf->wikis to update individual wikis doesn't work at all.

After several tests of this with my own farm, I have reached the conclusion that whatever you try, the maintenance will always default to your default wiki for some reason.  And it is hardly obvious how it even gets to that, even when forcing it through several localsettings modified specifically to only include *one* $wgDBname.

I realise that it was originally written for Wikipedia, but apparently, I guess, Wikipedia got all the cheat codes and holds all the cards, because it surely works in their end and not here.  Even when looking closely at their InitialiseSettings.php script and copying their format, no results.
Comment 1 Alexandre Emsenhuber [IAlex] 2010-04-29 16:40:09 UTC
As I said on IRC, the value is stored in MW_DB and MW_PREFIX constants; settings are not automatically extracted from $wgConf. Also Wikimedia case is handled differently; just copying InitialiseSettings.php will not work as expected.
Comment 2 Chad H. 2010-04-29 21:05:38 UTC
REOPENING. The actual listed issue: "--wiki does not work" does indeed not work, regardless of your setup. It's only checked when it 'wikimedia-mode,' when in fact it should be checked regardless so third parties can use it too.

The issue was that the --wiki option originally only existed for WMF wikis and was never advertised as a possible option. When I did the maintenance rewrite, it exposed the option to all users via --help, without the actual code in place to make it work for non-WMF sites.
Comment 3 Alexandre Emsenhuber [IAlex] 2010-05-01 18:34:59 UTC
It is used (see lines 726 to 733 of Maintenance.php) and it just works fine, but you need to handle it manually in LocalSettings.php, as Tim said we he introduced the feature in r35839.
Comment 4 Svip 2010-05-01 19:56:57 UTC
(In reply to comment #3)
> It is used (see lines 726 to 733 of Maintenance.php) and it just works fine,
> but you need to handle it manually in LocalSettings.php, as Tim said we he
> introduced the feature in r35839.

Then riddle me this.  If I have a wiki farm, and one of these wikis (say the pool wiki) has the table 'info_pool' and the prefix ''.  What should I grant to the --wiki switch?

All I hear is that 'it works', but I'd prefer it if there was actually, I dunno, some usage cases of it, because it seems not to work in my end:

$ php maintenance/update.php --wiki=info_pool-
MediaWiki 1.17alpha Updater

Going to run database updates for info_en
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ... 3

$ php maintenance/update.php --wiki=info_pool
MediaWiki 1.17alpha Updater

Going to run database updates for info_en
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ... 4

Eh?

Why does it default to info_en each time?  I don't get it!
Comment 5 Alexandre Emsenhuber [IAlex] 2010-05-08 15:09:40 UTC
In LocalSettings.php copy MW_DB to $wgDBName and MW_PREFIX to $wgDBPrefix (only if MW_DB is defined, of course) and extract the other settings based on these two ones. As I already said two times, this is *not* done automatically.
Comment 6 Chad H. 2010-05-08 16:18:45 UTC
Which is not intuitive at all, nor is it documented anywhere.
Comment 7 Hydriz Scholz 2013-06-25 09:22:33 UTC
This is part of the MediaWiki multiversion system deployed on the Wikimedia cluster. It contains a lot of useless code for third parties, but the main part that you will need in your own wikifarm:

if ( $wgCommandLineMode ) {
	if ( isset( $argv[1] ) && $argv[1] === '--wiki' ) {
		$dbname = isset( $argv[2] ) ? $argv[2] : ''; // "script.php --wiki dbname"
	} elseif ( isset( $argv[1] ) && substr( $argv[1], 0, 7 ) === '--wiki=' ) {
		$dbname = substr( $argv[1], 7 ); // "script.php --wiki=dbname"
	} elseif ( isset( $argv[1] ) && substr( $argv[1], 0, 2 ) !== '--' ) {
		$dbname = $argv[1]; // "script.php dbname"
	}
}
$wgDBname = $dbname; // Set it to the DB given

There is also another hack to find what domain the user is coming from, but it is not needed here. (Note: I added the first and last line myself)

The funny thing is that all maintenance scripts makes --wiki as a possible parameter, even though the above code might not yet have been set. That requirement should be removed totally, but that deserves another bug to be filed and is not part of this.

Somebody should put this on MediaWiki.org.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links