Feature #272 - Installation scripts: Updating comments.

skala
Ivan Tcholakov 16 years ago
parent 2ced4dc643
commit dc9ca4cea6
  1. 129
      main/install/update-db-1.6.x-1.8.0.inc.php
  2. 62
      main/install/update-db-1.8.0-1.8.2.inc.php
  3. 66
      main/install/update-db-1.8.2-1.8.3.inc.php
  4. 72
      main/install/update-db-1.8.3-1.8.4.inc.php
  5. 46
      main/install/update-db-1.8.4-1.8.5.inc.php
  6. 51
      main/install/update-db-1.8.5-1.8.6.inc.php
  7. 46
      main/install/update-db-1.8.6-1.8.6.1.inc.php
  8. 61
      main/install/update-db-1.8.6.1-1.8.6.2.inc.php
  9. 50
      main/install/update-db-1.8.6.2-1.8.7.inc.php
  10. 232
      main/install/update-db-scorm-1.6.x-1.8.0.inc.php
  11. 59
      main/install/update-files-1.6.x-1.8.0.inc.php
  12. 31
      main/install/update-files-1.8.3-1.8.4.inc.php
  13. 10
      main/install/update-files-1.8.4-1.8.5.inc.php
  14. 38
      main/install/update-files-1.8.5-1.8.6.inc.php
  15. 12
      main/install/update-files-1.8.6-1.8.6.1.inc.php
  16. 24
      main/install/update-files-1.8.6.1-1.8.6.2.inc.php
  17. 4
      main/install/update-files-1.8.6.2-1.8.7.inc.php

