Renamed global variable (and made more global for access by mysqli driver)

skala
ywarnier 14 years ago
parent 00c13670cf
commit 228135ecbe
  1. 4
      main/inc/banner.inc.php
  2. 17
      main/inc/global.inc.php

@ -486,14 +486,14 @@ if (api_get_setting('show_toolshortcuts') == 'true') {
echo '</div>';
}
if (isset($dokeos_database_connection)) {
if (isset($database_connection)) {
// connect to the main database.
// if single database, don't pefix table names with the main database name in SQL queries
// (ex. SELECT * FROM `table`)
// if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in
// the main database)
// (ex. SELECT * FROM `table_from_main_db` - SELECT * FROM `courseDB`.`table_from_course_db`)
Database::select_db($_configuration['main_database'], $dokeos_database_connection);
Database::select_db($_configuration['main_database'], $database_connection);
}
?>

@ -107,14 +107,15 @@ if (empty($_configuration['statistics_database']) && $already_installed) {
$_configuration['statistics_database'] = $_configuration['main_database'];
}
global $database_connection;
// Connect to the server database and select the main chamilo database.
if (!($dokeos_database_connection = @Database::connect(
array(
'server' => $_configuration['db_host'],
'username' => $_configuration['db_user'],
'password' => $_configuration['db_password'],
'persistent' => $_configuration['db_persistent_connection'] // When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
)))) {
if (!($conn_return = @Database::connect(
array(
'server' => $_configuration['db_host'],
'username' => $_configuration['db_user'],
'password' => $_configuration['db_password'],
'persistent' => $_configuration['db_persistent_connection'] // When $_configuration['db_persistent_connection'] is set, it is expected to be a boolean type.
)))) {
$global_error_code = 3;
// The database server is not available or credentials are invalid.
require $includePath.'/global_error_message.inc.php';
@ -148,7 +149,7 @@ if (!empty($_configuration['multiple_access_urls'])) {
// The system has not been designed to use special SQL modes that were introduced since MySQL 5.
Database::query("set session sql_mode='';");
if (!Database::select_db($_configuration['main_database'], $dokeos_database_connection)) {
if (!Database::select_db($_configuration['main_database'], $database_connection)) {
$global_error_code = 5;
// Connection to the main Chamilo database is impossible, it might be missing or restricted or its configuration option might be incorrect.
require $includePath.'/global_error_message.inc.php';

Loading…
Cancel
Save