blob: a4cf4cf3ebecee828c3e67a3075e9c23c37f2b14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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));
}
}
}
|