Page MenuHomePhabricator

Implement installing MediaWiki from an existing LocalSettings.php by using install.php
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Have a wikifarm where LocalSettings.php exists.
  • Want to add a second wiki to the farm, using configuration file at LocalSettings-wikifarmsite1.php.
  • Run installer with:
  • php maintenance/install.php [...] --conf LocalSettings-wikifarmsite1.php [...]

What happens?:
Install is not run if LocalSettings.php exists already:

A LocalSettings.php file has been detected. To upgrade this installation, please run update.php instead

What should have happened instead?:
The existence of file listed in --conf switch should be checked, and not LocalSettings.php, and if the file in --conf is not detected then install should proceed.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
1.35.3

Event Timeline

Aklapper renamed this task from maintenance/install.php ignores --conf for detecting if LocalSettings exists to maintenance/install.php ignores --conf for detecting if LocalSettings.php exists.Aug 7 2021, 8:45 AM

It would be useful to have a parameter to ignore existing LocalSettings.php.

In my case, also a wiki_farm, I run many wikis on the same MW codebase, and I have a script to create new wiki instances.

While trying to retrofit my instance creation script to use maintenance/install.php, I found out that there's no way to make it ignore the existing LocalSettings.php file in the shared codebase, which is effectively a dispatcher to instance-specific configuration files.

I expected that specifying --conf to a path where no LocalSettings.php file existed, would do the trick, but it seems that this option is ignored.

I haven't tested it myself, but we recently added MW_CONFIG_FILE as env variable in MediaWiki core. That either is, or perhaps should be, a way to influence this.

While general maintenance scripts do take a --conf option, the install.php script is special and I think understandably ignores those as they are primarily for existing wikis. I don't think it is intentionally ignored and indeed it seems sensible to try to make that work at the same time (or to unset the inherited parameters to avoid confusion).

An environment variable such as MW_CONFIG_FILE was indeed on my wishlist! It would simplify some farm setups.

As of 1.35.5, all mentions of MW_CONFIG_FILE seem to me to be processing PHP variables, rather than an environment variable. This is the case also in Setup.php where setting the value for MW_CONFIG_FILE is expected to take place, for all entry points.

If this is the case, then it would be useless for install.php, unless I write a wrapper for it.

I also found a patch related to T192003, but it doesn't seem to have been merged. which is expected, since it is not the right place to do it.

Lectrician1 renamed this task from maintenance/install.php ignores --conf for detecting if LocalSettings.php exists to Implement installing MediaWiki from an existing LocalSettings.php by using install.php.Aug 11 2023, 10:01 PM

Here is a past change someone made to mediawiki install files to allow this behavior: https://www.mediawiki.org/wiki/Topic:Vn3phnl79hyleo6s

Change 952276 had a related patch set uploaded (by Aklapper; author: Lectrician1):

[mediawiki/core@master] Implement installing MediaWiki with an existing LocalSettings from CLI

https://gerrit.wikimedia.org/r/952276