Skip to content

Commit

Permalink
Modified "lib-database.php" so that Geeklog\Autoload will be loaded a…
Browse files Browse the repository at this point in the history
…utomatically
  • Loading branch information
mystralkk committed Sep 1, 2020
1 parent bcc1b95 commit 2af0773
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 3 additions & 5 deletions public_html/admin/install/classes/installer.class.php
Expand Up @@ -995,15 +995,13 @@ private function listOfSupportedDBs($gl_path, $selected_dbtype, $list_innodb = f
$prefix = $info['file'];

if (file_exists($gl_path . '/sql/' . $prefix . '_tableanddata.php') &&
file_exists($gl_path . '/system/databases/' . $prefix
. '.class.php')
file_exists($gl_path . '/system/classes/Database/Db' . ucfirst($prefix)
. '.php')
) {
if ($prefix === 'mysql') {
// check that the MySQLi driver file is also there so we
// don't have to check for it every time at runtime
if (!file_exists($gl_path . '/system/databases/'
. 'mysqli.class.php')
) {
if (!file_exists($gl_path . '/system/classes/Database/DbMysqli.php')) {
continue;
}
}
Expand Down
11 changes: 8 additions & 3 deletions system/lib-database.php
Expand Up @@ -140,14 +140,19 @@
$_DB_charset = $_CONF['default_charset'];
}

if (!class_exists('Geeklog\\Autoload')) {
include_once __DIR__ . '/classes/Autoload.php';
Geeklog\Autoload::initialize();
}

if ($_DB_dbms === 'mysql') {
if (class_exists('MySQLi')) {
$_DB = new DbMysqli($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
$_DB = new Geeklog\Database\DbMysqli($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
} else {
$_DB = new DbMysql($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
$_DB = new Geeklog\Database\DbMysql($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
}
} elseif ($_DB_dbms === 'pgsql') {
$_DB = new DbPgsql($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
$_DB = new Geeklog\Database\DbPgsql($_DB_host, $_DB_name, $_DB_user, $_DB_pass, $_DB_table_prefix, 'COM_errorLog', $_DB_charset);
} else {
throw new InvalidArgumentException(sprintf('Unknown database driver "%s" was specified', $_DB_dbms));
}
Expand Down

0 comments on commit 2af0773

Please sign in to comment.