]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
better handling of settings file issues during installation
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 12 Oct 2010 10:58:36 +0000 (10:58 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 12 Oct 2010 10:58:36 +0000 (10:58 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7063 36083f99-b078-4883-b0ff-0f9b5a30f544

install/ElggInstaller.php
install/languages/en.php
languages/en.php

index 57940dda30294edbba36f049dfdda8f19b6a28f4..e8220ff45e6946e3e097560fc0f70ff49dbdf772 100644 (file)
@@ -5,7 +5,7 @@
  *
  * @package Elgg
  * @subpackage Installer
- * @author Curverider Ltd
+ * @author Cash Costello and Curverider Ltd
  * @link http://elgg.org/
  */
 
@@ -141,7 +141,7 @@ class ElggInstaller {
                $this->checkRewriteRules($report);
 
                // check for existence of settings file
-               if ($this->checkSettingsFile() != TRUE) {
+               if ($this->checkSettingsFile($report) != TRUE) {
                        // no file, so check permissions on engine directory
                        $this->checkEngineDir($report);
                }
@@ -459,8 +459,7 @@ class ElggInstaller {
        protected function setInstallStatus() {
                global $CONFIG;
 
-               $settingsCreated = $this->checkSettingsFile();
-               if ($settingsCreated == FALSE) {
+               if (!is_readable("{$CONFIG->path}engine/settings.php")) {
                        return;
                }
 
@@ -746,7 +745,7 @@ class ElggInstaller {
 
                $writable = is_writable("{$CONFIG->path}engine");
                if (!$writable) {
-                       $report['engine'] = array(
+                       $report['settings'] = array(
                                array(
                                        'severity' => 'failure',
                                        'message' => elgg_echo('install:check:enginedir'),
@@ -760,16 +759,26 @@ class ElggInstaller {
 
        /**
         * Check that the settings file exists
+        * @param array $report
         * @return bool
         */
-       protected function checkSettingsFile() {
+       protected function checkSettingsFile(&$report) {
                global $CONFIG;
 
-               if (is_readable("{$CONFIG->path}engine/settings.php")) {
-                       return TRUE;
+               if (!file_exists("{$CONFIG->path}engine/settings.php")) {
+                       return FALSE;
                }
 
-               return FALSE;
+               if (!is_readable("{$CONFIG->path}engine/settings.php")) {
+                       $report['settings'] = array(
+                               array(
+                                       'severity' => 'failure',
+                                       'message' => elgg_echo('install:check:readsettings'),
+                               )
+                       );
+               }
+
+               return TRUE;
        }
 
        /**
index 049fd4ad45f40dcf3195db74629b4b3a037905ed..455515b61660f1e4a141d3402fdd88574debebe6 100644 (file)
@@ -26,7 +26,7 @@ If you are ready to proceed, click the Next button.",
 
        'install:require:php' => 'PHP',
        'install:require:rewrite' => 'Web server',
-       'install:require:engine' => 'Settings file',
+       'install:require:settings' => 'Settings file',
        'install:require:database' => 'Database',
 
        'install:check:root' => 'Your web server does not have permission to create an .htaccess file in the root directory of Elgg. You have two choices:
@@ -46,6 +46,7 @@ If you are ready to proceed, click the Next button.",
                1. Change the permissions on the engine directory
 
                2. Copy the file settings.example.php to settings.php and follow the instructions in it for setting your database parameters.',
+       'install:check:readsettings' => 'A settings file exists in the engine directory, but the web server cannot read it. You can delete the file or change the read permissions on it.',
 
        'install:check:php:success' => "Your server's PHP satisfies all of Elgg's requirements.",
        'install:check:rewrite:success' => 'The test of the rewrite rules was successful.',
index 2806168c6d9c340256fbc955b24256d3ba69d63d..7953f12d651118216936883655bf4d55795a2caa 100644 (file)
@@ -47,7 +47,7 @@ $english = array(
        'InstallationException:CannotLoadSettings' => 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.',
 
        'SecurityException:Codeblock' => "Denied access to execute privileged code block",
-       'DatabaseException:WrongCredentials' => "Elgg couldn't connect to the database using the given credentials.",
+       'DatabaseException:WrongCredentials' => "Elgg couldn't connect to the database using the given credentials. Check the settings file.",
        'DatabaseException:NoConnect' => "Elgg couldn't select the database '%s', please check that the database is created and you have access to it.",
        'SecurityException:FunctionDenied' => "Access to privileged function '%s' is denied.",
        'DatabaseException:DBSetupIssues' => "There were a number of issues: ",