예제 #1
0
 /**
  * 
  * Loads the configs from database to the cache
  * @return boolean
  */
 private function load_config()
 {
     //we don't read the config cache in development
     self::$data = Kohana::$environment === Kohana::DEVELOPMENT ? NULL : Core::cache('config_db');
     //only load if empty
     if (self::$data === NULL) {
         // Load all the config data to cache
         $query = DB::select('group_name')->select('config_key')->select('config_value')->from($this->_table_name)->order_by('group_name', 'asc')->order_by('config_key', 'asc')->execute();
         $configs = $query->as_array();
         foreach ($configs as $config) {
             self::$data[$config['group_name']][$config['config_key']] = $config['config_value'];
         }
         //caching all the results
         Core::cache('config_db', self::$data, 60 * 60 * 24);
         return TRUE;
     } else {
         //was already cached
         return FALSE;
     }
 }