Changeset 2683

Show
Ignore:
Timestamp:
05/21/2008 12:41:58 PM (6 months ago)
Author:
Shadowhand
Message:

Updated Config:

  • Added clear($group) method
  • Updated load() to handle "core" requests
  • Changed item() to use load() to load "core"
  • Changed allow_config_set calls to be logged as errors (was debug)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/core/Config.php

    r2627 r2683  
    3131                if (self::$conf === NULL) 
    3232                { 
    33                         // Load the application configuration file 
    34                         require APPPATH.'config/config'.EXT; 
    35  
    36                         // Invalid config file 
    37                         (isset($config) AND is_array($config)) or die 
    38                         ( 
    39                                 'Your Kohana application configuration file is not valid.' 
    40                         ); 
    41  
    42                         // Load config into self 
    43                         self::$conf['core'] = $config; 
     33                        // Load core configuration 
     34                        self::$conf['core'] = self::load('core'); 
    4435 
    4536                        // Re-parse the include paths 
     
    8071                if (Config::item('core.allow_config_set') == FALSE) 
    8172                { 
    82                         Log::add('debug', 'Config::set was called, but your configuration file does not allow setting.'); 
     73                        Log::add('error', 'Config::set was called, but your configuration file does not allow setting.'); 
    8374                        return FALSE; 
    8475                } 
     
    131122 
    132123        /** 
     124         * Clears a config group from the cached configuration. 
     125         * 
     126         * @param   string  config group 
     127         * @return  TRUE 
     128         */ 
     129        public function clear($key) 
     130        { 
     131                unset(self::$conf[$key]); 
     132 
     133                return TRUE; 
     134        } 
     135 
     136        /** 
    133137         * Get all include paths. 
    134138         * 
     
    168172        public static function load($name, $required = TRUE) 
    169173        { 
     174                if ($name === 'core') 
     175                { 
     176                        // Load the application configuration file 
     177                        include APPPATH.'config/config'.EXT; 
     178 
     179                        if (empty($config['site_domain'])) 
     180                        { 
     181                                // Invalid config file 
     182                                die('Your Kohana application configuration file is not valid.'); 
     183                        } 
     184 
     185                        return $config; 
     186                } 
     187 
    170188                $configuration = array(); 
    171189