Advertisement
dracula1337

Untitled

Jul 3rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement