Changeset 3366

Show
Ignore:
Timestamp:
08/27/2008 05:15:39 PM (3 months ago)
Author:
Shadowhand
Message:

API CHANGE! Major changes to error reporting, routing, and class naming!

Complete change of autoloading: classes are now loaded by changing underscores to slashes to create a path, eg: Controller_Admin_User would be found at classes/admin/user.php (See routing changes below for more information)

  • All classes (libraries, helpers, controllers, and models) are now stored under the classes/ directory
  • Controllers and models are now prefixed instead of suffixed (eg: Controller_Welcome instead of Welcome_Controller)
  • All classes can now become transparently extensible by adding a "Core" suffix (eg: User_Model_Core extends Model)
  • Archive module has had it's drivers updated with new paths, but other modules will need to be updated, and will be non-functional temporarily

Complete routing change: routes are now defined similar to Horde Routes (see http://dev.horde.org/routes/manual/nitty-gritty-route-setup.html ), see http://paste.isanonymo.us/Dmq6n6FYfHnFFhbFs0weS8KqfDgBiGkS for an example of new routes configuration. Official documentation to follow.

  • Default route in system/config/routes.php changed
  • URI class removed because all arguments are now named (eg: Router::$argumentsid? to fetch the :id arg)
  • Added Router::compile to compile the regex for given route (protected)
  • Added Router::keys to find the :keys from a URI string
  • Added Router::uri to generate a URI from a route name and values (not complete)

Other misc changes:

  • Errors and exceptions are now inline, rather than replacing the entire page. Having core.display_errors disabled has no effect (not complete)
  • Added application/i18n/en_US directory for application language files (eg: Validation errors)
  • UTF-8 environment check moved to bootstrap.php
Location:
trunk
Files:
60 added
9 removed
16 modified
67 moved

Legend:

Unmodified
Added
Removed
  • trunk/application/cache

    • Property svn:ignore set to
      *
  • trunk/application/classes/controller/examples.php

    r3326 r3366  
    1313 * @license    http://kohanaphp.com/license.html 
    1414 */ 
    15 class Examples_Controller extends Controller { 
     15class Controller_Examples extends Controller { 
    1616 
    1717        // Do not allow to run in production 
  • trunk/application/classes/controller/welcome.php

    r3326 r3366  
    99 * @license    http://kohanaphp.com/license.html 
    1010 */ 
    11 class Welcome_Controller extends Template_Controller { 
     11class Controller_Welcome extends Controller_Template { 
    1212 
    1313        // Disable this controller when Kohana is set to production mode. 
  • trunk/application/config/config.php

    r3326 r3366  
    9797$config['modules'] = array 
    9898( 
     99        // MODPATH.'archive',   // Archive utility 
    99100        // MODPATH.'auth',      // Authentication 
    100101        // MODPATH.'forge',     // Form generation 
     
    102103        // MODPATH.'media',     // Media caching and compression 
    103104        // MODPATH.'gmaps',     // Google Maps integration 
    104         // MODPATH.'archive',   // Archive utility 
    105105        // MODPATH.'payment',   // Online payments 
    106106        // MODPATH.'unit_test', // Unit testing 
  • trunk/application/logs

    • Property svn:ignore
      •  

        old new  
        1 *.log.php 
         1* 
  • trunk/index.php

    r3168 r3366  
    106106 
    107107        // Check SYSPATH 
    108         if ( ! (is_dir(SYSPATH) AND is_file(SYSPATH.'core/Bootstrap'.EXT))) 
     108        if ( ! (is_dir(SYSPATH) AND is_file(SYSPATH.'bootstrap'.EXT))) 
    109109        { 
    110110                die 
     
    119119} 
    120120 
    121 // Initialize. 
    122 require SYSPATH.'core/Bootstrap'.EXT; 
     121// Initialize Kohana 
     122require SYSPATH.'bootstrap'.EXT; 
  • trunk/modules/archive/classes/archive.php

    r3326 r3366  
    3030 
    3131                // Set driver name 
    32                 $driver = 'Archive_'.ucfirst($type).'_Driver'; 
     32                $driver = 'Archive_Driver_'.ucfirst($type); 
    3333 
    3434                // Load the driver 
     
    140140        public function download($filename) 
    141141        { 
    142                 download::force($filename, $this->driver->create($this->paths)); 
     142                file::download($filename, $this->driver->create($this->paths)); 
    143143        } 
    144144 
  • trunk/system/bootstrap.php

    r3345 r3366  
    2121 
    2222// Load benchmarking support 
    23 require SYSPATH.'core/Benchmark'.EXT; 
     23require SYSPATH.'classes/benchmark'.EXT; 
    2424 
    2525// Start total_execution 
     
    8080 
    8181// Load utf8 support 
    82 require SYSPATH.'core/utf8'.EXT; 
     82require SYSPATH.'classes/utf8'.EXT; 
    8383 
    8484// Convert all global variables to UTF-8. 
     
    9595 
    9696// Load Event support 
    97 require SYSPATH.'core/Event'.EXT; 
     97require SYSPATH.'classes/event'.EXT; 
    9898 
    9999// Load Kohana core 
    100 require SYSPATH.'core/Kohana'.EXT; 
     100require SYSPATH.'classes/kohana'.EXT; 
    101101 
    102102// Prepare the environment 
  • trunk/system/classes/arr.php

  • trunk/system/classes/cache.php

  • trunk/system/classes/cache/driver.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 interface Cache_Driver { 
     12abstract class Cache_Driver { 
    1313 
    1414        /** 
    1515         * Set a cache item. 
    1616         */ 
    17         public function set($id, $data, $tags, $lifetime); 
     17        abstract public function set($id, $data, $tags, $lifetime); 
    1818 
    1919        /** 
    2020         * Find all of the cache ids for a given tag. 
    2121         */ 
    22         public function find($tag); 
     22        abstract public function find($tag); 
    2323 
    2424        /** 
     
    2626         * Return NULL if the cache item is not found. 
    2727         */ 
    28         public function get($id); 
     28        abstract public function get($id); 
    2929 
    3030        /** 
    3131         * Delete cache items by id or tag. 
    3232         */ 
    33         public function delete($id, $tag = FALSE); 
     33        abstract public function delete($id, $tag = FALSE); 
    3434 
    3535        /** 
    3636         * Deletes all expired cache items. 
    3737         */ 
    38         public function delete_expired(); 
     38        abstract public function delete_expired(); 
    3939 
    4040} // End Cache Driver 
  • trunk/system/classes/cache/driver/apc.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_Apc_Driver implements Cache_Driver { 
     12class Cache_Driver_Apc_Core extends Cache_Driver { 
    1313 
    1414        public function __construct() 
  • trunk/system/classes/cache/driver/eaccelerator.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_Eaccelerator_Driver implements Cache_Driver { 
     12class Cache_Driver_Eaccelerator_Core extends Cache_Driver { 
    1313 
    1414        public function __construct() 
  • trunk/system/classes/cache/driver/file.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_File_Driver implements Cache_Driver { 
     12class Cache_Driver_File_Core extends Cache_Driver { 
    1313 
    1414        protected $directory = ''; 
  • trunk/system/classes/cache/driver/memcache.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_Memcache_Driver implements Cache_Driver { 
     12class Cache_Driver_Memcache extends Cache_Driver { 
    1313 
    1414        // Cache backend object and flags 
  • trunk/system/classes/cache/driver/sqlite.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_Sqlite_Driver implements Cache_Driver { 
     12class Cache_Driver_Sqlite_Core extends Cache_Driver { 
    1313 
    1414        // SQLite database instance 
  • trunk/system/classes/cache/driver/xcache.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Cache_Xcache_Driver implements Cache_Driver { 
     12class Cache_Driver_Xcache_Core extends Cache_Driver { 
    1313 
    1414        public function __construct() 
  • trunk/system/classes/calendar.php

  • trunk/system/classes/calendar/event.php

  • trunk/system/classes/captcha.php

    r3326 r3366  
    122122 
    123123                // Set driver name 
    124                 $driver = 'Captcha_'.ucfirst($config['style']).'_Driver'; 
     124                $driver = 'Captcha_Driver_'.ucfirst($config['style']); 
    125125 
    126126                // Load the driver 
  • trunk/system/classes/captcha/driver.php

  • trunk/system/classes/captcha/driver/alpha.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Captcha_Alpha_Driver extends Captcha_Driver { 
     12class Captcha_Driver_Alpha_Core extends Captcha_Driver { 
    1313 
    1414        /** 
  • trunk/system/classes/captcha/driver/basic.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Captcha_Basic_Driver extends Captcha_Driver { 
     12class Captcha_Driver_Basic_Core extends Captcha_Driver { 
    1313 
    1414        /** 
  • trunk/system/classes/captcha/driver/black.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Captcha_Black_Driver extends Captcha_Driver { 
     12class Captcha_Driver_Black_Core extends Captcha_Driver { 
    1313 
    1414        /** 
  • trunk/system/classes/captcha/driver/math.php

    r3326 r3366  
    1010 * @license    http://kohanaphp.com/license.html 
    1111 */ 
    12 class Captcha_Math_Driver extends Captcha_Driver { 
     12class Captcha_Driver_Math_Core extends Captcha_Driver { 
    1313</