diff --git a/main/install/index.php b/main/install/index.php
index d1c8074b37..ecf1e40b3d 100755
--- a/main/install/index.php
+++ b/main/install/index.php
@@ -103,7 +103,6 @@ error_reporting(E_ALL);
// Overriding the timelimit (for large campusses that have to be migrated).
@set_time_limit(0);
-$update_from_version_6 = array();
// Upgrading from any subversion of 1.9
$update_from_version_8 = array('1.9.0', '1.9.2','1.9.4','1.9.6', '1.9.6.1', '1.9.8', '1.9.8.1', '1.9.8.2', '1.9.10');
@@ -168,25 +167,6 @@ if (@$_POST['step2_install'] || @$_POST['step2_update_8'] || @$_POST['step2_upda
} else {
$badUpdatePath = true;
}
- } else { //step2_update_6, presumably
- if (empty($_POST['updatePath'])) {
- $_POST['step1'] = 1;
- } else {
- $emptyUpdatePath = false;
- $_POST['updatePath'] = api_add_trailing_slash($_POST['updatePath']);
- if (file_exists($_POST['updatePath'])) {
- //1.6.x
- $my_old_version = get_config_param('clarolineVersion', $_POST['updatePath']);
- if (in_array($my_old_version, $update_from_version_6)) {
- $_POST['step2'] = 1;
- $proposedUpdatePath = $_POST['updatePath'];
- } else {
- $badUpdatePath = true;
- }
- } else {
- $badUpdatePath = true;
- }
- }
}
}
} elseif (@$_POST['step1']) {
@@ -606,40 +586,23 @@ if (@$_POST['step2']) {
$tmp = get_config_param_from_db($dbHostForm, $dbUsernameForm, $dbPassForm, $db_name, 'InstitutionUrl');
if (!empty($tmp)) $institutionUrlForm = $tmp;
- if (in_array($my_old_version, $update_from_version_6)) { //for version 1.6
- $urlForm = get_config_param('rootWeb');
- $encryptPassForm = get_config_param('userPasswordCrypted');
- if (empty($encryptPassForm)) {
- $encryptPassForm = get_config_param('password_encryption');
- }
- // Managing the $encryptPassForm
- if ($encryptPassForm == '1') {
- $encryptPassForm = 'sha1';
- } elseif ($encryptPassForm == '0') {
- $encryptPassForm = 'none';
- }
-
- $allowSelfReg = get_config_param('allowSelfReg');
- $allowSelfRegProf = get_config_param('allowSelfRegProf');
-
- } else { //for version 1.8
- $urlForm = $_configuration['root_web'];
- $encryptPassForm = get_config_param('userPasswordCrypted');
- // Managing the $encryptPassForm
- if ($encryptPassForm == '1') {
- $encryptPassForm = 'sha1';
- } elseif ($encryptPassForm == '0') {
- $encryptPassForm = 'none';
- }
+ // For version 1.9
+ $urlForm = $_configuration['root_web'];
+ $encryptPassForm = get_config_param('userPasswordCrypted');
+ // Managing the $encryptPassForm
+ if ($encryptPassForm == '1') {
+ $encryptPassForm = 'sha1';
+ } elseif ($encryptPassForm == '0') {
+ $encryptPassForm = 'none';
+ }
- $allowSelfReg = false;
- $tmp = get_config_param_from_db($dbHostForm, $dbUsernameForm, $dbPassForm, $db_name, 'allow_registration');
- if (!empty($tmp)) $allowSelfReg = $tmp;
+ $allowSelfReg = false;
+ $tmp = get_config_param_from_db($dbHostForm, $dbUsernameForm, $dbPassForm, $db_name, 'allow_registration');
+ if (!empty($tmp)) $allowSelfReg = $tmp;
- $allowSelfRegProf = false;
- $tmp = get_config_param_from_db($dbHostForm, $dbUsernameForm, $dbPassForm, $db_name, 'allow_registration_as_teacher');
- if (!empty($tmp)) $allowSelfRegProf = $tmp;
- }
+ $allowSelfRegProf = false;
+ $tmp = get_config_param_from_db($dbHostForm, $dbUsernameForm, $dbPassForm, $db_name, 'allow_registration_as_teacher');
+ if (!empty($tmp)) $allowSelfRegProf = $tmp;
}
display_configuration_settings_form(
@@ -774,7 +737,6 @@ if (@$_POST['step2']) {
if (empty($my_old_version)) { $my_old_version = '1.8.6.2'; } //we guess
$_configuration['main_database'] = $dbNameForm;
- //$urlAppendPath = get_config_param('urlAppend');
Log::notice('Starting migration process from '.$my_old_version.' ('.time().')');
if ($userPasswordCrypted == '1') {
@@ -813,7 +775,6 @@ if (@$_POST['step2']) {
} else {
set_file_folder_permissions();
- //database_server_connect();
$manager = testDbConnect(
$dbHostForm,
$dbUsernameForm,
@@ -822,11 +783,11 @@ if (@$_POST['step2']) {
);
// Initialization of the database encoding to be used.
- Database::query("SET storage_engine = MYISAM;");
- Database::query("SET SESSION character_set_server='utf8';");
- Database::query("SET SESSION collation_server='utf8_general_ci';");
+ Database::query("SET storage_engine = INNODB;");
+ //Database::query("SET SESSION character_set_server='utf8';");
+ //Database::query("SET SESSION collation_server='utf8_general_ci';");
//Database::query("SET CHARACTER SET 'utf8';"); // See task #1802.
- Database::query("SET NAMES 'utf8';");
+ //Database::query("SET NAMES 'utf8';");
include 'install_db.inc.php';
include 'install_files.inc.php';
@@ -839,8 +800,10 @@ if (@$_POST['step2']) {
} elseif (@$_POST['step1'] || $badUpdatePath) {
//STEP 1 : REQUIREMENTS
//make sure that proposed path is set, shouldn't be necessary but...
- if (empty($proposedUpdatePath)) { $proposedUpdatePath = $_POST['updatePath']; }
- display_requirements($installType, $badUpdatePath, $proposedUpdatePath, $update_from_version_8, $update_from_version_6);
+ if (empty($proposedUpdatePath)) {
+ $proposedUpdatePath = $_POST['updatePath'];
+ }
+ display_requirements($installType, $badUpdatePath, $proposedUpdatePath, $update_from_version_8);
} else {
// This is the start screen.
display_language_selection();
diff --git a/main/install/install.lib.php b/main/install/install.lib.php
index 1510cb7054..0fec1481e0 100755
--- a/main/install/install.lib.php
+++ b/main/install/install.lib.php
@@ -690,6 +690,7 @@ function fill_track_countries_table($trackCountriesTable)
*/
function load_main_database($installation_settings, $dbScript = '')
{
+ $sql_text = null;
if (!empty($dbScript)) {
if (file_exists($dbScript)) {
$sql_text = file_get_contents($dbScript);
@@ -708,168 +709,10 @@ function load_main_database($installation_settings, $dbScript = '')
}
global $manager;
- $manager->getConnection()->prepare($sql_text);
- //parse_sql_queries($sql_text);
+ $result = $manager->getConnection()->prepare($sql_text);
+ $result->execute();
}
-/**
- * Creates the structure of the stats database
- * @param string $dbScript Name of the file containing the SQL script inside the install directory
- */
-function load_database_script($dbScript)
-{
- $dbScript = api_get_path(SYS_CODE_PATH).'install/'.$dbScript;
- if (file_exists($dbScript)) {
- $sql_text = file_get_contents($dbScript);
- }
- parse_sql_queries($sql_text);
-}
-
-/**
- * Parse SQL queries
- * @param string $sql_text SQL code
- */
-function parse_sql_queries($sql_text)
-{
- //split in array of sql strings
- $sql_instructions = array();
- split_sql_file($sql_instructions, $sql_text);
-
- //execute the sql instructions
- $count = count($sql_instructions);
- for ($i = 0; $i < $count; $i++) {
- $this_sql_query = $sql_instructions[$i]['query'];
-
- Database::query($this_sql_query);
- //UTF8 fix see #5678
- /*
- 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);
- }*/
- }
-}
-
-
-/**
- * Function copied and adapted from phpMyAdmin 2.6.0 PMA_splitSqlFile (also GNU GPL)
- * Removes comment lines and splits up large sql files into individual queries
- * Last revision: September 23, 2001 - gandon
- * @param array $ret the split sql commands
- * @param string $sql the sql commands
- * @return boolean always true
- */
-function split_sql_file(&$ret, $sql)
-{
- // do not trim, see bug #1030644
- //$sql = trim($sql);
- $sql = rtrim($sql, "\n\r");
- $sql_len = strlen($sql);
- $char = '';
- $string_start = '';
- $in_string = false;
- $nothing = true;
- $time0 = time();
-
- for ($i = 0; $i < $sql_len; ++$i) {
- $char = $sql[$i];
-
- // We are in a string, check for not escaped end of strings except for
- // back-quotes that can't be escaped
- if ($in_string) {
- for (;;) {
- $i = strpos($sql, $string_start, $i);
- // No end of string found -> add the current substring to the
- // returned array
- if (!$i) {
- $ret[] = $sql;
- return true;
- } elseif ($string_start == '`' || $sql[$i - 1] != '\\') {
- // Back-quotes or no backslashes before quotes: it's indeed the
- // end of the string -> exit the loop
- $string_start = '';
- $in_string = false;
- break;
- } else { // one or more Backslashes before the presumed end of string...
- // ... first checks for escaped backslashes
- $j = 2;
- $escaped_backslash = false;
- while ($i - $j > 0 && $sql[$i - $j] == '\\') {
- $escaped_backslash = !$escaped_backslash;
- $j++;
- }
- // ... if escaped backslashes: it's really the end of the
- // string -> exit the loop
- if ($escaped_backslash) {
- $string_start = '';
- $in_string = false;
- break;
- } else { // ... else loop
- $i++;
- }
- } // end if...elseif...else
- } // end for
- // end if (in string)
-
- // lets skip comments (/*, -- and #)
- } elseif (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') ||
- $char == '#' ||
- ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')
- ) {
- $i = strpos($sql, $char == '/' ? '*/' : "\n", $i);
- // didn't we hit end of string?
- if ($i === false) {
- break;
- }
- if ($char == '/') {
- $i++;
- }
-
- // We are not in a string, first check for delimiter...
- } elseif ($char == ';') {
- // if delimiter found, add the parsed part to the returned array
- $ret[] = array('query' => substr($sql, 0, $i), 'empty' => $nothing);
- $nothing = true;
- $sql = ltrim(substr($sql, min($i + 1, $sql_len)));
- $sql_len = strlen($sql);
- if ($sql_len) {
- $i = -1;
- } else {
- // The submitted statement(s) end(s) here
- return true;
- }
- // end elseif (is delimiter)
-
- // ... then check for start of a string,...
- } elseif (($char == '"') || ($char == '\'') || ($char == '`')) {
- $in_string = true;
- $nothing = false;
- $string_start = $char;
- // end elseif (is start of string)
-
- } elseif ($nothing) {
- $nothing = false;
- }
-
- // Send a fake header each 30 sec. to bypass browser timeout
- $time1 = time();
- if ($time1 >= $time0 + 30) {
- $time0 = $time1;
- header('X-pmaPing: Pong');
- } // end if
- } // end for
-
- // add any rest to the returned array
- if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) {
- $ret[] = array('query' => $sql, 'empty' => $nothing);
- }
-
- return true;
-} // end of the 'split_sql_file()' function
-
/**
* Get an SQL file's contents
*
@@ -1085,8 +928,7 @@ function display_language_selection()
* @param string $installType
* @param boolean $badUpdatePath
* @param string The updatePath given (if given)
- * @param array $update_from_version_8 The different subversions from version 1.8
- * @param array $update_from_version_6 The different subversions from version 1.6
+ * @param array $update_from_version_8 The different subversions from version 1.9
*
* @author unknow
* @author Patrick Cool '.display_step_sequence().get_lang('Requirements')."