Divide by Zero
Divide by Zero

Reputation: 1474

MediaWiki: How to Update.php maintenance script on wiki family?

I am running a MediaWiki wiki-family, with shared codebase and shared database. I recently successfully upgraded to 1.25.3.

My wiki has 4 prefixes ATM, like so:

en_
de_
es_
shared_

I try to run my update.php script like so:

php update.php --wiki myWikiName-de_ --doshared
php update.php --wiki myWikiName-en_ --doshared
php update.php --wiki myWikiName-es_ --doshared

on my server. This should in theory work. Sadly it ALWAYS uses the myWikiName-en_ and ignores my input..

PHP Notice:  Undefined index: HTTP_HOST in /var/www/myWiki/wiki/LocalSettings.php on line 176
<br />
<b>Notice</b>:  Undefined index: HTTP_HOST in <b>/var/www/myWiki/wiki/LocalSettings.php</b> on line <b>176</b><br />
MediaWiki 1.25.3 Updater

Your composer.lock file is up to date with current dependencies!
Going to run database updates for myWikiName-en_
Depending on the size of your database this may take a while!

Please someone tell me what I am doing wrong!

Upvotes: 0

Views: 1406

Answers (4)

Kalle
Kalle

Reputation: 13346

The way to do this appears to be to echo the language and pipe to the command. E.g.

for lang in en de es; do
    echo $lang | php update.php || read x
done

(the above will run the updater for the languages 'en', 'de', and 'es', and will stop and wait for input from command line if one of them fails)

Upvotes: 1

UlfDunkel
UlfDunkel

Reputation: 169

When you take a look at /maintenance/update.php, you'll see that it is an extension to /maintenance/Maintenance.php, where various option parameters have been defined.

I had success using the conf option which tells the Maintenance.php script (and the update.php script, too) about the location of the LocalSettings.php file to be used:

$ php update.php --conf /var/www/<myWebfolder>/da/LocalSettings.php
$ php update.php --conf /var/www/<myWebfolder>/de/LocalSettings.php
$ php update.php --conf /var/www/<myWebfolder>/en/LocalSettings.php

etc.

Upvotes: 1

Divide by Zero
Divide by Zero

Reputation: 1474

I fixed it. I had to manually set the $wgDBprefix to first de_ then es_ and finally en_ for my three languages. This way i could run the Update.php script once for every wiki-family-member.

Thank you for the help @leo

Upvotes: 0

leo
leo

Reputation: 8520

Try setting SERVER_NAME=my.domain.org before running php update.php. The script might be looking for $_SERVER which, as you are running from the command line, is not available.

Upvotes: 3

Related Questions