@ -1,42 +1,24 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -50,16 +32,15 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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
// 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)) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
'.get_lang('PleasGoBackToStep1').'.
<p><button type="submit" class="back" name="step1" value="&lt; '.get_lang('Back').'">'.get_lang('Back').'</button></p>
</td></tr></table></form></body></html>';
exit ();
}
@ -91,7 +72,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -109,14 +90,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -140,10 +121,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -154,7 +135,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
error_log('Database '.$dbStatsForm.' was not found, skipping', 0);
} else {
Database::select_db($dbStatsForm);
foreach($s_q_list as $query) {
foreach ($s_q_list as $query) {
if ($only_test) {
error_log("Database::query($dbStatsForm,$query)", 0);
} else {
@ -167,10 +148,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -191,7 +172,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore.
}
/*
@ -212,11 +193,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = $_configuration['table_prefix'];
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -228,23 +209,23 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
*/
if (!$singleDbForm) { //otherwise just use the main one
if (!$singleDbForm) { // otherwise just use the main one
Database::select_db($row_course['db_name']);
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}
@ -258,8 +239,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//prepare reusable users list to avoid repetition of the SQL query, but only select
//users from the current course to avoid blowing the memory limit
// Prepare reusable users list to avoid repetition of the SQL query, but only select
// users from the current course to avoid blowing the memory limit
$users_list = array();
$sql_uc = "SELECT u.user_id as ui, u.firstname as fn, u.lastname as ln " .
" FROM $dbNameForm.user u, $dbNameForm.course_rel_user cu " .
@ -270,13 +251,13 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$users_list[$user_row['fn'].' '.$user_row['ln']] = $user_row['ui'];
}
//update course manually
//update group_category.forum_state ?
//update group_info.tutor_id (put it in group_tutor table?) ?
//update group_info.forum_state, forum_id ?
// Update course manually
// Update group_category.forum_state ?
// Update group_info.tutor_id (put it in group_tutor table?) ?
// Update group_info.forum_state, forum_id ?
//update forum tables (migrate from bb_ tables to forum_ tables)
//migrate categories
// Update forum tables (migrate from bb_ tables to forum_ tables)
// Migrate categories
$prefix_course = $prefix;
if ($singleDbForm) {
$prefix_course = $prefix.$row_course['db_name']."_";
@ -294,7 +275,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$lastcatid = Database::insert_id();
//error_log($sql,0);
$order ++;
//add item_property - forum categories were not put into item_properties before
// Add item_property - forum categories were not put into item_properties before
$sql = "INSERT INTO ".$prefix_course."item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " .
"VALUES ('forum_category','1','$lastcatid','ForumCategoryAdded','1','1')";
$res = Database::query($sql);
@ -321,7 +302,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$lastforumid = Database::insert_id();
$order++;
//add item_property - forums were not put into item_properties before
// Add item_property - forums were not put into item_properties before
$sql = "INSERT INTO ".$prefix_course."item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " .
"VALUES ('forum','1','$lastforumid','ForumAdded','1','1')";
$res = Database::query($sql);
@ -332,7 +313,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res_orig = Database::query($sql_orig);
while ($row = Database::fetch_array($res_orig)) {
$name = $row['prenom'].' '.$row['nom'];
//check if user id is reusable
// Check whether user id is reusable
if ($row['topic_poster'] <= 1) {
if (isset($users_list[$name])) {
$poster_id = $users_list[$name];
@ -340,7 +321,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$poster_id = $row['topic_poster'];
}
}
//convert time from varchar to datetime
// Convert time from varchar to datetime
$time = $row['topic_time'];
$name = Database::escape_string($name);
$sql = "INSERT INTO ".$prefix_course."forum_thread " .
@ -356,7 +337,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res = Database::query($sql);
$lastthreadid = Database::insert_id();
//add item_property - forum threads were not put into item_properties before
// Add item_property - forum threads were not put into item_properties before
$sql = "INSERT INTO ".$prefix_course."item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " .
"VALUES ('forum_thread','1','$lastthreadid','ForumThreadAdded','1','1')";
$res = Database::query($sql);
@ -367,7 +348,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res_orig = Database::query($sql_orig);
while ($row = Database::fetch_array($res_orig)) {
$name = $row['prenom'].' '.$row['nom'];
//check if user id is reusable
// Check whether user id is reusable
if ($row['poster_id'] <= 0 ) {
if (isset($users_list[$name])) {
$poster_id = $users_list[$name];
@ -375,7 +356,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$poster_id = $row['poster_id'];
}
}
//convert time from varchar to datetime
// Convert time from varchar to datetime
$time = $row['post_time'];
$name = Database::escape_string($name);
$sql = "INSERT INTO ".$prefix_course."forum_post " .
@ -391,7 +372,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res = Database::query($sql);
$lastpostid = Database::insert_id();
//add item_property - forum threads were not put into item_properties before
// Add item_property - forum threads were not put into item_properties before
$sql = "INSERT INTO ".$prefix_course."item_property(tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " .
"VALUES ('forum_post','1','$lastpostid','ForumPostAdded','1','1')";
$res = Database::query($sql);
@ -413,8 +394,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//load the old-scorm to new-scorm migration script
//TODO: deal with the fact that this should only act on MAX_COURSE_TRANSFER courses
// Load the old-scorm to new-scorm migration script
// TODO: Deal with the fact that this should only act on MAX_COURSE_TRANSFER courses
if (!$only_test){
include('update-db-scorm-1.6.x-1.8.0.inc.php');
}
@ -424,11 +405,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
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)
// Deal with migrate-db-1.6.x-1.8.0-post.sql
// Get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-post.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -452,10 +433,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-post.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -479,7 +460,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-post.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
@ -505,13 +486,13 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database should need a drop in the post-migrate part. However, we will keep these tables a bit more, just in case...
// The SCORM database should need a drop in the post-migrate part. However, we will keep these tables a bit more, just in case...
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-1.6.x-1.8.0-post.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -528,7 +509,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i++;
}
foreach ($list as $row) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -558,7 +539,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
// upgrade user categories sort
// Upgrade user categories sort
$table_user_categories = $dbUserForm.'.user_course_category';
$sql = 'SELECT * FROM '.$table_user_categories.' ORDER BY user_id, title';

@ -1,42 +1,24 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2007 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -50,7 +32,7 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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
@ -90,7 +72,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -110,7 +92,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
// Get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-1.8.0-1.8.2-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
@ -137,11 +119,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-1.8.0-1.8.2-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -164,7 +146,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-1.8.0-1.8.2-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
@ -188,7 +170,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
/*
@ -208,10 +190,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
if ($singleDbForm) {
$prefix = $_configuration['table_prefix'];
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-1.8.0-1.8.2-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm,$dblist)) {
@ -223,23 +205,23 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
*/
if (!$singleDbForm) { //otherwise just use the main one
if (!$singleDbForm) { // otherwise just use the main one
Database::select_db($row_course['db_name']);
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}

@ -1,43 +1,25 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2007 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//remove memory and time limits as much as possible as this might be a long process...
if( function_exists('ini_set')) {
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
} else {
@ -53,7 +35,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
// Check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
'.get_lang('PleasGoBackToStep1').'.
@ -90,7 +72,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -107,14 +89,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
// 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');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -138,11 +120,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-1.8.2-1.8.3-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -165,10 +147,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-1.8.2-1.8.3-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -189,7 +171,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
/*
@ -209,10 +191,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
if ($singleDbForm) {
$prefix = $_configuration['table_prefix'];
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-1.8.2-1.8.3-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -224,13 +206,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name

@ -1,42 +1,24 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2007 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -50,7 +32,7 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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 (!file_exists('../inc/conf/configuration.php')) {
@ -89,7 +71,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -106,14 +88,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-1.8.3-1.8.4-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -137,11 +119,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-1.8.3-1.8.4-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -164,10 +146,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-1.8.3-1.8.4-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -188,7 +170,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
/*
@ -208,10 +190,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
if ($singleDbForm) {
$prefix = $_configuration['table_prefix'];
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-1.8.3-1.8.4-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -223,13 +205,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -239,7 +221,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}
@ -252,7 +234,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//ensure each learnpath is present in the item_property table
// Ensure each learnpath is present in the item_property table
$prefix_course = '';
if ($singleDbForm) {
$prefix_course = $prefix.$row_course['db_name']."_";
@ -277,8 +259,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$sql2 = "SELECT * FROM $tbl_tool where (name='$input' and image='scormbuilder.gif' and link LIKE '$mylink%')";
if (in_array($row_lp['id'], $paths)) {
//the path is already in item_property, check the visibility is the
//same as the homepage tool's
// The path is already in item_property, check the visibility is the
// same as the homepage tool's
$res2 = Database::query($sql2);
if (Database::num_rows($res2) > 0) {
$row2 = Database::fetch_array($res2);
@ -290,7 +272,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res_upd = Database::query($sql_upd);
}
} else {
//the path is not in item_property, insert it
// The path is not in item_property, insert it
$res2 = Database::query($sql2);
if (Database::num_rows($res2) > 0) {
$row2 = Database::fetch_array($res2);

@ -1,14 +1,18 @@
<?php // $Id: update-db-1.8.4-1.8.5.inc.php 19471 2009-03-31 23:28:53Z cvargas1 $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
@ -17,7 +21,7 @@
$old_file_version = '1.8.4';
$new_file_version = '1.8.5';
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -31,7 +35,7 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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 (!file_exists('../inc/conf/configuration.php')) {
@ -70,7 +74,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -87,14 +91,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -118,11 +122,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -145,10 +149,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -169,7 +173,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
/*
@ -190,7 +194,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = get_config_param ('table_prefix');
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'course');
if (count($c_q_list) > 0) {
@ -208,13 +212,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -224,7 +228,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}
@ -263,7 +267,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
// Work Tool Folder Update
// we search into DB all the folders in the work tool
// We search into DB all the folders in the work tool
if ($singleDbForm) {
$my_course_table = "$prefix{$row_course['db_name']}_student_publication";
} else {
@ -281,7 +285,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$result = Database::query($sql_select);
$num_row = Database::num_rows($result);
// check if there are already folder registered
// Check if there are already folder registered
if ($num_row == 0) {
for ($i = 0; $i < count($dir_to_array); $i++) {
$only_dir[] = substr($dir_to_array[$i], strlen($course_dir), strlen($dir_to_array[$i]));

@ -1,26 +1,30 @@
<?php // $Id: update-db-1.8.5-1.8.6.inc.php 22197 2009-07-17 17:49:44Z ivantcholakov $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//load helper functions
// Load helper functions
require_once '../inc/lib/image.lib.php';
$old_file_version = '1.8.5';
$new_file_version = '1.8.6';
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -34,7 +38,7 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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
@ -76,7 +80,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -93,11 +97,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
// Get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
@ -165,7 +169,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$type = $picture_infos[2];
// original picture
// Original picture
$big_temp = new image($image_repository);
switch (!empty($type)) {
@ -193,7 +197,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$res = Database::query($sql);
}
//Since the parser of the migration DB does not work for this kind of inserts (HTML) we move it here
// Since the parser of the migration DB does not work for this kind of inserts (HTML) we move it here
$sql = 'INSERT INTO '.$dbNameForm.'.system_template (title, comment, image, content) VALUES
(\'TemplateTitleCourseTitle\', \'TemplateTitleCourseTitleDescription\', \'coursetitle.gif\', \'
@ -1032,12 +1036,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -1060,10 +1063,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -1084,7 +1087,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
@ -1106,11 +1109,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = get_config_param ('table_prefix');
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -1124,13 +1127,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -1161,7 +1164,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$t_d = "$prefix{$row_course['db_name']}_document";
$t_ip = "$prefix{$row_course['db_name']}_item_property";
}
// shared documents folder
// Shared documents folder
$query = "INSERT INTO $t_d (path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')";
$myres = Database::query($query);
if ($myres !== false) {

@ -1,14 +1,18 @@
<?php // $Id: $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
@ -20,7 +24,7 @@ require_once '../inc/lib/image.lib.php';
$old_file_version = '1.8.6';
$new_file_version = '1.8.6.1';
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -74,7 +78,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -98,7 +102,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-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -123,11 +127,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -150,10 +154,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -174,7 +178,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
/*
@ -195,11 +199,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = get_config_param ('table_prefix');
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -213,13 +217,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -229,7 +233,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}
@ -251,12 +255,12 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$t_wiki_conf = "$prefix{$row_course['db_name']}_wiki_conf";
}
//update correct page_id to wiki table, actually only store 0
// Update correct page_id to wiki table, actually only store 0
$query = "SELECT id, reflink FROM $t_wiki";
$res_page = Database::query($query);
$wiki_id = $reflink = array();
if (Database::num_rows($res_page) > 0 ) {
if (Database::num_rows($res_page) > 0) {
while ($row_page = Database::fetch_row($res_page)) {
$wiki_id[] = $row_page[0];
$reflink[] = $row_page[1];
@ -274,7 +278,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//insert page_id into wiki_conf table, actually this table is empty
// Insert page_id into wiki_conf table, actually this table is empty
$query = "SELECT DISTINCT page_id FROM $t_wiki ORDER BY page_id";
$myres_wiki = Database::query($query);

@ -1,26 +1,30 @@
<?php // $Id: $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//load helper functions
// Load helper functions
require_once '../inc/lib/image.lib.php';
$old_file_version = '1.8.6.1';
$new_file_version = '1.8.6.2';
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -34,10 +38,10 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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
// Check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
'.get_lang('PleasGoBackToStep1').'.
@ -74,7 +78,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -91,14 +95,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
// Get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -140,7 +144,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// session_rel_course_rel_user table
while ($row = Database::fetch_array($res)) {
// chech if coach is a student
// Check whether coach is a student
$sql = "SELECT 1 FROM session_rel_course_rel_user
WHERE id_session='{$row[id_session]}' AND course_code='{$row[course_code]}' AND id_user='{$row[id_coach]}'";
$rs = Database::query($sql);
@ -200,11 +204,10 @@ 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) {
//now use the $m_q_list
// 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
@ -228,11 +231,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//get the stats queries list (s_q_list)
// Get the stats queries list (s_q_list)
$s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -255,10 +258,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -279,7 +282,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
@ -301,11 +304,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = get_config_param ('table_prefix');
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if (strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif (!in_array($dbNameForm, $dblist)) {
@ -319,13 +322,13 @@ 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(($i < MAX_COURSE_TRANSFER) && ($row = Database::fetch_array($res)))
while ($row = Database::fetch_array($res)) {
$list[] = $row;
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -335,7 +338,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}
@ -349,7 +352,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
// fill description type into course_description table
// Fill description type into course_description table
$t_course_description = $row_course['db_name'].".course_description";
@ -357,7 +360,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$t_course_description = "$prefix{$row_course['db_name']}_course_description";
}
// get all ids and update description_type field with them from course_description table
// Get all ids and update description_type field with them from course_description table
$sql_sel = "SELECT id FROM $t_course_description";
$rs_sel = Database::query($sql_sel);

@ -1,26 +1,30 @@
<?php // $Id: $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Update the Dokeos database from an older version
* Notice : This script has to be included by index.php or update_courses.php
* Chamilo LMS
*
* Update the Chamilo database from an older Dokeos version
* Notice : This script has to be included by index.php
* or update_courses.php (deprecated).
*
* @package chamilo.install
* @todo
* - conditional changing of tables. Currently we execute for example
* ALTER TABLE `$dbNameForm`.`cours` instructions without checking wether this is necessary.
* ALTER TABLE `$dbNameForm`.`cours`
* instructions without checking wether this is necessary.
* - reorganise code into functions
* @todo use database library
==============================================================================
*/
//load helper functions
// Load helper functions
require_once '../inc/lib/image.lib.php';
$old_file_version = '1.8.6.2';
$new_file_version = '1.8.7';
//remove memory and time limits as much as possible as this might be a long process...
// Remove memory and time limits as much as possible as this might be a long process...
if (function_exists('ini_set')) {
ini_set('memory_limit', -1);
ini_set('max_execution_time', 0);
@ -34,10 +38,10 @@ if (function_exists('ini_set')) {
==============================================================================
*/
//check if we come from index.php or update_courses.php - otherwise display error msg
// 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
// Check if the current Dokeos install is elligible for update
if (!file_exists('../inc/conf/configuration.php')) {
echo '<strong>'.get_lang('Error').' !</strong> Dokeos '.implode('|', $updateFromVersion).' '.get_lang('HasNotBeenFound').'.<br /><br />
'.get_lang('PleasGoBackToStep1').'.
@ -74,7 +78,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
start by updating main, statistic, user databases
-----------------------------------------------------------
*/
//if this script has been included by index.php, not update_courses.php, so
// If this script has been included by index.php, not update_courses.php, so
// that we want to change the main databases as well...
$only_test = false;
$log = 0;
@ -91,14 +95,14 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
include '../lang/english/create_course.inc.php';
if ($languageForm != 'english') {
//languageForm has been escaped in index.php
// languageForm has been escaped in index.php
include '../lang/'.$languageForm.'/create_course.inc.php';
}
//get the main queries list (m_q_list)
// Get the main queries list (m_q_list)
$m_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'main');
if (count($m_q_list) > 0) {
//now use the $m_q_list
// 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
@ -131,7 +135,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
/*
$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
// 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) {
@ -158,7 +162,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$s_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'stats');
if (count($s_q_list) > 0) {
//now use the $s_q_list
// Now use the $s_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -184,10 +188,10 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//get the user queries list (u_q_list)
// Get the user queries list (u_q_list)
$u_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'user');
if (count($u_q_list) > 0) {
//now use the $u_q_list
// Now use the $u_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
@ -211,7 +215,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
}
//the SCORM database doesn't need a change in the pre-migrate part - ignore
// The SCORM database doesn't need a change in the pre-migrate part - ignore
}
@ -233,11 +237,11 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$prefix = get_config_param ('table_prefix');
}
//get the courses databases queries list (c_q_list)
// Get the courses databases queries list (c_q_list)
$c_q_list = get_sql_file_contents('migrate-db-'.$old_file_version.'-'.$new_file_version.'-pre.sql', 'course');
if (count($c_q_list) > 0) {
//get the courses list
// Get the courses list
if(strlen($dbNameForm) > 40) {
error_log('Database name '.$dbNameForm.' is too long, skipping', 0);
} elseif(!in_array($dbNameForm, $dblist)) {
@ -257,17 +261,17 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$i++;
}
foreach ($list as $row_course) {
//now use the $c_q_list
// Now use the $c_q_list
/**
* We connect to the right DB first to make sure we can use the queries
* without a database name
*/
if (!$singleDbForm) { //otherwise just use the main one
if (!$singleDbForm) { // otherwise just use the main one
Database::select_db($row_course['db_name']);
}
foreach ($c_q_list as $query) {
if ($singleDbForm) { //otherwise just use the main one
if ($singleDbForm) {
$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);
}

@ -1,5 +1,7 @@
<?php //$id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Chamilo LMS
* Script handling the migration between an old Dokeos platform (<1.8.0) to
* setup the new database system (4 scorm tables inside the course's database)
* @package chamilo.scorm
@ -89,8 +91,8 @@ if ($loglevel > 0) { error_log("Tables created/deleted for all courses", 0); }
* The migration needs to take all data from the original learnpath tables and add them to the new
* lp, lp_view, lp_item and lp_item_view tables
*/
//MIGRATING LEARNPATHS
//test only one course
// MIGRATING LEARNPATHS
// Test only one course
foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
if (strlen($courses_id_list[$course_code]) > 40) {
error_log('Database '.$courses_id_list[$course_code].' is too long, skipping', 0);
@ -117,7 +119,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
$my_new_lp_view = $db.$new_lp_view;
$my_new_lp_item_view = $db.$new_lp_item_view;
//migrate learnpaths
// Migrate learnpaths
$sql_test = "SELECT * FROM $my_new_lp";
$res_test = Database::query($sql_test);
$sql_lp = "SELECT * FROM $lp_main";
@ -149,19 +151,18 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
//echo "<pre>lp_ids:".print_r($lp_ids,true)."</pre>\n";
//MIGRATING LEARNPATH CHAPTERS
// MIGRATING LEARNPATH CHAPTERS
$sql_lp_chap = "ALTER TABLE $lp_chap ADD INDEX ( parent_chapter_id, display_order )";
$res_lp_chap = Database::query($sql_lp_chap);
$sql_lp_chap = "SELECT * FROM $lp_chap ORDER BY parent_chapter_id, display_order";
//echo "$sql_lp_chap<br />\n";
$res_lp_chap = Database::query($sql_lp_chap);
while($row = Database::fetch_array($res_lp_chap))
{
while ($row = Database::fetch_array($res_lp_chap)) {
//echo "Treating chapter id : ".$row['id']."<br />\n";
//TODO build path for this chapter (although there is no real path for any chapter)
//TODO find out how to calculate the "next_item_id" with the "ordre" field
//TODO: Build path for this chapter (although there is no real path for any chapter)
//TODO: Find out how to calculate the "next_item_id" with the "ordre" field
$my_lp_item = $my_new_lp_item;
$myname = Database::escape_string($row['chapter_name']);
$mydesc = Database::escape_string($row['chapter_description']);
@ -195,7 +196,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
}
//echo "<pre>parent_lps:".print_r($parent_lps,true)."</pre>\n";
//Now one loop to update the parent_chapter_ids
// Now one loop to update the parent_chapter_ids
foreach ($parent_chaps as $old_chap => $old_parent_chap) {
if ($old_parent_chap != 0) {
$new_chap = $lp_chap_items[$old_chap];
@ -210,7 +211,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
}
unset($parent_chaps);
//Now one loop to set the next_item_id and the previous_item_id
// Now one loop to set the next_item_id and the previous_item_id
foreach ($ordered_chaps as $parent_chap) {
$last = 0;
foreach ($ordered_chaps[$parent_chap] as $order => $new_id) {
@ -232,9 +233,9 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
}
unset($ordered_chaps);
//migrate learnpath_items
//TODO define this array thanks to types defined in the learnpath_building scripts
//TODO set order correctly
// Migrate learnpath_items
// TODO: Define this array thanks to types defined in the learnpath_building scripts
// TODO: Set order correctly
$type_trans = array(
'document' => TOOL_DOCUMENT,
'exercise' => TOOL_QUIZ,
@ -261,7 +262,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
);
//MIGRATING LEARNPATH ITEMS
// MIGRATING LEARNPATH ITEMS
$sql_lp_item = "ALTER TABLE $lp_item ADD INDEX ( chapter_id, display_order)";
$res_lp_item = Database::query($sql_lp_item);
$sql_lp_item = "SELECT * FROM $lp_item ORDER BY chapter_id, display_order";
@ -271,23 +272,23 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
//echo "Treating chapter ".$row['chapter_id'].", item ".$row['id']."<br />\n";
$type = $type_trans[$row['item_type']];
$ref = $row['item_id'];
//TODO build item path
//TODO calculate "next_item_id" with the "ordre" field
//prepare prereqs
//prerequisites in Dokeos 1.6 is only authorised on previous items, so
//we know that we are gonna talk about an item that has already been passed
//through here - if none found, print message
//TODO: Build item path
//TODO: Calculate "next_item_id" with the "ordre" field
// Prepare prereqs
// Prerequisites in Dokeos 1.6 is only authorised on previous items, so
// We know that we are gonna talk about an item that has already been passed
// through here - if none found, print message
$prereq_id = '';
if (!empty($row['prereq_id'])) {
switch ($row['prereq_type']) {
case 'c':
//chapter-type prereq
// chapter-type prereq
$prereq_id = $lp_chap_items[$row['prereq_id']];
if (empty($prereq_id) && $loglevel > 1) { error_log("Could not find prereq chapter ".$row['prereq_id'], 0); }
break;
case 'i':
default:
//item type prereq
// item type prereq
$prereq_id = $lp_items[$parent_lps[$row['chapter_id']]][$row['prereq_id']];
if (empty($prereq_id) && $loglevel > 1) { error_log("Could not find prereq item ".$row['prereq_id'], 0); }
break;
@ -310,7 +311,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
$title = $row['title'];
}
if (isset($lp_ids[$parent_lps[$row['chapter_id']]])) {
//if there is a parent learnpath
// If there is a parent learnpath
$ins_lp_sql = "INSERT INTO $my_new_lp_item (" .
"lp_id," .
"item_type," .
@ -322,7 +323,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
"prerequisite," .
"display_order" .
") VALUES (" .
"'".$lp_ids[$parent_lps[$row['chapter_id']]]."'," . //insert new learnpath ID
"'".$lp_ids[$parent_lps[$row['chapter_id']]]."'," . // Insert new learnpath ID
"'$type'," .
"'$ref', " .
"'".Database::escape_string($row['title'])."'," .
@ -341,7 +342,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
}
}
//echo "<pre>lp_items:".print_r($lp_items,true)."</pre>\n";
// complete next_item_id field by going through the new table and looking at parent_id and display_order
// Complete next_item_id field by going through the new table and looking at parent_id and display_order
$order_sql = "ALTER TABLE $my_new_lp_item ADD INDEX (lp_id, parent_item_id, display_order)";
$order_res = Database::query($order_sql);
$order_sql = "SELECT * FROM $my_new_lp_item ORDER by lp_id ASC, parent_item_id ASC, display_order ASC";
@ -353,7 +354,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
while ($row = Database::fetch_array($order_res)) {
//print_r($row);
if ($row['lp_id'] != $lp_id) {
//apply changes to the database and clean tool arrays
// Apply changes to the database and clean tool arrays
$last = 0;
foreach ($order_item as $order_id => $item_id) {
$next = 0;
@ -375,7 +376,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
$order_item[] = $row['id'];
}
}
//process the last LP stack
// Process the last LP stack
$last = 0;
foreach ($order_item as $order_id => $item_id) {
$next = 0;
@ -393,7 +394,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
//echo "</pre>\n";
//MIGRATING THE learnpath_user TABLE (results)
// MIGRATING THE learnpath_user TABLE (results)
$mysql = "ALTER TABLE $my_new_lp_item_view ADD INDEX (lp_view_id)";
$myres = Database::query($mysql);
$sql_lp_user = "ALTER TABLE $lp_user ADD INDEX (user_id, learnpath_id, learnpath_item_id)";
@ -406,14 +407,14 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
$lp_view = 0;
while ($row = Database::fetch_array($res_lp_user)) {
if ($row['user_id']!=$user_id OR $row['learnpath_id']!=$learnpath_id) { //the user has changed or this is the first
//insert a new lp_view
// Insert a new lp_view
$last = 0;
if (!empty($lp_chaps_list[$row['learnpath_id']][0])) {
$last = $lp_chaps_list[$row['learnpath_id']][0];
}
if (empty($lp_ids[$row['learnpath_id']])) {
//this can be ignored as it means there was an LP before, this user
//used it, but now it's been removed
// This can be ignored as it means there was an LP before, this user
// used it, but now it's been removed
//echo "Somehow we also miss a lp_ids[".$row['learnpath_id']."] here<br />\n";
$incoherences ++;
} else {
@ -424,10 +425,10 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
"view_count," .
"last_item" .
")VALUES(" .
"".$mylpid."," . //new learnpath id
"".$row['user_id']."," . //user IDs stay the same
"".$mylpid."," . // new learnpath id
"".$row['user_id']."," . // user IDs stay the same
"1," .
"".$last."" . //use the first chapter from this learnpath
"".$last."" . // Use the first chapter from this learnpath
")";
//echo $sql_ins_view;
$res_ins_view = Database::query($sql_ins_view);
@ -437,12 +438,12 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
$lp_view = $in_id;
}
}
//insert the record into lp_item_view
//TODO fix the whole in here (missing one item at least)
// Insert the record into lp_item_view
// TODO: fix the whole in here (missing one item at least)
$my_new_lp_item_id = $lp_items[$learnpath_id][$row['learnpath_item_id']];
if (empty($my_new_lp_item_id)) {
//this can be ignored safely as it just means a user used a learnpath_item
//before it was removed from items - maybe fix that in Dokeos?
// This can be ignored safely as it just means a user used a learnpath_item
// before it was removed from items - maybe fix that in Dokeos?
//echo "Somehow we miss lp_items[".$learnpath_id."][".$row['learnpath_item_id']."] here...<br />";
$incoherences ++;
} else {
@ -471,7 +472,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
//echo $sql_ins_iv;
$res_ins_iv = Database::query($sql_ins_iv);
}
//UPDATE THE LP_VIEW progress
// UPDATE THE LP_VIEW progress
$mysql = "SELECT count(distinct(lp_item_id)) FROM $my_new_lp_item_view WHERE lp_view_id = ".$lp_view." AND status IN ('passed','completed','succeeded','browsed','failed')";
$myres = Database::query($mysql);
$myrow = Database::fetch_array($myres);
@ -489,7 +490,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
/**
* Move prerequisites
* TODO integrate prerequisites migration into learnpath_item migration
* TODO: Integrate prerequisites migration into learnpath_item migration
*/
$msg = '';
@ -501,14 +502,14 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
* update the links to newscorm/lp_controller.php?action=view&lp_id=x)
* Only normal learnpaths were visible from the homepage so we only need to update here
*/
//MIGRATING LEARNPATH LINKS ON COURSES HOMEPAGES
// MIGRATING LEARNPATH LINKS ON COURSES HOMEPAGES
$tbl_tool = $db.TABLE_TOOL_LIST;
$sql_tool = "SELECT * FROM $tbl_tool WHERE image='scormbuilder.gif' AND link LIKE '%learnpath_handler%'";
$res_tool = Database::query($sql_tool);
while ($row_tool = Database::fetch_array($res_tool)) {
$name = $row_tool['name'];
$link = $row_tool['link'];
//get old lp_id from there
// Get old lp_id from there
$matches = array();
if (preg_match('/learnpath_id=(\d+)$/', $link,$matches)) {
$old_lp_id = $matches[1];
@ -517,7 +518,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
"SET link='newscorm/lp_controller.php?action=view&lp_id=$new_lp_id' " .
"WHERE id = ".$row_tool['id'];
error_log('New LP - Migration - Updating tool table: '.$sql_tool_upd, 0);
//make sure there is a way of retrieving which links were updated (to revert)
// Make sure there is a way of retrieving which links were updated (to revert)
fwrite($fh,$sql_tool_upd." AND link ='$link'");
fwrite($fh_revert, "UPDATE $tbl_tool SET link='$link' WHERE id=".$row_tool['id']." AND link ='newscorm/lp_controller.php?action=view&lp_id=$new_lp_id';\n");
//echo $sql_tool_upd." (and link='$link')<br />\n";
@ -538,7 +539,7 @@ foreach ($courses_id_full_table_prefix_list as $course_code => $db) {
//echo "Removing link $link from tools<br />";
$sql_tool_upd = "DELETE FROM $tbl_tool WHERE id = ".$row_tool['id'];
error_log('New LP - Migration - Updating tool table (dead link): '.$sql_tool_upd, 0);
//make sure there is a way of retrieving which links were updated (to revert)
// Make sure there is a way of retrieving which links were updated (to revert)
fwrite($fh, $sql_tool_upd." AND link ='$link'");
fwrite($fh_revert, "INSERT INTO $tbl_tool (link) VALUES ('$link');\n");
//echo $sql_tool_upd." (and link='$link')<br />\n";
@ -618,7 +619,7 @@ $lp_course = array();
$lp_course_code = array();
$scorm_lp_paths = array();
//avoid empty dokeosCourse fields as they potentially break the rest
// Avoid empty dokeosCourse fields as they potentially break the rest
Database::select_db($dbNameForm);
$course_main = TABLE_MAIN_COURSE;
$sql_crs = "SELECT * FROM $course_main WHERE target_course_code IS NULL";
@ -626,17 +627,17 @@ if ($loglevel > 0) { error_log("$sql_crs", 0); }
$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 '/']
// Prepare an array that will contain course codes and for each course code a list of lps [by path prefixed by '/']
$scorms = array();
$course_code_swap = '';
$scormdocuments_lps = array();
while ($course_row = Database::fetch_array($res_crs)) {
if ($loglevel > 0) { error_log("Now dealing with course ".$course_row['code']."...", 0); }
//check the validity of this new course
// Check the validity of this new course
$my_course_code = $course_row['code'];
//reinit the scormdocuments list
// Reinit the scormdocuments list
//$scormdocuments_lps = array();
$db_name = $courses_id_full_table_prefix_list[$my_course_code];
if (strlen($courses_id_list[$course_code]) > 40) {
@ -651,33 +652,32 @@ while ($course_row = Database::fetch_array($res_crs)) {
$res_scodoc = Database::query($sql_scodoc);
while ($row_scodoc = Database::fetch_array($res_scodoc)) {
//check if there's more than one slash in total
// Check if there's more than one slash in total
if (strpos($row_scodoc['path'], '/', 1) === false) {
$tmp_path = $row_scodoc['path'];
if ($loglevel > 1) { error_log("++Now opening $tmp_path", 0); }
//add a prefixing slash if there is none
// Add a prefixing slash if there is none
if (substr($tmp_path, 0, 1) != '/') {
$tmp_path = '/'.$tmp_path;
}
//if the path is just a slash, empty it
// If the path is just a slash, empty it
if ($tmp_path == '/') {
$tmp_path = '';
}
//there is only one 'slash' sign at the beginning,
//or none at all, so we assume
//it is a main directory that should be taken as path
// There is only one 'slash' sign at the beginning, or none at all, so we assume
// it is a main directory that should be taken as path.
$courses_dir = $sys_course_path.''.$courses_dir_list[$my_course_code].'/scorm'.$tmp_path;
if (!is_dir($courses_dir)) {
//echo "Scormdocument path $my_content_id: $tmp_path doesn't exist in ".$sys_course_path.$courses_dir_list[$my_course_code]."/scorm, skipping<br />\n";
continue;
//avoid if contentTitle is not the name of an existing directory
// Avoid if contentTitle is not the name of an existing directory
} elseif (!is_file($courses_dir."/imsmanifest.xml")) {
//if the imsmanifest file was not found there
// If the imsmanifest file was not found there
if ($loglevel > 2) { error_log(" !!imsmanifest.xml not found at scormdocument's $courses_dir/imsmanifest.xml, skipping", 0); }
//try subdirectories on one level depth
// Try subdirectories on one level depth
if ($loglevel > 2) { error_log(" Trying subdirectories...", 0); }
$dh = opendir($courses_dir);
while ($entry = readdir($dh)) {
@ -701,7 +701,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
}
//Because certain people with no admin skills had fun adding direct links to SCORM
// Because certain people with no admin skills had fun adding direct links to SCORM
// from the courses introductions, we have to check for SCORM packages from there too...
$tbl_intro = $db_name.TABLE_TOOL_INTRO;
$sql_i = "SELECT * FROM $tbl_intro WHERE id='course_homepage'";
@ -715,7 +715,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
$pattern = '@scorm/showinframes\.php([^\s"\']*)file=([^\s"\'&]*)@';
if (preg_match_all($pattern, $intro, $matches, PREG_SET_ORDER)) {
if (count($matches) < 1) {
//skip
// Skip
} else {
//echo "Found matches in $tbl_intro<br />";
foreach ($matches as $match) {
@ -725,18 +725,18 @@ while ($course_row = Database::fetch_array($res_crs)) {
if (!empty($mymatch) && (strtolower(substr($mymatch, -15)) == 'imsmanifest.xml') && is_file(realpath(urldecode($mymatch)))) {
//echo $mymatch." seems ok<br />";
//found a new scorm course in the old directory
// Found a new scorm course in the old directory
$courses_dir = $upd_course_path.''.$courses_dir_list[$my_course_code].'/scorm';
//check if the file is in the current course path, otherwise just forget about it
//as it would be too difficult to migrate
// Check if the file is in the current course path, otherwise just forget about it
// as it would be too difficult to migrate
//echo "Comparing $mymatch with $courses_dir<br />";
if (strpos($mymatch, $courses_dir) !== false) {
//remove the course dir up to /scorm from this path
// Remove the course dir up to /scorm from this path
$entry = substr($mymatch, strlen($courses_dir));
//remove the /imsmanifest.xml from the end of the path
// Remove the /imsmanifest.xml from the end of the path
$entry = substr($entry, 0, -16);
//if $entry was /var/www/dokeos/courses/ABC/scorm/tralala/imsmanifest.xml,
//$entry is now /tralala
// If $entry was /var/www/dokeos/courses/ABC/scorm/tralala/imsmanifest.xml,
// $entry is now /tralala
//echo "Checking if manifest exists in ".$courses_dir.$entry."/imsmanifest.xml<br />";
if (is_file($courses_dir.$entry."/imsmanifest.xml")) {
//echo "found $courses_dir/$entry/imsmanifest.xml!<br />";
@ -756,7 +756,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
}
}
//prepare the new course's space in the scorms array
// Prepare the new course's space in the scorms array
$scorms[$my_course_code] = array();
$sql_paths = "SELECT * FROM $scorm_main WHERE dokeosCourse = '".$my_course_code."'";
@ -764,7 +764,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
$res_paths = Database::query($sql_paths);
$num = Database::num_rows($res_paths);
while ($scorm_row = Database::fetch_array($res_paths)) {
//check if this is a new course
// Check if this is a new course
$my_content_id = $scorm_row['contentId'];
$my_path = $scorm_row['contentTitle'];
if (substr($my_path, 0, 1) != '/') {
@ -777,7 +777,7 @@ while ($course_row = Database::fetch_array($res_crs)) {
if (!is_dir($courses_dir = $sys_course_path.''.$courses_dir_list[$my_course_code].'/scorm'.$my_path)) {
if ($loglevel > 1) { error_log("Path $my_content_id: $my_path doesn't exist in ".$sys_course_path.$courses_dir_list[$my_course_code]."/scorm, skipping", 0); }
continue;
//avoid if contentTitle is not the name of an existing directory
// Avoid if contentTitle is not the name of an existing directory
} elseif (!is_file($sys_course_path.$courses_dir_list[$my_course_code].'/scorm'.$my_path."/imsmanifest.xml")) {
if ($loglevel > 1) { error_log("!!imsmanifest.xml not found at ".$sys_course_path.$courses_dir_list[$my_course_code].'/scorm'.$my_path."/imsmanifest.xml, skipping", 0); }
continue;
@ -786,11 +786,11 @@ while ($course_row = Database::fetch_array($res_crs)) {
$scorms[$my_course_code][$my_path] = $my_content_id;
}
}
//check if all the lps from scormdocuments_lps are already in the course array,
//otherwise add them (and set ID of 0 so no tracking will be available)
// Check if all the lps from scormdocuments_lps are already in the course array,
// otherwise add them (and set ID of 0 so no tracking will be available)
foreach ($scormdocuments_lps as $path) {
if (!in_array($path,array_keys($scorms[$my_course_code]))) {
//add it (-1 means no ID)
// Add it (-1 means no ID)
if ($loglevel > 1) { error_log("** Scormdocument path $path wasn't recorded yet. Added.", 0); }
$scorms[$my_course_code][$path] = -1;
}
@ -820,16 +820,16 @@ foreach ($scorms as $my_course_code => $paths_list) {
if ($loglevel > 1) { error_log("Migrating lp $my_path from course $my_course_code...", 0); }
$i_count ++;
//error_log('New LP - Migration script - Content '.$i_count.' on '.$num.' (course '.$scorm['dokeosCourse'].')',0);
//check if there is no embedded learnpaths into other learnpaths (one root-level and another embedded)
// Check whether there is no embedded learnpaths into other learnpaths (one root-level and another embedded)
$embedded = false;
foreach ($course_lp_done as $tmp_lp) {
if (empty($tmp_lp)) {
$tmp_lp = '/'; //allows finding the lp as a subitem, otherwise strstr returns false
$tmp_lp = '/'; // Allows finding the lp as a subitem, otherwise strstr returns false
}
if (strstr($my_path, $tmp_lp) === false) {
//let it be
// Let it be
} else {
//this lp is embedded inside another lp who's imsmanifest exists, so prevent from parsing
// This lp is embedded inside another lp who's imsmanifest exists, so prevent from parsing
if ($loglevel > 1) { error_log("LP $my_path is embedded into $tmp_lp, ignoring...", 0); }
$embedded = true;
continue;
@ -846,7 +846,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
if ($loglevel > 1) { error_log("Try importing LP $my_path from imsmanifest first as it is more reliable", 0); }
//Setup the ims path (path to the imsmanifest.xml file)
// Setup the ims path (path to the imsmanifest.xml file)
//echo "Looking for course with code ".$lp_course_code[$my_content_id]." (using $my_content_id)<br />\n";
//$courses_dir = $sys_course_path.$courses_dir_list[$my_course_code];
$courses_dir = $upd_course_path.$courses_dir_list[$my_course_code];
@ -857,19 +857,19 @@ foreach ($scorms as $my_course_code => $paths_list) {
if (is_file($ims)){
//echo "Path $ims exists, importing...(line ".__LINE__.")<br />";
$oScorm = new scorm();
//check if imsmanifest.xml exists at this location. If not, ignore the imsmanifest.
//That should have been done before already, now.
// Check whether imsmanifest.xml exists at this location. If not, ignore the imsmanifest.
// That should have been done before already, now.
if ($loglevel > 1) { error_log("Found imsmanifest ($ims), importing...", 0); }
if (!empty($sco_middle_path)) { $oScorm->subdir = $sco_middle_path; } //this sets the subdir for the scorm package inside the scorm dir
//parse manifest file
// Parse manifest file
$manifest = $oScorm->parse_manifest($ims);
//the title is already escaped in the method
// The title is already escaped in the method
$oScorm->import_manifest($my_course_code);
//TODO add code to update the path in that new lp created, as it probably uses / where
//$sco_path_temp should be used...
$lp_ids[$my_content_id] = $oScorm->lp_id; //contains the old LP ID => the new LP ID
//TODO: Add code to update the path in that new lp created, as it probably uses / where
// $sco_path_temp should be used...
$lp_ids[$my_content_id] = $oScorm->lp_id; // Contains the old LP ID => the new LP ID
if ($loglevel > 1) { error_log(" @@@ Created scorm lp ".$oScorm->lp_id." from imsmanifest [".$ims."] in course $my_course_code", 0); }
$lp_course[$my_content_id] = $courses_id_list[$my_course_code]; //contains the old learnpath ID => the course DB name
$lp_course[$my_content_id] = $courses_id_list[$my_course_code]; // Contains the old learnpath ID => the course DB name
$lp_course_code[$my_content_id] = $my_course_code;
$max_dsp_lp++;
@ -902,12 +902,12 @@ foreach ($scorms as $my_course_code => $paths_list) {
* Check if a view is needed
*/
if ($my_score != '' and $my_status != 'not attempted') {
//it is worth creating an lp_view and an lp_item_view - otherwise not
// It is worth creating an lp_view and an lp_item_view - otherwise not
$sel_sqlb = "SELECT * FROM $my_new_lp_view " .
"WHERE lp_id = ".$lp_ids[$my_content_id]." AND user_id = $my_student";
$sel_resb = Database::query($sel_sqlb);
if (Database::num_rows($sel_resb) > 0) {
//dont insert
// Don't insert
$rowb = Database::fetch_array($sel_resb);
$view_insert_id = $rowb['id'];
} else {
@ -982,29 +982,29 @@ foreach ($scorms as $my_course_code => $paths_list) {
if (empty($in_id) or $in_id == false) die('Could not insert scorm lp: '.$sql_ins);
//echo "&nbsp;&nbsp;Inserted item $in_id<br />\n";
$lp_ids[$my_content_id] = $in_id; //contains the old LP ID => the new LP ID
$lp_course[$my_content_id] = $courses_id_list[$my_course_code]; //contains the old learnpath ID => the course DB name
$lp_course[$my_content_id] = $courses_id_list[$my_course_code]; // Contains the old learnpath ID => the course DB name
$lp_course_code[$my_content_id] = $my_course_code;
$max_dsp_lp++;
//Setup the ims path (path to the imsmanifest.xml file)
// Setup the ims path (path to the imsmanifest.xml file)
//echo "Looking for course with code ".$lp_course_code[$my_content_id]." (using $my_content_id)<br />\n";
$courses_dir = $sys_course_path.$courses_dir_list[$lp_course_code[$my_content_id]];
//$scorm_lp_paths[$my_content_id]['path'] = str_replace(' ', '\\ ', $scorm_lp_paths[$my_content_id]['path']);
$sco_path_temp = ($scorm_lp_paths[$my_content_id]['path'] == '/') ? '' : $scorm_lp_paths[$my_content_id]['path'];
$scorm_lp_paths[$my_content_id]['ims'] = $courses_dir.'/scorm'.$sco_path_temp.'/imsmanifest.xml';
//generate an imsmanifest object to get more info about the learnpath from the file
// Generate an imsmanifest object to get more info about the learnpath from the file
$oScorm = new scorm();
//check if imsmanifest.xml exists at this location. If not, ignore the imsmanifest.
//That should have been done before already, now.
// Check whether imsmanifest.xml exists at this location. If not, ignore the imsmanifest.
// That should have been done before already, now.
if (!is_file($scorm_lp_paths[$my_content_id]['ims'])) {
if ($loglevel > 1) { error_log("!!! imsmanifest file not found at ".$scorm_lp_paths[$my_content_id]['ims'].' for old lp '.$my_content_id.' and new '.$lp_ids[$my_content_id], 0); }
$manifest = false;
} else {
//echo "Parsing ".$scorm_lp_paths[$my_content_id]['ims']."<br />\n";
//parse manifest file
// Parse manifest file
$manifest = $oScorm->parse_manifest($scorm_lp_paths[$my_content_id]['ims']);
//the title is already escaped in the method
// The title is already escaped in the method
//$my_lp_title = api_convert_encoding($oScorm->get_title(),'ISO-8859-1',$oScorm->manifest_encoding);
$my_lp_title = api_convert_encoding($oScorm->get_title(), 'ISO-8859-1', 'UTF-8'); // TODO: This "magic" conversion to be checked.
if (!empty($my_lp_title)) {
@ -1027,7 +1027,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
//echo "$sql_items<br />\n";
$res_items = Database::query($sql_items);
while ($scormItem = Database::fetch_array($res_items)) {
$my_sco_id = $scormItem['scoId']; //the index for display??? (check that)
$my_sco_id = $scormItem['scoId']; // The index for display??? (check that)
$my_identifier = $scormItem['scoIdentifier']; //the scorm item path/name
$my_title = Database::escape_string($scormItem['scoTitle']);
$my_status = $scormItem['status'];
@ -1053,7 +1053,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
//echo $sel_sql."<br />\n";
$sel_res = Database::query($sel_sql);
if (Database::num_rows($sel_res) > 0) {
//this item already exists, reuse
// This item already exists, reuse
$row = Database::fetch_array($sel_res);
$item_insert_id = $row['lp_id'];
} else {
@ -1080,12 +1080,12 @@ foreach ($scorms as $my_course_code => $paths_list) {
* Check if a view is needed
*/
if ($my_score != '' and $my_status != 'not attempted') {
//it is worth creating an lp_view and an lp_item_view - otherwise not
// It is worth creating an lp_view and an lp_item_view - otherwise not
$sel_sqlb = "SELECT * FROM $my_new_lp_view " .
"WHERE lp_id = ".$lp_ids[$my_content_id]." AND user_id = $my_student";
$sel_resb = Database::query($sel_sqlb);
if (Database::num_rows($sel_resb) > 0) {
//dont insert
// Don't insert
$rowb = Database::fetch_array($sel_resb);
$view_insert_id = $rowb['id'];
} else {
@ -1113,7 +1113,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
$ins_res = Database::query($ins_sql);
}
}
//UPDATE THE LP_VIEW progress
// UPDATE THE LP_VIEW progress
if (!empty($view_insert_id)) {
$sql = "SELECT count(distinct(lp_item_id)) FROM $my_new_lp_item_view WHERE lp_view_id = ".$view_insert_id." AND status IN ('passed','completed','succeeded','browsed','failed')";
$myres = Database::query($sql);
@ -1144,13 +1144,13 @@ foreach ($scorms as $my_course_code => $paths_list) {
// echo "Error selecting lp: $sel_sql - ".Database::error()."<br />\n";
//}
$lp_details = array();
//while($row = Database::fetch_array($res)) {
//while ($row = Database::fetch_array($res)) {
$ordered_list = array();
$mylist = array();
foreach ($oScorm->organizations as $org) {
//There should be only one organization (generally)
//and if there are more, we are not supposed to have been
//able to manage them before the new tool, so ignore
// There should be only one organization (generally)
// and if there are more, we are not supposed to have been
// able to manage them before the new tool, so ignore
if (count($ordered_list) > 0) {
break;
}
@ -1161,24 +1161,24 @@ foreach ($scorms as $my_course_code => $paths_list) {
$level = 0;
$parent_id = 0;
foreach ($ordered_list as $index => $subarray) {
//$subarray is an array representing one item and that contains info like
//identifier, level, rel_order, prerequisites, title, masteryscore, etc.
// $subarray is an array representing one item and that contains info like
// identifier, level, rel_order, prerequisites, title, masteryscore, etc.
//echo "<pre>Lookin for ".$subarray['identifier']." ".print_r($lp_item_refs,true)."</pre>\n";
if (!empty($lp_item_refs[$in_id][$subarray['identifier']])) {
$new_id = $lp_item_refs[$in_id][$subarray['identifier']];
$next = 0;
$dsp = $subarray['rel_order'];
if ($subarray['level'] > $level) {
//getting one level deeper, just consult
// Getting one level deeper, just consult
$parent_id = $previous;
array_push($stock,$previous);
$level = $subarray['level'];
} elseif ($subarray['level'] == $level) {
//we are on the same level, going to the next id
// We are on the same level, going to the next id
//array_pop($stock);
//array_push($stock, $new_id);
} else {
//getting back from one level deeper
// Getting back from one level deeper
array_pop($stock);
$parent_id = array_pop($stock);
array_push($stock, $parent_id);
@ -1190,17 +1190,17 @@ foreach ($scorms as $my_course_code => $paths_list) {
$path = $oScorm->get_res_path($subarray['identifierref']);
$update_path = '';
if (!empty($path)) {
//if new path is not empty, update
// If new path is not empty, update
$update_path = "path = '$path', ";
}
$type = $oScorm->get_res_type($subarray['identifierref']);
$update_type = '';
if (!empty($type)) {
//if type is defined, update
// If type is defined, update
$update_type = "item_type = '$type', ";
}
if (empty($path)) {
//if path is empty, it is a dir anyway
// If path is empty, it is a dir anyway
$update_type = "item_type = 'dir', ";
}
$prereq = $subarray['prerequisites'];
@ -1209,7 +1209,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
$update_prereq = "prerequisite = '$prereq', ";
}
//we had previous data about this element, update
// We had previous data about this element, update
$sql2 = "UPDATE $my_new_lp_item " .
"SET parent_item_id = $parent_id, " .
"previous_item_id = $previous, " .
@ -1230,7 +1230,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
* See scorm_migrate_hometools.php
*/
//}
//end of case where $my_content_id != -1
// end of case where $my_content_id != -1
}
@ -1251,7 +1251,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
if (preg_match_all($pattern, $intro, $out, PREG_SET_ORDER)) {
foreach ($out as $results) {
//echo "---> replace ".'/'.$results[0].'/ by newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id];
//$intro = preg_replace('/scorm\/scormdocument\.php([^\s"\']*)openDir='.$enc_path.'([\\"\'\s&])/','newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
//$intro = preg_replace('/scorm\/scormdocument\.php([^\s"\']*)openDir='.$enc_path.'([\\"\'\s&])/', 'newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
$intro = preg_replace('@claroline/scorm/scormdocument\.php([^\s"\']*)openDir='.$enc_path.'([^\s"\']*)@','main/newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
}
} else {
@ -1261,7 +1261,7 @@ foreach ($scorms as $my_course_code => $paths_list) {
if (preg_match_all($pattern, $intro, $out, PREG_SET_ORDER)) {
foreach ($out as $results) {
//echo "---> replace ".'/'.$results[0].'/ by newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id];
//$intro = preg_replace('/scorm\/showinframes\.php([^\s"\']*)file=([^\s"\']*)'.$enc_path.'/','newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
//$intro = preg_replace('/scorm\/showinframes\.php([^\s"\']*)file=([^\s"\']*)'.$enc_path.'/', 'newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
$intro = preg_replace('@claroline/scorm/showinframes\.php([^\s"\']*)file=([^\s"\'&]*)'.$enc_path.'([^\s"\']*)@','main/newscorm/lp_controller.php'.$results[1].'action=view&lp_id='.$lp_ids[$my_content_id], $intro);
}
} else {

@ -1,31 +1,12 @@
<?php //$Id: update-files-1.6.x-1.8.0.inc.php 17420 2008-12-22 11:50:15Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2007 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Dokeos files from version 1.6.x to version 1.8.0
* IMPORTANT: This script has to be included by install/index.php or
* update_courses.php
* update_courses.php (deprecated)
*
* SYSTEM_INSTALLATION is defined in the install/index.php (means that we are in
* the regular upgrade process)
@ -76,8 +57,6 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$perm = api_get_permissions_for_new_directories();
//$old_umask = umask(0); // This function is not thread-safe.
while ($courses_directories = Database::fetch_array($result)) {
$currentCourseRepositorySys = $sys_course_path.$courses_directories["directory"]."/";
@ -88,66 +67,66 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
error_log('Directory '.$origCRS.' does not exist. Skipping.', 0);
continue;
}
//move everything to the new hierarchy (from old path to new path)
// 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);
//FOLDER DOCUMENT
// FOLDER DOCUMENT
//document > audio
// document > audio
if (!is_dir($currentCourseRepositorySys."document/audio")) {
mkdir($currentCourseRepositorySys."document/audio", $perm);
insert_db($db_name, "audio", get_lang('Audio'));
}
//document > flash
// document > flash
if (!is_dir($currentCourseRepositorySys."document/flash")) {
mkdir($currentCourseRepositorySys."document/flash", $perm);
insert_db($db_name,"flash",get_lang('Flash'));
}
//document > images
// document > images
if (!is_dir($currentCourseRepositorySys."document/images")) {
mkdir($currentCourseRepositorySys."document/images", $perm);
insert_db($db_name,"images",get_lang('Images'));
}
//document > video
// document > video
if (!is_dir($currentCourseRepositorySys."document/video")) {
mkdir($currentCourseRepositorySys."document/video", $perm);
insert_db($db_name,"video",get_lang('Video'));
}
//document > video > flv
// document > video > flv
if (!is_dir($currentCourseRepositorySys."document/video/flv")) {
mkdir($currentCourseRepositorySys."document/video/flv", $perm);
insert_db($db_name,"video",get_lang('Video')." (flv)");
}
//FOLDER UPLOAD
// FOLDER UPLOAD
//upload
// upload
if (!is_dir($currentCourseRepositorySys."upload")) {
mkdir($currentCourseRepositorySys."upload", $perm);
}
//upload > blog
// upload > blog
if (!is_dir($currentCourseRepositorySys."upload/blog")) {
mkdir($currentCourseRepositorySys."upload/blog", $perm);
}
//upload > forum
// upload > forum
if (!is_dir($currentCourseRepositorySys."upload/forum")) {
mkdir($currentCourseRepositorySys."upload/forum", $perm);
}
//upload > test
// upload > test
if (!is_dir($currentCourseRepositorySys."upload/test")) {
mkdir($currentCourseRepositorySys."upload/test", $perm);
}
//Updating index file in courses directories to change claroline/ into main/
// Updating index file in courses directories to change claroline/ into main/
$content = '<?php'."\n".
'$cidReq="'.$courses_directories['code'].'";'."\n" .
'$dbname="'.$courses_directories['db_name'].'";'."\n" .
@ -164,8 +143,6 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
}
}
//umask($old_umask); // This function is not thread-safe.
// Write the Dokeos config file
write_system_config_file('../inc/conf/configuration.php');
// Write a distribution file with the config as a backup for the admin

@ -1,28 +1,9 @@
<?php //$Id: update-files-1.8.3-1.8.4.inc.php 19996 2009-04-22 22:11:14Z cvargas1 $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2007 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Dokeos files from version 1.8.3 to version 1.8.4
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
@ -43,7 +24,7 @@ require_once '../inc/lib/database.lib.php';
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
// Edit the configuration file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');
$found_version = false;
@ -57,7 +38,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line, '?>')) {
//ignore the line
// Ignore the line
$ignore = true;
}
if (!$ignore) {

@ -1,7 +1,9 @@
<?php //$Id: update-files-1.8.4-1.8.5.inc.php 16083 2008-08-27 20:33:01Z juliomontoya $
/* See license terms in /license.txt */
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Dokeos files from version 1.8.4 to version 1.8.5
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
@ -22,7 +24,7 @@ require_once '../inc/lib/database.lib.php';
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
// Edit the configuration file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');
$found_version = false;
@ -36,7 +38,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable ? 'true' : 'false').';'."\r\n";
} elseif (stristr($line, '?>')) {
//ignore the line
// Ignore the line
$ignore = true;
}
if (!$ignore) {

@ -1,7 +1,9 @@
<?php
/* See license terms in /license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Dokeos files from version 1.8.5 to version 1.8.6
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
@ -22,7 +24,7 @@ require_once '../inc/lib/database.lib.php';
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
// Edit the configuration file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');
$found_version = false;
@ -38,7 +40,7 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
} elseif (stristr($line,'$userPasswordCrypted')) {
$line = '$userPasswordCrypted = \''.($userPasswordCrypted).'\';'."\r\n";
} elseif (stristr($line, '?>')) {
//ignore the line
// Ignore the line
$ignore = true;
}
if (!$ignore) {
@ -57,9 +59,13 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$sys_course_path = $pathForm.'courses/';
//$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
//linking
$res = @Database::connect(array('server' => $dbHostForm, 'username' => $dbUsernameForm, 'password' => $dbPassForm));
Database::select_db($dbNameForm, $link);
//// Linking (The following line is disabled, connection has been already done)
//$res = @Database::connect(array('server' => $dbHostForm, 'username' => $dbUsernameForm, 'password' => $dbPassForm));
//Database::select_db($dbNameForm, $link);
Database::select_db($dbNameForm);
$db_name = $dbNameForm;
$sql = "SELECT * FROM $db_name.course";
error_log('Getting courses for files updates: '.$sql, 0);
@ -67,8 +73,6 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$perm = api_get_permissions_for_new_directories();
//$old_umask = umask(0); // This function is not thread-safe.
while ($courses_directories = Database::fetch_array($result)) {
$currentCourseRepositorySys = $sys_course_path.$courses_directories['directory'].'/';
@ -80,41 +84,41 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
error_log('Directory '.$origCRS.' does not exist. Skipping.', 0);
continue;
}
//move everything to the new hierarchy (from old path to new path)
// 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);
//DOCUMENT FOLDER
// DOCUMENT FOLDER
//document > shared_folder
// document > shared_folder
if (!is_dir($currentCourseRepositorySys."document/shared_folder")) {
mkdir($currentCourseRepositorySys."document/shared_folder", $perm);
}
//UPLOAD FOLDER
// UPLOAD FOLDER
//upload > forum > images
// upload > forum > images
if (!is_dir($currentCourseRepositorySys."upload/forum/images")) {
mkdir($currentCourseRepositorySys."upload/forum/images", $perm);
}
//upload > learning_path
// upload > learning_path
if (!is_dir($currentCourseRepositorySys."upload/learning_path")) {
mkdir($currentCourseRepositorySys."upload/learning_path", $perm);
}
//upload > learning_path > images
// upload > learning_path > images
if (!is_dir($currentCourseRepositorySys."upload/learning_path/images")) {
mkdir($currentCourseRepositorySys."upload/learning_path/images", $perm);
}
//upload > calendar
// upload > calendar
if (!is_dir($currentCourseRepositorySys."upload/calendar")) {
mkdir($currentCourseRepositorySys."upload/calendar", $perm);
}
//upload > calendar > images
// upload > calendar > images
if (!is_dir($currentCourseRepositorySys."upload/calendar/images")) {
mkdir($currentCourseRepositorySys."upload/calendar/images", $perm);
}

@ -1,7 +1,9 @@
<?php
/* See license terms in /license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Dokeos files from version 1.8.6 to version 1.8.6.1
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
@ -22,7 +24,7 @@ require_once '../inc/lib/database.lib.php';
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
// Edit the configuration file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');
$found_version = false;
@ -56,10 +58,8 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$perm = api_get_permissions_for_new_directories();
//$old_umask = umask(0); // This function is not thread-safe.
////create a specific directory for global thumbails
//home > default_platform_document > template_thumb
//// Ccreate a specific directory for global thumbails
// home > default_platform_document > template_thumb
if (!is_dir($pathForm.'home/default_platform_document/template_thumb')) {
mkdir($pathForm.'home/default_platform_document/template_thumb', $perm);
}

@ -1,8 +1,10 @@
<?php
/* See license terms in /license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Updates the Dokeos files from version 1.8.6.1 to version 1.8.6.2
* Chamilo LMS
*
* Updates the Dokeos files from version 1.8.6.1 to Chamilo version 1.8.6.2
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
* current configuration file.
@ -15,7 +17,7 @@ require_once '../inc/lib/fileUpload.lib.php';
require_once '../inc/lib/database.lib.php';
if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
// Edit the Dokeos config file
// Edit the configuration file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php', 'w');
$found_version = false;
@ -51,10 +53,12 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
$perm = api_get_permissions_for_new_directories();
//$old_umask = umask(0); // This function is not thread-safe.
// The following line is disabled, connection has been already done
//$link = Database::connect(array('server' => $dbHostForm, 'username' => $dbUsernameForm, 'password' => $dbPassForm));
//Database::select_db($dbNameForm, $link);
Database::select_db($dbNameForm);
$link = Database::connect(array('server' => $dbHostForm, 'username' => $dbUsernameForm, 'password' => $dbPassForm));
Database::select_db($dbNameForm, $link);
$db_name = $dbNameForm;
$sql = "SELECT * FROM $db_name.course";
error_log('Getting courses for files updates: '.$sql, 0);
@ -62,19 +66,19 @@ if (defined('SYSTEM_INSTALLATION') || defined('DOKEOS_COURSE_UPDATE')) {
while ($courses_directories = Database::fetch_array($result)) {
$currentCourseRepositorySys = $sys_course_path.$courses_directories['directory'].'/';
//upload > announcements
// upload > announcements
if (!is_dir($currentCourseRepositorySys."upload/announcements")){
mkdir($currentCourseRepositorySys."upload/announcements", $perm);
}
//upload > announcements > images
// upload > announcements > images
if (!is_dir($currentCourseRepositorySys."upload/announcements/images")) {
mkdir($currentCourseRepositorySys."upload/announcements/images", $perm);
}
}
////create a specific directory for global thumbails
//home > default_platform_document > template_thumb
//// Create a specific directory for global thumbails
// home > default_platform_document > template_thumb
if (!is_dir($pathForm.'home/default_platform_document/template_thumb')) {
mkdir($pathForm.'home/default_platform_document/template_thumb', $perm);
}

@ -1,7 +1,9 @@
<?php
/* See license terms in /license.txt */
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Chamilo LMS
*
* Updates the Chamilo files from version 1.8.6.2 to version 1.8.7
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the

Loading…
Cancel
Save