Browse Source

Feature #272 - Installation scripts: Testing the protection against re-installing, corrections.

Ivan Tcholakov 15 years ago
parent
commit
d624b4c8ce
1 changed files with 8 additions and 3 deletions
  1. 8 3
      main/install/install.lib.php

+ 8 - 3
main/install/install.lib.php

@@ -40,18 +40,23 @@ function is_already_installed_system() {
 	global $new_version;
 
 	if (empty($new_version)) {
-		return true;
+		return true; // Must be initialized.
+	}
+
+	if (is_array($_POST) && count($_POST) > 0) {
+		return false; // Running installation.
 	}
 
 	$current_config_file = str_replace('\\', '/', realpath('../inc/conf/configuration.php'));
 	if (!file_exists($current_config_file)) {
-		return false;
+		return false; // Configuration file does not exist, install the system.
 	}
 	require $current_config_file;
 
-	 // Careful, if/when the name 'dokeos_version' is changed. Check this then.
+	// Careful, if/when the name 'dokeos_version' is changed. Check this then.
 	$current_version = $_configuration['dokeos_version'];
 
+	// If the current version is old, upgrading is assumed as intended.
 	return empty($current_version) ? false : ($new_version == $current_version);
 }