Installer no longer writes LocalSettings.php to /config. Now offer it as a download...
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 14 Jul 2010 01:18:14 +0000 (01:18 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 14 Jul 2010 01:18:14 +0000 (01:18 +0000)
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/WebInstaller.php

index 45d1f9e..a01f5af 100644 (file)
@@ -444,31 +444,14 @@ Make sure that the user "$1" can write to the schema "$2".',
        'config-insecure-secretkey'       => "'''Warning:''' Unable to create secure <code>\$wgSecretKey</code>.
 Consider changing it manually.",
        'config-install-sysop'            => 'Creating administrator user account',
-       'config-install-localsettings'    => 'Creating LocalSettings.php',
-       'config-install-localsettings-unwritable' => 'Warning: Could not write <code>LocalSettings.php</code>.
-Create it yourself, using the following text:
-<textarea name="LocalSettings" id="LocalSettings" cols="80" rows="25" readonly="readonly">
-$1
-</textarea>
-',
        'config-install-done'             => "'''Congratulations!'''
 You have successfully installed MediaWiki.
 
 We have generated a <code>LocalSettings.php</code> file for you. It contains all your configuration.
 
-You will need to move it from <code>./config/LocalSettings.php</code> to <code>./LocalSettings.php</code> in order for MediaWiki to work:
-
-On a Unix/Linux system:
-
-<pre>
-mv ./config/LocalSettings.php ./LocalSettings.php
-</pre>
-
-When that's done, you can [$1 '''enter your wiki''']",
-       'config-install-done-moved'       => "'''Congratulations!'''
-You have successfully installed MediaWiki.
+You will need to [$1 download] it and put it in the base of your wiki installation (the same directory as index.php)
 
-[$1 Enter your wiki]",
+When that's done, you can [$2 '''enter your wiki''']", // $1 is the URL to LocalSettings download, $2 is link to wiki
 );
 
 /** Dutch (Nederlands)
index 2d2eec3..5a725d4 100644 (file)
@@ -133,7 +133,6 @@ abstract class Installer {
                'interwiki',
                'secretkey',
                'sysop',
-               'localsettings',
        );
 
        /**
@@ -890,7 +889,9 @@ abstract class Installer {
                        if( !$status->isOk() )
                                break;
                }
-               $this->setVar( '_InstallDone', true );
+               if( $status->isOk() ) {
+                       $this->setVar( '_InstallDone', true );
+               }
                return $installResults;
        }
 
@@ -973,11 +974,6 @@ abstract class Installer {
                return Status::newGood();
        }
 
-       public function installLocalsettings() {
-               $localSettings = new LocalSettingsGenerator( $this );
-               return $localSettings->writeLocalSettings();
-       }
-
        /**
         * Determine if LocalSettings exists. If it does, return an appropriate
         * status for whether we should can upgrade or not
index 0a9266a..fc47f0f 100644 (file)
@@ -74,26 +74,6 @@ class LocalSettingsGenerator {
                return $localSettings;
        }
 
-       /**
-        * Write the file
-        * @param $secretKey String A random string to
-        * @return boolean On successful file write
-        */
-       public function writeLocalSettings() {
-               $localSettings = $this->getText();
-               wfSuppressWarnings();
-               $ret = file_put_contents( $this->configPath . '/LocalSettings.php', $localSettings );
-               wfRestoreWarnings();
-
-               $status = Status::newGood();
-
-               if ( !$ret ) {
-                       $status->fatal( 'config-install-localsettings-unwritable', $localSettings );
-               }
-
-               return $status;
-       }
-
        private function buildMemcachedServerList() {
                $servers = $this->values['_MemCachedServers'];
                if( !$servers ) {
index 21eccd0..e009ad5 100644 (file)
@@ -84,6 +84,17 @@ class WebInstaller extends Installer {
                $this->exportVars();
                $this->setupLanguage();
 
+               if( $this->getVar( '_InstallDone' ) && $this->request->getVal( 'localsettings' ) )
+               {
+                       $ls = new LocalSettingsGenerator( $this );
+                       $this->request->response()->header('Content-type: text/plain');
+                       $this->request->response()->header(
+                               'Content-Disposition: attachment; filename="LocalSettings.php"'
+                       );
+                       echo $ls->getText();
+                       return $this->session;
+               }
+
                if ( isset( $session['happyPages'] ) ) {
                        $this->happyPages = $session['happyPages'];
                } else {
@@ -1629,10 +1640,10 @@ class WebInstaller_Complete extends WebInstallerPage {
        public function execute() {
                global $IP;
                $this->startForm();
-               $msg = file_exists( "$IP/LocalSettings.php" ) ? 'config-install-done-moved' : 'config-install-done';
                $this->addHTML(
                        $this->parent->getInfoBox(
-                               wfMsgNoTrans( $msg,
+                               wfMsgNoTrans( 'config-install-done',
+                                       $GLOBALS['wgServer'] . $this->parent->getURL( array( 'localsettings' => 1 ) ),
                                        $GLOBALS['wgServer'] .
                                                $this->getVar( 'wgScriptPath' ) . '/index' .
                                                $this->getVar( 'wgScriptExtension' )