Changeset 2003

Show
Ignore:
Timestamp:
02/08/2008 07:19:05 PM (11 months ago)
Author:
Shadowhand
Message:

Upgrading trunk to be PHP 5.2+ compatible:

  • index.php check upgraded to 5.2
  • All checks for PHP < 5.2 in libraries and helpers removed
  • Removed unnecessary examples
  • Re-organized Bootstrap pre-initialization setup
  • Updated module path handling to define MODPATH in index.php
  • Updated module paths in config.php to use MODPATH for default modules
  • Removed Loader and core.preload configuration setting
Location:
trunk
Files:
3 removed
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/application/config/config.php

    r1937 r2003  
    6262$config['modules'] = array 
    6363( 
    64         // 'modules/auth',   // Authentication 
    65         // 'modules/forge',  // Form generation 
    66         // 'modules/kodoc',  // Self-generating documentation 
    67         // 'modules/media',  // Media caching and compression 
     64        // MODPATH.'auth',   // Authentication 
     65        // MODPATH.'forge',  // Form generation 
     66        // MODPATH.'kodoc',  // Self-generating documentation 
     67        // MODPATH.'media',  // Media caching and compression 
    6868); 
    69  
    70 /** 
    71  * Libraries and models to be automatically preloaded into every controller. Use 
    72  * a comma-separated list to set multiple items. 
    73  */ 
    74 $config['preload'] = array 
    75 ( 
    76         'libraries' => '', 
    77         'models'    => '', 
    78 ); 
  • trunk/index.php

    r1631 r2003  
    22/** 
    33 * This file acts as the "front controller" to your application. You can 
    4  * configure your application and system directories here, as well as error 
    5  * reporting and error display. 
     4 * configure your application, modules, and system directories here. 
     5 * PHP error_reporting level may also be changed. 
    66 * 
    77 * @package    Core 
     
    1212 
    1313/** 
    14  * Kohana website application directory. This directory should contain your 
    15  * application configuration, controllers, models, views, and other resources. 
     14 * Website application directory. This directory should contain your application 
     15 * configuration, controllers, models, views, and other resources. 
    1616 * 
    1717 * This path can be absolute or relative to this file. 
     
    2020 
    2121/** 
    22  * Kohana package files. This directory should contain the core/ directory, and 
    23  * the resources you included in your download of Kohana. 
     22 * Kohana modules directory. This directory should contain all the modules used 
     23 * by your application. Modules are enabled and disabled by the application 
     24 * configuration file. 
     25 * 
     26 * This path can be absolute or relative to this file. 
     27 */ 
     28$kohana_modules = 'modules'; 
     29 
     30/** 
     31 * Kohana system directory. This directory should contain the core/ directory, 
     32 * and the resources you included in your download of Kohana. 
    2433 * 
    2534 * This path can be absolute or relative to this file. 
    2635 */ 
    2736$kohana_system = 'system'; 
     37 
    2838 
    2939/** 
     
    5060 * sure that your environment is compatible with Kohana, you can disable this. 
    5161 */ 
    52 version_compare(PHP_VERSION, '5.1.3', '<') and exit('Kohana requires PHP 5.1.3 or newer.'); 
     62version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.'); 
    5363 
    5464// 
     
    6474// Define application and system paths 
    6575define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/'); 
     76define('MODPATH', str_replace('\\', '/', realpath($kohana_modules)).'/'); 
    6677define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/'); 
    6778 
    6879// Clean up 
    69 unset($kohana_application, $kohana_system); 
     80unset($kohana_application, $kohana_modules, $kohana_system); 
    7081 
    7182(is_dir(APPPATH) AND is_dir(APPPATH.'/config')) or die 
  • trunk/system/core/Bootstrap.php

    r1522 r2003  
    1111 */ 
    1212 
    13 define('KOHANA_VERSION',  '2.1'); 
    14 define('KOHANA_CODENAME', 'Schneefeier'); 
     13define('KOHANA_VERSION',  '2.2'); 
     14define('KOHANA_CODENAME', 'efímera'); 
    1515 
    1616// Kohana benchmarks are prefixed by a random string to prevent collisions 
     
    2020require SYSPATH.'core/Benchmark'.EXT; 
    2121 
    22 // Start: total_execution 
     22// Start total_execution 
    2323Benchmark::start(SYSTEM_BENCHMARK.'_total_execution'); 
    2424 
    25 // Start: kohana_loading 
     25// Start kohana_loading 
    2626Benchmark::start(SYSTEM_BENCHMARK.'_kohana_loading'); 
    2727 
    28 // Define Kohana error constant 
    29 defined('E_KOHANA') or define('E_KOHANA', 42); 
    30 // Define 404 error constant 
    31 defined('E_PAGE_NOT_FOUND') or define('E_PAGE_NOT_FOUND', 43); 
    32 // Define database error constant 
    33 defined('E_DATABASE_ERROR') or define('E_DATABASE_ERROR', 44); 
    34 // Define extra E_RECOVERABLE_ERROR for PHP < 5.2 
    35 defined('E_RECOVERABLE_ERROR') or define('E_RECOVERABLE_ERROR', 4096); 
    3628// Load core files 
    3729require SYSPATH.'core/utf8'.EXT; 
     
    4133require SYSPATH.'core/Kohana'.EXT; 
    4234 
    43 // End: kohana_loading 
     35// Prepare the environment 
     36Kohana::setup(); 
     37 
     38// End kohana_loading 
    4439Benchmark::stop(SYSTEM_BENCHMARK.'_kohana_loading'); 
    4540 
    46 // Start: system_initialization 
     41// Start system_initialization 
    4742Benchmark::start(SYSTEM_BENCHMARK.'_system_initialization'); 
    4843 
     
    5045Event::run('system.routing'); 
    5146 
    52 // End: system_initialization 
     47// End system_initialization 
    5348Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization'); 
    5449 
  • trunk/system/core/Kohana.php

    r1899 r2003  
    5151                // Start the environment setup benchmark 
    5252                Benchmark::start(SYSTEM_BENCHMARK.'_environment_setup'); 
     53 
     54                // Define Kohana error constant 
     55                defined('E_KOHANA') or define('E_KOHANA', 42); 
     56 
     57                // Define 404 error constant 
     58                defined('E_PAGE_NOT_FOUND') or define('E_PAGE_NOT_FOUND', 43); 
     59 
     60                // Define database error constant 
     61                defined('E_DATABASE_ERROR') or define('E_DATABASE_ERROR', 44); 
    5362 
    5463                // Disable error reporting 
     
    11051114 
    11061115} // End Kohana 404 Exception 
    1107  
    1108 /** 
    1109  * Run Kohana setup to prepare the environment. 
    1110  */ 
    1111 Kohana::setup(); 
  • trunk/system/helpers/cookie.php

    r1967 r2003  
    4747                $expire = ($expire == 0) ? 0 : time() + (int) $expire; 
    4848 
    49                 // Only set httponly if possible 
    50                 return (version_compare(PHP_VERSION, '5.2', '>=')) 
    51                         ? setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly) 
    52                         : setcookie($prefix.$name, $value, $expire, $path, $domain, $secure); 
     49                return setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly); 
    5350        } 
    5451 
  • trunk/system/libraries/Controller.php

    r1762 r2003  
    2323                        // Set the instance to the first controller loaded 
    2424                        Kohana::$instance = $this; 
    25  
    26                         // Loader should always be available 
    27                         $this->load = new Loader; 
    2825 
    2926                        // Loader should always be available 
  • trunk/system/libraries/Session.php

    r2002 r2003  
    130130 
    131131                // Set the session cookie parameters 
    132                 // Note: the httponly parameter was added in PHP 5.2.0 
    133                 if (version_compare(PHP_VERSION, '5.2', '>=')) 
    134                 { 
    135                         session_set_cookie_params 
    136                         ( 
    137                                 self::$config['expiration'], 
    138                                 Config::item('cookie.path'), 
    139                                 Config::item('cookie.domain'), 
    140                                 Config::item('cookie.secure'), 
    141                                 Config::item('cookie.httponly') 
    142                         ); 
    143                 } 
    144                 else 
    145                 { 
    146                         session_set_cookie_params 
    147                         ( 
    148                                 self::$config['expiration'], 
    149                                 Config::item('cookie.path'), 
    150                                 Config::item('cookie.domain'), 
    151                                 Config::item('cookie.secure') 
    152                         ); 
    153                 } 
     132                session_set_cookie_params 
     133                ( 
     134                        self::$config['expiration'], 
     135                        Config::item('cookie.path'), 
     136                        Config::item('cookie.domain'), 
     137                        Config::item('cookie.secure'), 
     138                        Config::item('cookie.httponly') 
     139                ); 
    154140 
    155141                // Register non-native driver as the session handler