From 2af0773110c200f0540b4e5c0c2b1e0516ea3130 Mon Sep 17 00:00:00 2001 From: mystralkk Date: Tue, 1 Sep 2020 15:05:31 +0900 Subject: [PATCH] Modified "lib-database.php" so that Geeklog\Autoload will be loaded automatically --- public_html/admin/install/classes/installer.class.php | 8 +++----- system/lib-database.php | 11 ++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public_html/admin/install/classes/installer.class.php b/public_html/admin/install/classes/installer.class.php index ad95fb91e..7f21577ec 100644 --- a/public_html/admin/install/classes/installer.class.php +++ b/public_html/admin/install/classes/installer.class.php @@ -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; } } diff --git a/system/lib-database.php b/system/lib-database.php index 518786e27..556d4ba78 100644 --- a/system/lib-database.php +++ b/system/lib-database.php @@ -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)); }