Page MenuHomePhabricator

Quibble should backup and delete LocalSettings.php
Open, NormalPublic

Description

Locally, I often get:

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

That one is annoying and I am not the only one:

@Niedzielski T195084#4249719
@Tarrow and @Pablo-WMDE on T200991: Document quibble learnings

Quibble does not delete LocalSettings.php since I was afraid of eventually deleting a file coming from the user. Instead we should delete it. Maybe back it up beforehand? That makes it easier to iterate over and over.

Event Timeline

hashar created this task.Mar 19 2019, 10:43 AM
hashar moved this task from Backlog to Enhancement on the Quibble board.

+ @kostajh @awight known Quibble users.

I cannot make a decision regarding the deletion of the generated LocalSettings.php, I am afraid people end up deleting their own customized LocalSettings.php whenever they run Quibble on their local MediaWiki installation. I am looking for suggestions :-]

I have a dedicated directory for quibble builds, and I run quibble with

cd ~/quibble-builds && \
rm src/LocalSettings.php; \
docker run -it --rm \
--name quibble [...]

Haven't thought through it much, but maybe MediaWiki could look for a ContinuousIntegrationSettings.php file, and if that is found then LocalSettings.php is not loaded. Then Quibble could delete/modify ContinuousIntegrationSettings.php without interfering with LocalSettings

Haven't thought through it much, but maybe MediaWiki could look for a ContinuousIntegrationSettings.php file, and if that is found then LocalSettings.php is not loaded. Then Quibble could delete/modify ContinuousIntegrationSettings.php without interfering with LocalSettings

I like it. What about a separate settings file, but loaded from LocalSettings.php—then, LocalSettings.php would be very short and have a prominent warning like is often done for generated files, for example:

<?php

// DO NOT EDIT THIS FILE, it is generated by quibble and will be overwritten.  Your changes will be discarded...

require_once( 'LocalSettings.php' );

Then, quibble can check for the "DO NOT EDIT" string. If that string is present, we can delete and regenerate LocalSettings.php. If not present, stop everything and complain that you're running quibble on production or in a development tree.

The LocalSettings.php file is generated by MediaWiki installer. Then we prepend the content of`quibble/mediawiki/local_settings.php` so that gives some mark to figure out whether an existing LocalSettings.php file has been previously generated for Quibble.

I think I will go with backing up the file before running the installer, suffixed with a timestamp. Once the install is done do a comparison and delete the backup if that is the exact same after the install has run. This way if any change has been made, a copy is kept behind.

hashar triaged this task as Normal priority.Oct 8 2019, 10:14 AM

I've been away for awhile so please excuse this comment if it doesn't make sense, but did you consider a "--deleteLocalSettings" (or similar) flag? If the flag is set, the LocalSettings.php can be deleted and database reinitialized. If not, the informational message can be shown: A LocalSettings.php file has been detected. To upgrade this installation, please run update.php instead.