From c747ae0c5e1af132511c7d7074948d715fc1c19c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 22 Sep 2015 19:17:16 +0200 Subject: [PATCH] Fix upgrade process. --- app/Migrations/Schema/V110/Version110.php | 4 +- main/install/index.php | 53 +++++++++++++---------- main/install/install.lib.php | 3 ++ 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/app/Migrations/Schema/V110/Version110.php b/app/Migrations/Schema/V110/Version110.php index 86f8aa013f..3c45a199f0 100644 --- a/app/Migrations/Schema/V110/Version110.php +++ b/app/Migrations/Schema/V110/Version110.php @@ -29,8 +29,8 @@ class Version110 extends AbstractMigrationChamilo $this->addSql("CREATE TABLE IF NOT EXISTS hook_observer( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, path varchar(255) NOT NULL, plugin_name varchar(255) NULL, PRIMARY KEY PK_hook_management_hook_observer(id))"); $this->addSql("CREATE TABLE IF NOT EXISTS hook_event( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, description varchar(255), PRIMARY KEY PK_hook_management_hook_event(id))"); $this->addSql("CREATE TABLE IF NOT EXISTS hook_call( id int UNSIGNED NOT NULL AUTO_INCREMENT, hook_event_id int UNSIGNED NOT NULL, hook_observer_id int UNSIGNED NOT NULL, type tinyint NOT NULL, hook_order int UNSIGNED NOT NULL, enabled tinyint NOT NULL, PRIMARY KEY PK_hook_management_hook_call(id))"); - $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (iid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, id INT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL)"); - $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (iid INT PRIMARY KEY NOT NULL AUTO_INCREMENT, id INT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL)"); + $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (id INT, work_id INT NOT NULL, document_id INT NOT NULL, c_id INT NOT NULL)"); + $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (id INT, work_id INT NOT NULL, user_id INT NOT NULL, c_id INT NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (iid int NOT NULL auto_increment PRIMARY KEY, id INT, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL)"); diff --git a/main/install/index.php b/main/install/index.php index 577d77d264..b06c935a14 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -725,38 +725,43 @@ if (@$_POST['step2']) { echo ''; - fixIds($manager); - - include 'update-files-1.9.0-1.10.0.inc.php'; - // Only updates the configuration.inc.php with the new version - include 'update-configuration.inc.php'; - - $configurationFiles = array( - 'mail.conf.php', - 'profile.conf.php', - 'course_info.conf.php', - 'add_course.conf.php', - 'events.conf.php', - 'auth.conf.php', - 'portfolio.conf.php' - ); - - foreach ($configurationFiles as $file) { - if (file_exists(api_get_path(SYS_CODE_PATH) . 'inc/conf/'.$file)) { - copy( - api_get_path(SYS_CODE_PATH).'inc/conf/'.$file, - api_get_path(CONFIGURATION_PATH).$file - ); + if ($result) { + error_log('Migrations files were executed.'); + + fixIds($manager); + + include 'update-files-1.9.0-1.10.0.inc.php'; + // Only updates the configuration.inc.php with the new version + include 'update-configuration.inc.php'; + + $configurationFiles = array( + 'mail.conf.php', + 'profile.conf.php', + 'course_info.conf.php', + 'add_course.conf.php', + 'events.conf.php', + 'auth.conf.php', + 'portfolio.conf.php' + ); + + foreach ($configurationFiles as $file) { + if (file_exists(api_get_path(SYS_CODE_PATH) . 'inc/conf/'.$file)) { + copy( + api_get_path(SYS_CODE_PATH).'inc/conf/'.$file, + api_get_path(CONFIGURATION_PATH).$file + ); + } } + } else { + error_log('There was an error during running migrations. Check error.log'); } - break; default: break; diff --git a/main/install/install.lib.php b/main/install/install.lib.php index a8d3f6b3af..10c7a4d793 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -2021,11 +2021,14 @@ function migrate($chamiloVersion, EntityManager $manager) if ($debug) { echo 'DONE'.$nl; } + return true; } catch (Exception $ex) { if ($debug) { echo 'ERROR: '.$ex->getMessage().$nl; } } + + return false; } /**