diff options
Diffstat (limited to 'public/install/controller/startup/database.php')
-rw-r--r-- | public/install/controller/startup/database.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/public/install/controller/startup/database.php b/public/install/controller/startup/database.php new file mode 100644 index 0000000..a4cf4cf --- /dev/null +++ b/public/install/controller/startup/database.php @@ -0,0 +1,22 @@ +<?php +class ControllerStartupDatabase extends Controller { + public function index() { + if (is_file(DIR_OPENCART . 'config.php') && filesize(DIR_OPENCART . 'config.php') > 0) { + $lines = file(DIR_OPENCART . 'config.php'); + + foreach ($lines as $line) { + if (strpos(strtoupper($line), 'DB_') !== false) { + eval($line); + } + } + + if (defined('DB_PORT')) { + $port = DB_PORT; + } else { + $port = ini_get('mysqli.default_port'); + } + + $this->registry->set('db', new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, $port)); + } + } +}
\ No newline at end of file |