Merge branch '1.10.x' into bootstrap

1.10.x
aragonc 11 years ago
commit c094455ad2
  1. 1
      main/inc/lib/hook/HookCreateUser.php
  2. 4
      main/install/database.sql
  3. 18
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  4. 29
      main/install/update-db-1.9.0-1.10.0.inc.php
  5. 5
      plugin/createdrupaluser/src/HookCreateDrupalUser.php
  6. 6
      tests/scripts/course2session.php

@ -28,7 +28,6 @@ class HookCreateUser extends HookEvent implements HookCreateUserEventInterface
foreach ($this->observers as $observer) {
$observer->hookCreateUser($this);
}
return 1;
}
}

@ -459,7 +459,7 @@ DROP TABLE IF EXISTS session;
CREATE TABLE IF NOT EXISTS session (
id smallint unsigned NOT NULL auto_increment,
id_coach int unsigned NOT NULL default '0',
name char(50) NOT NULL default '',
name char(100) NOT NULL default '',
nbr_courses smallint unsigned NOT NULL default '0',
nbr_users mediumint unsigned NOT NULL default '0',
nbr_classes mediumint unsigned NOT NULL default '0',
@ -4729,5 +4729,5 @@ CREATE TABLE c_attendance_calendar_rel_group (
-- Version
LOCK TABLES settings_current WRITE;
UPDATE settings_current SET selected_value = '1.10.0.27' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.30' WHERE variable = 'chamilo_database_version';
UNLOCK TABLES;

@ -39,17 +39,28 @@ ALTER TABLE gradebook_category ADD COLUMN generate_certificates TINYINT NOT NULL
RENAME TABLE track_e_exercices TO track_e_exercises;
ALTER TABLE track_e_access ADD COLUMN c_id int NOT NULL;
UPDATE track_e_access SET c_id = (SELECT id FROM course WHERE code = access_cours_code);
ALTER TABLE track_e_default ADD COLUMN c_id int NOT NULL;
UPDATE track_e_default SET c_id = (SELECT id FROM course WHERE code = default_cours_code);
ALTER TABLE track_e_lastaccess ADD COLUMN c_id int NOT NULL;
UPDATE track_e_lastaccess SET c_id = (SELECT id FROM course WHERE code = access_cours_code);
ALTER TABLE track_e_exercises ADD COLUMN c_id int NOT NULL;
UPDATE track_e_exercises SET c_id = (SELECT id FROM course WHERE code = exe_cours_id);
ALTER TABLE track_e_downloads ADD COLUMN c_id int NOT NULL;
UPDATE track_e_downloads SET c_id = (SELECT id FROM course WHERE code = down_cours_id);
ALTER TABLE track_e_hotpotatoes ADD COLUMN c_id int NOT NULL;
UPDATE track_e_hotpotatoes SET c_id = (SELECT id FROM course WHERE code = exe_cours_id);
ALTER TABLE track_e_links ADD COLUMN c_id int NOT NULL;
UPDATE track_e_links SET c_id = (SELECT id FROM course WHERE code = links_cours_id);
ALTER TABLE track_e_course_access ADD COLUMN c_id int NOT NULL;
UPDATE track_e_course_access SET c_id = (SELECT id FROM course WHERE code = course_code);
ALTER TABLE track_e_online ADD COLUMN c_id int NOT NULL;
UPDATE track_e_online SET c_id = (SELECT id FROM course WHERE code = course);
ALTER TABLE track_e_attempt ADD COLUMN c_id int NOT NULL;
UPDATE track_e_attempt SET c_id = (SELECT id FROM course WHERE code = course_code);
ALTER TABLE track_e_default ADD COLUMN session_id int NOT NULL;
DELETE FROM settings_current WHERE variable = 'wcag_anysurfer_public_pages';
DELETE FROM settings_options WHERE variable = 'wcag_anysurfer_public_pages';
DELETE FROM settings_current WHERE variable = 'advanced_filemanager';
@ -68,14 +79,14 @@ ALTER TABLE user MODIFY COLUMN user_id int unsigned DEFAULT null;
ALTER TABLE user DROP PRIMARY KEY;
ALTER TABLE user ADD COLUMN id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT AFTER user_id;
UPDATE user SET id = user_id;
UPDATE user SET registration_date = NULL WHERE registration_date = '0000-00-00 00:00:00';
UPDATE user SET expiration_date = NULL WHERE expiration_date = '0000-00-00 00:00:00';
ALTER TABLE user MODIFY COLUMN chatcall_date datetime default NULL;
ALTER TABLE user MODIFY COLUMN chatcall_text varchar(50) default NULL;
ALTER TABLE user MODIFY COLUMN chatcall_user_id int unsigned default '0';
ALTER TABLE user MODIFY COLUMN expiration_date datetime default NULL;
ALTER TABLE user MODIFY COLUMN registration_date datetime NOT NULL;
UPDATE user SET registration_date = NULL WHERE registration_date = '0000-00-00 00:00:00';
UPDATE user SET expiration_date = NULL WHERE expiration_date = '0000-00-00 00:00:00';
ALTER TABLE course ADD COLUMN add_teachers_to_sessions_courses tinyint NOT NULL default 0;
@ -94,6 +105,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_mathjax', 'false', 'No');
ALTER TABLE session MODIFY COLUMN name char(100) NOT NULL DEFAULT '';
-- xxCOURSExx
@ -113,4 +125,4 @@ CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT PRIMARY KEY NOT
CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (id int NOT NULL auto_increment PRIMARY KEY, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL);
-- Do not move this query
UPDATE settings_current SET selected_value = '1.10.0.27' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.30' WHERE variable = 'chamilo_database_version';

@ -94,33 +94,8 @@ if (defined('SYSTEM_INSTALLATION')) {
}
if (INSTALL_TYPE_UPDATE == 'update') {
// Updating track tables with c_id
$res = iDatabase::query("SELECT id, code FROM $dbNameForm.course");
$result = iDatabase::query($sql);
$courses = Database::store_result($result);
foreach ($courses as $course) {
$courseId = $course['id'];
$courseCode = $course['code'];
$fields = array(
'track_e_access' => 'access_cours_code',
'track_e_default' => 'default_cours_code',
'track_e_lastaccess' => 'access_cours_code',
'track_e_downloads' => 'down_cours_id',
'track_e_hotpotatoes' => 'exe_cours_id',
'track_e_links' => 'links_cours_id',
'track_e_course_access' => 'course_code',
'track_e_online' => 'course',
'track_e_attempt' => 'course_code',
'track_e_exercises' => 'exe_cours_id'
);
foreach ($fields as $table => $key) {
$sql = "UPDATE $dbNameForm.$table SET c_id = $courseId
WHERE $key = '$courseCode'";
iDatabase::query($sql);
}
}
// Updating track tables with c_id -> moved to migrate-db
}
}

@ -54,7 +54,10 @@ class HookCreateDrupalUser extends HookObserver implements HookCreateUserObserve
);
$client = new SoapClient(null, $options);
$client->addUser($fields, $extraFields);
$drupalUserId = $client->addUser($fields, $extraFields);
if ($drupalUserId !== false) {
UserManager::update_extra_field_value($return, 'drupal_user_id', $drupalUserId);
}
}
}

@ -12,6 +12,8 @@ exit;
require __DIR__ . '/../../main/inc/global.inc.php';
$debug = 1;
// Who will be the general coach assigned to all sessions created?
$generalCoach = 'username';
// List of tables that will need an update
$tables = array(
@ -136,7 +138,7 @@ foreach ($res as $course) {
0,
0,
0,
'info@contidosdixitais.com',
$generalCoach,
0,
SESSION_VISIBLE_READ_ONLY
);
@ -199,4 +201,4 @@ foreach ($res as $course) {
}
if ($debug) {
echo "End of moving process" . PH_EOL;
}
}

Loading…
Cancel
Save