public static function setup(){
     $databases = Config::instance('databases')->to_array();
     $db_config_array = array();
     $db_config_array['loglevel'] = Config::instance('framework')->get_value('debug') ? 4 : 3;
     foreach($databases as $db_id=>$db_conn_string){
         if(is_array($db_conn_string)){
             $db_info = array();
             foreach((array)$db_conn_string as $key=>$val){
                 $db_info[$key] = self::parse_database_connection_url($val);
             }
         } else {
             $db_info = self::parse_database_connection_url($db_conn_string);
         }
         $db_config_array['dbs'][$db_id] = $db_info;
     }
     Database_Manager::init($db_config_array);
 }
Beispiel #2
0
 public static function scope_available($find){
     $databases = Config::instance('databases')->to_array();
     $available_realm_ids = array_keys($databases['realm']);
     return $find->where(array('id IN (' . join(',',$available_realm_ids) . ')' ));
 }
 function config($key,$scope=''){
     return Config::instance('framework')->get_value($key, $scope);
 }
Beispiel #4
0
 private static function get_file_path(){
     $lang = Config::instance('framework')->get_value('lang');
     return APP_ROOT . "/lang/" . $lang . "/*.yml";
 }