Feature #272 - Installation scripts: More code formatting.

skala
Ivan Tcholakov 15 years ago
parent f7c7036ed5
commit 5697c5aa64
  1. 17
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql
  2. 25
      main/install/update-db-1.6.x-1.8.0.inc.php
  3. 8
      main/install/update-db-1.8.0-1.8.2.inc.php
  4. 6
      main/install/update-db-1.8.2-1.8.3.inc.php
  5. 4
      main/install/update-db-1.8.3-1.8.4.inc.php
  6. 9
      main/install/update-db-1.8.4-1.8.5.inc.php
  7. 15
      main/install/update-db-1.8.5-1.8.6.inc.php
  8. 9
      main/install/update-db-1.8.6-1.8.6.1.inc.php
  9. 13
      main/install/update-db-1.8.6.1-1.8.6.2.inc.php
  10. 42
      main/install/update-db-1.8.6.2-1.8.7.inc.php
  11. 17
      main/install/update-db-scorm-1.6.x-1.8.0.inc.php
  12. 6
      main/install/update-files-1.6.x-1.8.0.inc.php
  13. 7
      main/install/update-files-1.8.3-1.8.4.inc.php
  14. 7
      main/install/update-files-1.8.4-1.8.5.inc.php
  15. 47
      main/install/update-files-1.8.5-1.8.6.inc.php
  16. 13
      main/install/update-files-1.8.6-1.8.6.1.inc.php
  17. 1
      main/install/update-files-1.8.6.1-1.8.6.2.inc.php
  18. 1
      main/install/update-files-1.8.6.2-1.8.7.inc.php

@ -20,6 +20,7 @@ ALTER TABLE course_rel_user ADD COLUMN relation_type int NOT NULL default 0;
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url, access_url_changeable) VALUES ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook',1,0);
INSERT INTO course_module (name, link, image, `row`, `column`, position) VALUES ('notebook','notebook/index.php','notebook.gif',2,1,'basic');
UPDATE settings_current SET selected_value = '1.8.7.10308' WHERE variable = 'dokeos_database_version';
ALTER TABLE course DROP PRIMARY KEY , ADD UNIQUE KEY code (code);
ALTER TABLE course ADD id int NOT NULL auto_increment PRIMARY KEY FIRST;
CREATE TABLE block (id INT NOT NULL auto_increment, name VARCHAR(255) NULL, description TEXT NULL, path VARCHAR(255) NOT NULL, controller VARCHAR(100) NOT NULL, active TINYINT NOT NULL default 1, PRIMARY KEY(id));
@ -27,20 +28,6 @@ ALTER TABLE block ADD UNIQUE(path);
INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(1, 'dashboard', 'dashboard', 0, 0);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsDashboard', 1);
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('users_can_change_timezone', 'timezones', 'radio', 'Timezones', 'true', 'AllowUsersTimezoneTitle','AllowUsersTimezoneComment',NULL,'Timezones', 1);
INSERT INTO settings_options (variable, value, display_text) VALUES ('users_can_change_timezone', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('users_can_change_timezone', 'false', 'No');
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('timezone_value', 'timezones', 'select', 'Timezones', 'UTC', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1);
ALTER TABLE user_field CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE course_field CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE course_field_values CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE session_field CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE session_field_values CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE user_field_options CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE user_field_values CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE access_url CHANGE tms tms DATETIME NOT NULL default '0000-00-00 00:00:00';
UPDATE settings_current SET selected_value = '1.8.7.10365' WHERE variable = 'dokeos_database_version';
-- xxSTATSxx
CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int NOT NULL, session_id int NOT NULL default 0);
@ -63,4 +50,4 @@ ALTER TABLE attendance_result ADD INDEX(attendance_id);
ALTER TABLE attendance_result ADD INDEX(user_id);
CREATE TABLE attendance (id int NOT NULL auto_increment PRIMARY KEY, name text NOT NULL, description TEXT NULL, active tinyint(3) NOT NULL default 1, attendance_qualify_title varchar(255) NULL, attendance_qualify_max int NOT NULL default 0, attendance_weight float(6,2) NOT NULL default '0.0', session_id int NOT NULL default 0);
ALTER TABLE attendance ADD INDEX(session_id);
ALTER TABLE attendance ADD INDEX(active);
ALTER TABLE attendance ADD INDEX(active);

