Changeset 1773

Show
Ignore:
Timestamp:
01/21/2008 10:56:43 AM (12 months ago)
Author:
Geert
Message:

Follow-up to r1772:

  • Kohana::auto_load() must not throw exceptions since that would break other attached auto-loaders (e.g. Swift). Thanks for pointing this out, Woody.
  • Now manually loading drivers which has the added speed benefit.
Location:
trunk/system
Files:
7 modified

Legend:

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

    r1772 r1773  
    597597 
    598598                // If the file doesn't exist, just return 
    599                 if (($filepath = self::find_file($type, $file, TRUE)) === FALSE) 
     599                if (($filepath = self::find_file($type, $file)) === FALSE) 
    600600                        return; 
    601601 
  • trunk/system/libraries/Archive.php

    r1772 r1773  
    3434                        $driver = 'Archive_'.ucfirst(strtolower($type)).'_Driver'; 
    3535 
    36                         // Manually autoload so that exceptions can be caught 
    37                         Kohana::auto_load($driver); 
     36                        // Manually load so that exceptions can be caught 
     37                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    3838                } 
    3939                catch (Kohana_Exception $exception) 
     
    4646 
    4747                // Validate the driver 
    48                 if ( ! in_array('Archive_Driver', class_implements($this->driver))) 
     48                if ( ! (self::$driver instanceof Archive_Driver)) 
    4949                        throw new Kohana_Exception('archive.driver_implements', $type); 
    5050 
  • trunk/system/libraries/Cache.php

    r1772 r1773  
    3939                        $driver = 'Cache_'.ucfirst(strtolower($this->config['driver'])).'_Driver'; 
    4040 
    41                         // Manually autoload so that exceptions can be caught 
    42                         Kohana::auto_load($driver); 
     41                        // Manually load so that exceptions can be caught 
     42                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    4343                } 
    4444                catch (Kohana_Exception $e) 
     
    5151 
    5252                // Validate the driver 
    53                 if ( ! in_array('Cache_Driver', class_implements($this->driver))) 
     53                if ( ! (self::$driver instanceof Cache_Driver)) 
    5454                        throw new Kohana_Exception('cache.driver_not_supported', 'Cache drivers must use the Cache_Driver interface.'); 
    5555 
  • trunk/system/libraries/Database.php

    r1772 r1773  
    157157                        $driver = 'Database_'.ucfirst(strtolower($this->config['connection']['type'])).'_Driver'; 
    158158 
    159                         // Manually autoload so that exceptions can be caught 
    160                         Kohana::auto_load($driver); 
     159                        // Manually load so that exceptions can be caught 
     160                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    161161                } 
    162162                catch (Kohana_Exception $e) 
     
    169169 
    170170                // Validate the driver 
    171                 if ( ! ($this->driver instanceof Database_Driver)) 
     171                if ( ! (self::$driver instanceof Database_Driver)) 
    172172                        throw new Kohana_Exception('database.driver_not_supported', 'Database drivers must use the Database_Driver interface.'); 
    173173 
  • trunk/system/libraries/Image.php

    r1772 r1773  
    6969                        $driver = 'Image_'.ucfirst(strtolower($this->config['driver'])).'_Driver'; 
    7070 
    71                         // Manually autoload so that exceptions can be caught 
    72                         Kohana::auto_load($driver); 
     71                        // Manually load so that exceptions can be caught 
     72                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    7373                } 
    7474                catch (Kohana_Exception $e) 
     
    8080                $this->driver = new $driver($this->config['params']); 
    8181 
    82                 if ( ! ($this->driver instanceof Image_Driver)) 
     82                if ( ! (self::$driver instanceof Image_Driver)) 
    8383                        throw new Kohana_Exception('image.invalid_driver', $driver); 
    8484        } 
  • trunk/system/libraries/Payment.php

    r1772 r1773  
    8383                        $driver = 'Payment_'.ucfirst(strtolower($this->config['driver'])).'_Driver'; 
    8484 
    85                         // Manually autoload so that exceptions can be caught 
    86                         Kohana::auto_load($driver); 
     85                        // Manually load so that exceptions can be caught 
     86                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    8787                } 
    8888                catch (Kohana_Exception $e) 
  • trunk/system/libraries/Session.php

    r1772 r1773  
    6161                                        $driver = 'Session_'.ucfirst(strtolower(self::$config['driver'])).'_Driver'; 
    6262 
    63                                         // Manually autoload so that exceptions can be caught 
    64                                         Kohana::auto_load($driver); 
     63                                        // Manually load so that exceptions can be caught 
     64                                        require_once Kohana::find_file('libraries/drivers', substr($driver, 0, -7), TRUE); 
    6565                                } 
    6666                                catch (Kohana_Exception $e) 
     
    7373 
    7474                                // Validate the driver 
    75                                 if ( ! in_array('Session_Driver', class_implements(self::$driver))) 
     75                                if ( ! (self::$driver instanceof Session_Driver)) 
    7676                                        throw new Kohana_Exception('session.driver_must_implement_interface'); 
    7777                        }