Topic on Project:Support desk

Update LocalSettings.php

5
Jonathan3 (talkcontribs)

I noticed a recent comment by Ammarpad in "Issues after updating wiki to latest version" linking to phab:T263911, which ends with a comment stating that the following is not needed any more:

if( defined( 'MW_INSTALL_PATH' ) ) {
    $IP = MW_INSTALL_PATH;
} else {
    $IP = dirname( __FILE__ );
}

$path = array( $IP, "$IP/includes", "$IP/languages" );
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );

require_once( "$IP/includes/DefaultSettings.php" );

if ( $wgCommandLineMode ) {
    if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
        die( "This script must be run from the command line\n" );
    }
}

I still have all this (though no known problems arising). Is there an easy way to get a fresh LocalSettings.php for adding my site settings to again? I've not cleaned it out since installing version 1.5 or 1.6...

Ammarpad (talkcontribs)

You usually do that by deleting the existing LocalSettings.php before upgrading (or preferably by moving it to somewhere else so that you can restore any custom settings you might have later). The installer looks for it at its default location and if it's there, it won't be regenerated.

Jonathan3 (talkcontribs)

I see now. I think I followed the instructions each time which now say:

After extracting the tarball, you should copy or move some files and folders from the old installation directory to the new one:

  • LocalSettings.php, which contains your old configuration settings.

...

Run the update script

Next time I upgrade should I run upgrade.php without my old LocalSettings.php file, then merge the old and newly-created files into one file containing the current "boilerplate" stuff plus the necessary settings (database credentials, skins, extensions etc) from the old file?

Ammarpad (talkcontribs)

Yes

Jonathan3 (talkcontribs)
Reply to "Update LocalSettings.php"