Fix upgrade process.

1.10.x
Julio Montoya 9 years ago
parent d07f685968
commit c747ae0c5e
  1. 4
      app/Migrations/Schema/V110/Version110.php
  2. 53
      main/install/index.php
  3. 3
      main/install/install.lib.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_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_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 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_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 (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_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_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)"); $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)");

@ -725,38 +725,43 @@ if (@$_POST['step2']) {
echo '<div id="details" style="display:none">'; echo '<div id="details" style="display:none">';
// Migrate using the migration files located in: // Migrate using the migration files located in:
// src/Chamilo/CoreBundle/Migrations/Schema/V110 // src/Chamilo/CoreBundle/Migrations/Schema/V110
migrate( $result = migrate(
110, 110,
$manager $manager
); );
echo '</div>'; echo '</div>';
fixIds($manager); if ($result) {
error_log('Migrations files were executed.');
include 'update-files-1.9.0-1.10.0.inc.php';
// Only updates the configuration.inc.php with the new version fixIds($manager);
include 'update-configuration.inc.php';
include 'update-files-1.9.0-1.10.0.inc.php';
$configurationFiles = array( // Only updates the configuration.inc.php with the new version
'mail.conf.php', include 'update-configuration.inc.php';
'profile.conf.php',
'course_info.conf.php', $configurationFiles = array(
'add_course.conf.php', 'mail.conf.php',
'events.conf.php', 'profile.conf.php',
'auth.conf.php', 'course_info.conf.php',
'portfolio.conf.php' 'add_course.conf.php',
); 'events.conf.php',
'auth.conf.php',
foreach ($configurationFiles as $file) { 'portfolio.conf.php'
if (file_exists(api_get_path(SYS_CODE_PATH) . 'inc/conf/'.$file)) { );
copy(
api_get_path(SYS_CODE_PATH).'inc/conf/'.$file, foreach ($configurationFiles as $file) {
api_get_path(CONFIGURATION_PATH).$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; break;
default: default:
break; break;

@ -2021,11 +2021,14 @@ function migrate($chamiloVersion, EntityManager $manager)
if ($debug) { if ($debug) {
echo 'DONE'.$nl; echo 'DONE'.$nl;
} }
return true;
} catch (Exception $ex) { } catch (Exception $ex) {
if ($debug) { if ($debug) {
echo 'ERROR: '.$ex->getMessage().$nl; echo 'ERROR: '.$ex->getMessage().$nl;
} }
} }
return false;
} }
/** /**

Loading…
Cancel
Save