database.php (599B)
1 <?php 2 class ControllerStartupDatabase extends Controller { 3 public function index() { 4 if (is_file(DIR_OPENCART . 'config.php') && filesize(DIR_OPENCART . 'config.php') > 0) { 5 $lines = file(DIR_OPENCART . 'config.php'); 6 7 foreach ($lines as $line) { 8 if (strpos(strtoupper($line), 'DB_') !== false) { 9 eval($line); 10 } 11 } 12 13 if (defined('DB_PORT')) { 14 $port = DB_PORT; 15 } else { 16 $port = ini_get('mysqli.default_port'); 17 } 18 19 $this->registry->set('db', new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, $port)); 20 } 21 } 22 }