diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 0f0e7ddf0b..9e9b0bcd63 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -39,7 +39,7 @@ function is_already_installed_system() { return false; // Configuration file does not exist, install the system. } require $current_config_file; - + $current_version = null; if (isset($_configuration['dokeos_version'])) { $current_version = trim($_configuration['dokeos_version']); @@ -90,7 +90,7 @@ function check_php_setting($php_setting, $recommended_value, $return_success = f if ($current_php_value == $recommended_value) { return Display::label($current_php_value.' '.$return_success, 'success'); } else { - return Display::label($current_php_value.' '.$return_success, 'important'); + return Display::label($current_php_value.' '.$return_success, 'important'); } } @@ -225,9 +225,9 @@ function check_writable($folder, $suggestion = false) { return Display::label(get_lang('Writable'), 'success'); } else { if ($suggestion) { - return Display::label(get_lang('NotWritable'), 'info'); + return Display::label(get_lang('NotWritable'), 'info'); } else { - return Display::label(get_lang('NotWritable'), 'important'); + return Display::label(get_lang('NotWritable'), 'important'); } } } @@ -308,8 +308,8 @@ function write_system_config_file($path) { $config['{DATABASE_PASSWORD}'] = $dbPassForm; $config['TRACKING_ENABLED'] = true_false($enableTrackingForm); $config['SINGLE_DATABASE'] = true_false($singleDbForm); - $config['{COURSE_TABLE_PREFIX}'] = ($singleDbForm ? 'crs_' : ''); - $config['{DATABASE_GLUE}'] = ($singleDbForm ? '_' : '`.`'); + $config['{COURSE_TABLE_PREFIX}'] = ($singleDbForm ? 'crs_' : ''); + $config['{DATABASE_GLUE}'] = ($singleDbForm ? '_' : '`.`'); $config['{DATABASE_PREFIX}'] = ''; $config['{DATABASE_MAIN}'] = $dbNameForm; $config['{DATABASE_STATS}'] = $dbNameForm; @@ -442,7 +442,7 @@ function get_config_param($param, $updatePath = '') { } if (file_exists($updatePath.$updateFromConfigFile) && !is_dir($updatePath.$updateFromConfigFile)) { - + // The parameter was not found among the global variables, so look into the old configuration file. // Make sure the installedVersion file is read first so it is overwritten @@ -612,27 +612,27 @@ function database_server_connect() { /** * Database exists for the MYSQL user * @param type $database_name - * @return boolean + * @return boolean */ -function database_exists($database_name) { +function database_exists($database_name) { if (empty($database_name)) { return false; - } - $select_database = @Database::select_db($database_name); - $show_database = false; - $sql = "SHOW DATABASES LIKE '".addslashes($database_name)."'"; + } + $select_database = @Database::select_db($database_name); + $show_database = false; + $sql = "SHOW DATABASES LIKE '".addslashes($database_name)."'"; $result = @Database::query($sql); if (Database::num_rows($result)) { $show_database = true; - } + } return $select_database || $show_database; } /** - * In step 3. Tests establishing connection to the database server. - * If it's a single database environment the function checks if the database exist. - * If the database doesn't exist we check the creation permissions. - * + * In step 3. Tests establishing connection to the database server. + * If it's a single database environment the function checks if the database exist. + * If the database doesn't exist we check the creation permissions. + * * @return int 1 when there is no problem; * 0 when a new database is impossible to be created, then the single/multiple database configuration is impossible too * -1 when there is no connection established. @@ -641,10 +641,10 @@ function test_db_connect($dbHostForm, $dbUsernameForm, $dbPassForm, $singleDbFor $dbConnect = -1; //Checking user credentials if (@Database::connect(array('server' => $dbHostForm, 'username' => $dbUsernameForm, 'password' => $dbPassForm)) !== false) { - $dbConnect = 1; + $dbConnect = 1; } else { $dbConnect = -1; - } + } return $dbConnect; //return 1, if no problems, "0" if, in case we can't create a new DB and "-1" if there is no connection. } @@ -679,7 +679,7 @@ function load_main_database($installation_settings, $db_script = '') { $sql_text = file_get_contents($db_script); } } else { - $db_script = api_get_path(SYS_CODE_PATH).'install/'.SYSTEM_MAIN_DATABASE_FILE; + $db_script = api_get_path(SYS_CODE_PATH).'install/'.SYSTEM_MAIN_DATABASE_FILE; if (file_exists($db_script)) { $sql_text = file_get_contents($db_script); } @@ -688,7 +688,7 @@ function load_main_database($installation_settings, $db_script = '') { //replace symbolic parameters with user-specified values foreach ($installation_settings as $key => $value) { $sql_text = str_replace($key, Database::escape_string($value), $sql_text); - } + } parse_sql_queries($sql_text); } @@ -708,7 +708,7 @@ function parse_sql_queries($sql_text) { //split in array of sql strings $sql_instructions = array(); - split_sql_file($sql_instructions, $sql_text); + split_sql_file($sql_instructions, $sql_text); //execute the sql instructions $count = count($sql_instructions); @@ -717,12 +717,12 @@ function parse_sql_queries($sql_text) { Database::query($this_sql_query); //UTF8 fix see #5678 /* - if (strpos(strtolower($this_sql_query), 'create table') === false) { + if (strpos(strtolower($this_sql_query), 'create table') === false) { Database::query($this_sql_query); } else { - //$this_sql_query .= substr($this_sql_query, strlen($this_sql_query), strlen($this_sql_query)-1); - $this_sql_query .= ' DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci '; - Database::query($this_sql_query); + //$this_sql_query .= substr($this_sql_query, strlen($this_sql_query), strlen($this_sql_query)-1); + $this_sql_query .= ' DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci '; + Database::query($this_sql_query); }*/ } } @@ -1049,7 +1049,7 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u echo '
| chamilo/courses/ | '.check_writable('../courses/').' | -||||||||
| '.get_lang('CourseTestWasCreated').' | '.$course_test_was_created.' | -||||||||
| '.get_lang('PermissionsForNewDirs').' | '.$dir_perm.' | -||||||||
| '.get_lang('PermissionsForNewFiles').' | '.$file_perm.' | -||||||||
| chamilo/home/ | '.check_writable('../home/').' | @@ -1342,7 +1342,7 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u } else { $error = false; // First, attempt to set writing permissions if we don't have them yet - $perm = api_get_permissions_for_new_directories(); + $perm = api_get_permissions_for_new_directories(); $perm_file = api_get_permissions_for_new_files(); $notwritable = array(); @@ -1377,11 +1377,11 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u $notwritable[] = $checked_writable; @chmod($checked_writable, $perm); } - + if ($course_test_was_created == false) { $error = true; } - + $checked_writable = api_get_path(SYS_PATH).'home/'; if (!is_writable($checked_writable)) { @@ -1405,13 +1405,13 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u printf(get_lang('NoWritePermissionPleaseReadInstallGuide'), ' ', ' '); echo ''; - + echo '||||||||
| - | |||||||||
| + |
';
echo ' ';
-
+
echo ''.get_lang('ConfigSettingsInfo').' main/inc/conf/configuration.php '; echo ' | ||||||||