@ -56,7 +56,7 @@ if (function_exists('ini_set')) {
//check if we come from index.php or update_courses.php - otherwise display error msg
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//check if the current Dokeos install is elligible for update
if (empty ($updateFromConfigFile) || !file_exists($_POST['updatePath'].$updateFromConfigFile) || !in_array(get_config_param('clarolineVersion'), $update_from_version_6)) {
if (empty($updateFromConfigFile) || !file_exists($_POST['updatePath'].$updateFromConfigFile) || !in_array(get_config_param('clarolineVersion'), $update_from_version_6)) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
'.get_lang('PleasGoBackToStep1').'.
@ -78,11 +78,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -254,11 +254,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i = 0;
$list = array();
//while( ($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach($list as $row_course) {
foreach ($list as $row_course) {
//now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
@ -268,7 +268,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}
@ -291,7 +291,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
" WHERE cu.course_code = '".$row_course['code']."' " .
" AND u.user_id = cu.user_id";
$res_uc = Database::query($sql_uc);
while($user_row = Database::fetch_array($res_uc)) {
while ($user_row = Database::fetch_array($res_uc)) {
$users_list[$user_row['fn'].' '.$user_row['ln']] = $user_row['ui'];
}
@ -445,9 +445,9 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
if (defined('SYSTEM_INSTALLATION')) {
if ($singleDbForm) {
if(empty($dbStatsForm)) $dbStatsForm = $dbNameForm;
if(empty($dbScormForm)) $dbScormForm = $dbNameForm;
if(empty($dbUserForm)) $dbUserForm = $dbNameForm;
if (empty($dbStatsForm)) $dbStatsForm = $dbNameForm;
if (empty($dbScormForm)) $dbScormForm = $dbNameForm;
if (empty($dbUserForm)) $dbUserForm = $dbNameForm;
}
//deal with migrate-db-1.6.x-1.8.0-post.sql
//get the main queries list (m_q_list)
@ -567,7 +567,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
foreach($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/',"$1 $prefix$2$3",$query);
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix$2$3", $query);
}
if ($only_test) {
error_log("Database::query(".$row['db_name'].",$query)", 0);
@ -604,6 +604,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
} else {
echo 'You are not allowed here !';
}
}

@ -77,7 +77,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
@ -253,7 +253,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$list[] = $row;
$i++;
}
foreach($list as $row_course) {
foreach ($list as $row_course) {
//now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
@ -263,9 +263,9 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/',"$1 $prefix{$row_course['db_name']}_$2$3",$query);
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}
if ($only_test) {

@ -77,11 +77,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -136,7 +136,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
//get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-1.8.2-1.8.3-pre.sql','main');
$m_q_list = get_sql_file_contents('migrate-db-1.8.2-1.8.3-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
/**

@ -76,11 +76,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}

@ -14,7 +14,6 @@
==============================================================================
*/
//load helper functions
require_once 'install_upgrade.lib.php';
@ -58,11 +57,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -184,7 +183,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
error_log('Database '.$dbUserForm.' was not found, skipping', 0);
} else {
Database::select_db($dbUserForm);
foreach($u_q_list as $query){
foreach ($u_q_list as $query){
if ($only_test) {
error_log("Database::query($dbUserForm,$query)", 0);
error_log("In $dbUserForm, executed: $query", 0);
@ -272,7 +271,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$mysql = "SELECT * FROM $mytable WHERE min_score != 0 AND prerequisite != ''";
$myres = Database::query($query);
if ($myres!==false && Database::num_rows($myres) > 0) {
if ($myres !== false && Database::num_rows($myres) > 0) {
while ($myrow = Database::fetch_array($myres)) {
if (is_numeric($myrow['prerequisite'])) {
$mysql2 = "UPDATE $mytable SET mastery_score = '".$myrow['min_score']."' WHERE id = '".$myrow['prerequisite']."'";

@ -14,7 +14,6 @@
==============================================================================
*/
//load helper functions
require_once 'install_upgrade.lib.php';
require_once '../inc/lib/image.lib.php';
@ -59,11 +58,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -129,7 +128,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
*/
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif(!in_array($dbNameForm, $dblist)) {
} elseif (!in_array($dbNameForm, $dblist)) {
error_log('Database '.$dbNameForm.' was not found, skipping', 0);
} else {
Database::select_db($dbNameForm);
@ -1135,7 +1134,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif(!in_array($dbNameForm, $dblist)) {
} elseif (!in_array($dbNameForm, $dblist)) {
error_log('Database '.$dbNameForm.' was not found, skipping', 0);
} else {
Database::select_db($dbNameForm);
@ -1147,11 +1146,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i = 0;
$list = array();
//while( ($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach($list as $row_course) {
foreach ($list as $row_course) {
//now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
@ -1161,7 +1160,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}

@ -14,7 +14,6 @@
==============================================================================
*/
//load helper functions
require_once 'install_upgrade.lib.php';
require_once '../inc/lib/image.lib.php';
@ -59,11 +58,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -236,7 +235,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i = 0;
$list = array();
//while( ($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
@ -250,7 +249,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}

@ -14,7 +14,6 @@
==============================================================================
*/
//load helper functions
require_once 'install_upgrade.lib.php';
require_once '../inc/lib/image.lib.php';
@ -59,11 +58,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -330,7 +329,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif(!in_array($dbNameForm, $dblist)) {
} elseif (!in_array($dbNameForm, $dblist)) {
error_log('Database '.$dbNameForm.' was not found, skipping', 0);
} else {
Database::select_db($dbNameForm);
@ -342,11 +341,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i = 0;
$list = array();
//while( ($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach($list as $row_course) {
foreach ($list as $row_course) {
//now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
@ -356,7 +355,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}

@ -14,7 +14,6 @@
==============================================================================
*/
//load helper functions
require_once 'install_upgrade.lib.php';
require_once '../inc/lib/image.lib.php';
@ -59,11 +58,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$dbScormForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbScormForm);
if (!empty ($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
if (!empty($dbPrefixForm) && strpos($dbScormForm, $dbPrefixForm) !== 0) {
$dbScormForm = $dbPrefixForm.$dbScormForm;
}
if (empty ($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
if (empty($dbScormForm) || $dbScormForm == 'mysql' || $dbScormForm == $dbPrefixForm) {
$dbScormForm = $dbPrefixForm.'scorm';
}
@ -149,29 +148,26 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//
// now clean the deprecated id_coach field from the session_rel_course
// table
// now clean the deprecated id_coach field from the session_rel_course table
/*
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-post.sql','main');
if(count($m_q_list)>0)
{
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-post.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// We connect to the right DB first to make sure we can use the queries
// without a database name
if(strlen($dbNameForm)>40){
error_log('Database name '.$dbNameForm.' is too long, skipping',0);
}elseif(!in_array($dbNameForm,$dblist)){
error_log('Database '.$dbNameForm.' was not found, skipping',0);
}else{
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
error_log('Database '.$dbNameForm.' was not found, skipping', 0);
} else {
Database::select_db($dbNameForm);
foreach($m_q_list as $query){
if($only_test){
error_log("Database::query($dbNameForm,$query)",0);
}else{
foreach ($m_q_list as $query) {
if ($only_test) {
error_log("Database::query($dbNameForm,$query)", 0);
} else {
$res = Database::query($query);
if($log)
{
error_log("In $dbNameForm, executed: $query",0);
if ($log) {
error_log("In $dbNameForm, executed: $query", 0);
}
}
}
@ -276,8 +272,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
if (Database::num_rows($res) > 0) {
$i = 0;
$list = array();
//while( ($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
//while (($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
@ -291,7 +287,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
Database::select_db($row_course['db_name']);
}
foreach($c_q_list as $query) {
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
$query = preg_replace('/^(UPDATE|ALTER TABLE|CREATE TABLE|DROP TABLE|INSERT INTO|DELETE FROM)\s+(\w*)(.*)$/', "$1 $prefix{$row_course['db_name']}_$2$3", $query);
}

@ -5,6 +5,7 @@
* @package chamilo.scorm
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Include mandatory libraries
*/
@ -354,7 +355,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
if ($row['lp_id'] != $lp_id) {
//apply changes to the database and clean tool arrays
$last = 0;
foreach($order_item as $order_id => $item_id) {
foreach ($order_item as $order_id => $item_id) {
$next = 0;
if (!empty($order_item[$order_id+1])) {
$next = $order_item[$order_id+1];
@ -608,11 +609,11 @@ if ($loglevel > 0) { error_log("Now starting migration of scorm tables from glob
$scorm_main = $dbScormForm.'.'.TABLE_SCORM_MAIN;
$scorm_item = $dbScormForm.'.'.TABLE_SCORM_SCO_DATA;
//$lp_main = Database::get_course_table(TABLE_LEARNPATH_MAIN,$db);
//$lp_main = Database::get_course_table(TABLE_LEARNPATH_MAIN,$db);
$course_pref = $table_prefix;
$lp_ids = array();
$lp_item_ids = array();
$lp_item_refs = array();
$lp_ids = array();
$lp_item_ids = array();
$lp_item_refs = array();
$lp_course = array();
$lp_course_code = array();
$scorm_lp_paths = array();
@ -626,7 +627,7 @@ $res_crs = Database::query($sql_crs);
$num = Database::num_rows($res_crs);
//prepare an array that will contain course codes and for each course code a list of lps [by path prefixed by '/']
$scorms =array();
$scorms = array();
$course_code_swap = '';
$scormdocuments_lps = array();
while ($course_row = Database::fetch_array($res_crs)) {
@ -680,7 +681,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
if ($loglevel > 2) { error_log(" Trying subdirectories...", 0); }
$dh = opendir($courses_dir);
while ($entry = readdir($dh)) {
if (substr($entry, 0, 1)!='.') {
if (substr($entry, 0, 1) != '.') {
if (is_dir($courses_dir."/".$entry)) {
if (is_file($courses_dir."/".$entry."/imsmanifest.xml")) {
if ($loglevel > 2) { error_log(". .. and found $courses_dir/$entry/imsmanifest.xml!", 0); }
@ -1167,7 +1168,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
$new_id = $lp_item_refs[$in_id][$subarray['identifier']];
$next = 0;
$dsp = $subarray['rel_order'];
if ($subarray['level']>$level) {
if ($subarray['level'] > $level) {
//getting one level deeper, just consult
$parent_id = $previous;
array_push($stock,$previous);

@ -191,12 +191,6 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
error_log('Renaming '.$updatePath.'claroline/upload/video to '.$pathForm.'main/upload/video', 0);
rename($updatePath.'claroline/upload/video', $pathForm.'main/upload/video');
/*
if (defined('SYSTEM_INSTALLATION')) {
//nothing to do this time
}
*/
} else {
echo 'You are not allowed here !';

@ -36,6 +36,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
@ -49,10 +50,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$found_stable = false;
foreach ($file as $line) {
$ignore = false;
if(stristr($line, '$_configuration[\'dokeos_version\']')) {
if (stristr($line, '$_configuration[\'dokeos_version\']')) {
$found_version = true;
$line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
} elseif(stristr($line, '$_configuration[\'dokeos_stable\']')) {
} elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line, '?>')) {
@ -67,7 +68,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
fwrite($fh, '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
}
if (!$found_stable) {
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
}
fwrite($fh, '?>');
fclose($fh);

@ -15,6 +15,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
@ -33,8 +34,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
} elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n";
} elseif(stristr($line, '?>')) {
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line, '?>')) {
//ignore the line
$ignore = true;
}
@ -46,7 +47,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
fwrite($fh, '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
}
if (!$found_stable) {
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
}
fwrite($fh, '?>');
fclose($fh);

@ -15,6 +15,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
@ -31,12 +32,12 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
if (stristr($line, '$_configuration[\'dokeos_version\']')) {
$found_version = true;
$line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
} elseif(stristr($line, '$_configuration[\'dokeos_stable\']')) {
} elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n";
} elseif(stristr($line,'$userPasswordCrypted')) {
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line,'$userPasswordCrypted')) {
$line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n";
} elseif(stristr($line, '?>')) {
} elseif (stristr($line, '?>')) {
//ignore the line
$ignore = true;
}
@ -48,7 +49,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
fwrite($fh, '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
}
if (!$found_stable) {
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
}
fwrite($fh, '?>');
fclose($fh);
@ -68,7 +69,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//$old_umask = umask(0); // This function is not thread-safe.
while($courses_directories = Database::fetch_array($result)) {
while ($courses_directories = Database::fetch_array($result)) {
$currentCourseRepositorySys = $sys_course_path.$courses_directories['directory'].'/';
@ -82,45 +83,45 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
//move everything to the new hierarchy (from old path to new path)
error_log('Renaming '.$origCRS.' to '.$sys_course_path.$courses_directories['directory'], 0);
rename($origCRS,$sys_course_path.$courses_directories['directory']);
error_log('Creating dirs in '.$currentCourseRepositorySys,0);
error_log('Creating dirs in '.$currentCourseRepositorySys, 0);
//DOCUMENT FOLDER
//document > shared_folder
if(!is_dir($currentCourseRepositorySys."document/shared_folder")){
mkdir($currentCourseRepositorySys."document/shared_folder",$perm);
if (!is_dir($currentCourseRepositorySys."document/shared_folder")) {
mkdir($currentCourseRepositorySys."document/shared_folder", $perm);
}
//UPLOAD FOLDER
//upload > forum > images
if(!is_dir($currentCourseRepositorySys."upload/forum/images")){
mkdir($currentCourseRepositorySys."upload/forum/images",$perm);
if (!is_dir($currentCourseRepositorySys."upload/forum/images")) {
mkdir($currentCourseRepositorySys."upload/forum/images", $perm);
}
//upload > learning_path
if(!is_dir($currentCourseRepositorySys."upload/learning_path")){
mkdir($currentCourseRepositorySys."upload/learning_path",$perm);
if (!is_dir($currentCourseRepositorySys."upload/learning_path")) {
mkdir($currentCourseRepositorySys."upload/learning_path", $perm);
}
//upload > learning_path > images
if(!is_dir($currentCourseRepositorySys."upload/learning_path/images")){
mkdir($currentCourseRepositorySys."upload/learning_path/images",$perm);
if (!is_dir($currentCourseRepositorySys."upload/learning_path/images")) {
mkdir($currentCourseRepositorySys."upload/learning_path/images", $perm);
}
//upload > calendar
if(!is_dir($currentCourseRepositorySys."upload/calendar")){
mkdir($currentCourseRepositorySys."upload/calendar",$perm);
if (!is_dir($currentCourseRepositorySys."upload/calendar")) {
mkdir($currentCourseRepositorySys."upload/calendar", $perm);
}
//upload > calendar > images
if(!is_dir($currentCourseRepositorySys."upload/calendar/images")){
mkdir($currentCourseRepositorySys."upload/calendar/images",$perm);
if (!is_dir($currentCourseRepositorySys."upload/calendar/images")) {
mkdir($currentCourseRepositorySys."upload/calendar/images", $perm);
}
}
}
else
{
} else {
echo 'You are not allowed here !';
}
?>

@ -15,6 +15,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
@ -28,15 +29,15 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$found_stable = false;
foreach ($file as $line) {
$ignore = false;
if(stristr($line, '$_configuration[\'dokeos_version\']')) {
if (stristr($line, '$_configuration[\'dokeos_version\']')) {
$found_version = true;
$line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
} elseif(stristr($line, '$_configuration[\'dokeos_stable\']')) {
} elseif (stristr($line, '$_configuration[\'dokeos_stable\']')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n";
} elseif(stristr($line, '$userPasswordCrypted')) {
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line, '$userPasswordCrypted')) {
$line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n";
} elseif(stristr($line, '?>')) {
} elseif (stristr($line, '?>')) {
//ignore the line
$ignore = true;
}
@ -48,7 +49,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
fwrite($fh, '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
}
if (!$found_stable) {
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
fwrite($fh, '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n");
}
fwrite($fh, '?>');
fclose($fh);

@ -9,6 +9,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';

@ -9,6 +9,7 @@
* @package chamilo.install
==============================================================================
*/
require_once '../inc/lib/main_api.lib.php';
require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';

Loading…
Cancel
Save