Example #1
0
 private static function load_laravel_3($lar_path)
 {
     // ----------- Grab The Database Config ----------------- //
     // We grab the array for detecting if this is a local or production env.
     // We assume the path.php file is one directory above the applications
     // directory. If it is not you will have to configure the CMS by hand.
     require $lar_path . '/../paths.php';
     // The require above screws up the current working directory. So we fix.
     chdir(self::$_root_path);
     // Figure out what env we are in.
     if (!(self::$env = self::detect_env($environments, $_SERVER['HTTP_HOST']))) {
         self::$env = 'production';
     }
     // Grab the default configs.
     $tmp = (require $lar_path . '/config/database.php');
     $default = $tmp['default'];
     $database = $tmp['connections'][$default];
     // If we are in a local dev env we look for a local folder and merge.
     $file = $lar_path . '/config/' . self::$env . '/database.php';
     if (is_file($file)) {
         $tmp = (require $file);
         if (isset($tmp['connections'][$default])) {
             $database = array_merge($database, $tmp['connections'][$default]);
         }
     }
     // Set the database configs we sucked out of Laravel
     CMS\Libraries\Config::set('db_host', $database['host']);
     CMS\Libraries\Config::set('db_database', $database['database']);
     CMS\Libraries\Config::set('db_username', $database['username']);
     CMS\Libraries\Config::set('db_password', $database['password']);
 }