From d7f00fde42b5288a09a5c39db2e43fba0dd9f1ab Mon Sep 17 00:00:00 2001 From: Patrick Cool Date: Mon, 20 Nov 2006 20:52:42 +0100 Subject: [PATCH] [svn r10063] replace $courseTablePrefix with $_configuration['table_prefix'] --- main/calendar/agenda.inc.php | 4 ++-- main/calendar/myagenda.php | 8 ++++---- main/inc/lib/add_course.lib.inc.php | 22 ++++++++++++---------- main/inc/lib/course.lib.php | 11 ++++++----- main/inc/lib/database.lib.php | 2 +- main/inc/local.inc.php | 2 +- main/install/configuration.dist.php | 7 +++---- main/install/update_db.inc.php | 6 +++--- 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php index 39413b2acf..8817c0aed5 100644 --- a/main/calendar/agenda.inc.php +++ b/main/calendar/agenda.inc.php @@ -1,4 +1,4 @@ -db_name; api_sql_query($sql, __FILE__, __LINE__); } else { - $db_pattern = $courseTablePrefix.$course->db_name.$dbGlu; + $db_pattern = $_configuration['table_prefix'].$course->db_name.$dbGlu; $sql = "SHOW TABLES LIKE '$db_pattern%'"; $result = api_sql_query($sql, __FILE__, __LINE__); while (list ($courseTable) = mysql_fetch_row($result)) @@ -1344,8 +1344,9 @@ class CourseManager */ function create_database_dump($course_code) { - global $singleDbEnabled; - if ($singleDbEnabled) + global $_configuration; + + if ($_configuration['single_database']) { return; } diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index c93bb5463a..8a1e10f747 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -457,7 +457,7 @@ class Database $_course['sysCode' ] = $cData['code' ]; // use as key in db $_course['path' ] = $cData['directory' ]; // use as key in path $_course['dbName' ] = $cData['db_name' ]; // use as key in db list - $_course['dbNameGlu' ] = $courseTablePrefix . $cData['dbName'] . $dbGlu; // use in all queries + $_course['dbNameGlu' ] = $_configuration['table_prefix'] . $cData['dbName'] . $dbGlu; // use in all queries $_course['titular' ] = $cData['tutor_name' ]; $_course['language' ] = $cData['course_language' ]; $_course['extLink' ]['url' ] = $cData['department_url' ]; diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 6e3646949d..2b805a8a02 100644 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -469,7 +469,7 @@ if (isset($cidReset) && $cidReset) // course session data refresh requested or e $_course['sysCode' ] = $cData['code' ]; // use as key in db $_course['path' ] = $cData['directory' ]; // use as key in path $_course['dbName' ] = $cData['db_name' ]; // use as key in db list - $_course['dbNameGlu' ] = $courseTablePrefix . $cData['db_name'] . $dbGlu; // use in all queries + $_course['dbNameGlu' ] = $_configuration['table_prefix'] . $cData['db_name'] . $dbGlu; // use in all queries $_course['titular' ] = $cData['tutor_name' ]; $_course['language' ] = $cData['course_language' ]; $_course['extLink' ]['url' ] = $cData['department_url' ]; diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 7bc0fa3c14..df4fd3659a 100644 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -65,10 +65,9 @@ $_configuration['db_password'] = '{DATABASE_PASSWORD}'; // Is tracking enabled? $_configuration['tracking_enabled'] = {TRACKING_ENABLED}; // Is single database enabled (DO NOT MODIFY THIS) -$singleDbEnabled = {SINGLE_DATABASE}; -// Prefix for course tables (IF NOT EMPTY, can be replaced by another prefix, -// else leave empty) -$courseTablePrefix = '{COURSE_TABLE_PREFIX}'; +$_configuration['single_database'] = {SINGLE_DATABASE}; +// Prefix for course tables (IF NOT EMPTY, can be replaced by another prefix, else leave empty) +$_configuration['table_prefix'] = '{COURSE_TABLE_PREFIX}'; // Separator between database and table name (DO NOT MODIFY THIS) $dbGlu = '{DATABASE_GLUE}'; // prefix all created bases (for courses) with this string diff --git a/main/install/update_db.inc.php b/main/install/update_db.inc.php index 39b966f6c2..74ffe268dc 100644 --- a/main/install/update_db.inc.php +++ b/main/install/update_db.inc.php @@ -59,7 +59,7 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) if ($singleDbForm) { - $courseTablePrefix = get_config_param('courseTablePrefix'); + $_configuration['table_prefix'] = get_config_param('courseTablePrefix'); } $dbScormForm = eregi_replace('[^a-z0-9_-]', '', $dbScormForm); @@ -449,9 +449,9 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) { if ($singleDbForm) { - $prefix = $courseTablePrefix.$mysql_base_course.$dbGlu; + $prefix = $_configuration['table_prefix'].$mysql_base_course.$dbGlu; - $mysql_base_course = $dbNameForm.'`.`'.$courseTablePrefix.$mysql_base_course; + $mysql_base_course = $dbNameForm.'`.`'.$_configuration['table_prefix'].$mysql_base_course; } else {