^Status|Draft| ====== 2.1 to 2.2 Upgrading ====== Upgrading from 2.1 to 2.2 may involve a considerable amount of work, if you have an application written using deprecated methods like ''$this->load''. Also, if your application relies on ''Forge'' or uses the ''Media'' module or controller, you need to be aware that these have been removed from 2.2 You will need to check that your ''config/config.php'' is up to date, that all references to ''Config::item'' and ''Log::add'' are changed in your application. If your application makes extensive use of the old form validation class, you need to be aware that the 2.2 validation class is a completely new implementation, and will have to make the necessary changes. ===== Core ===== All functionality from the ''Config'' and ''Log'' classes has moved to the core ''Kohana'' class. See [[core:kohana|Kohana]] Replace these in your code: * ''Config::item'' with ''Kohana::config'' * ''Config::set'' with ''Kohana::config_set'' * ''Config::load'' with ''Kohana::config_load'' * ''Config::clear'' with ''Kohana::config_clear'' * ''Log::add'' with ''Kohana::log'' * ''Log::write'' with ''Kohana::log_save'' * ''Log::directory'' with ''Kohana::log_directory'' ===== Configuration ===== * Changes to config/config.php: * ''site_domain'' - Changed. Defaults to ''kohana/'' You may need to change this to a full domain ''localhost/kohana/'' * ''internal_cache'' - New. Defaults is ''FALSE'' * ''enable_hooks'' - New. Default is ''FALSE'' Moved from ''config/hooks.php'' * ''log_threshold'' - New. Default is ''1'' Moved from ''config/log.php'' * ''log_directory'' - New. Default is ''APPPATH.logs'' Moved from ''config/log.php'' * ''preload'' - Removed. You need to manually instance any libraries you had listed. * Changes to config/cookie.php: * ''prefix'' - Removed. * Changes to config/session.php: * ''storage'' - Changed. You need to pass parameters for the ''database'' and ''cache'' drivers. See [[libraries:session|Session]] * Changes to config/database.php: * ''connection'' - Changed. Parameters are passed as an array with discrete entries. The old ''DSN'' style may still be used. * ''escape'' - New. Default is ''TRUE'' Switch query builder automatic escaping on or off. * Changes to config/routes.php: * ''_allowed'' - Removed. * Shortcuts are removed, use a regular expression. See [[general:routing|Routing]] Note1: Config files ''config/log.php'' and ''config/hooks.php'' are removed. Now configured in core ''config'' ===== Controllers ===== ''media'' controller has been removed. Special Methods ''_default'' and ''_remap'' are replaced by ''%%__call%%($method, $arguments)'' see [[general:controllers|Controllers]] By default, a ''404'' error will be triggered if a non-existent controller method is called, and ''%%__call%%'' is defined. You may override this behaviour in your method. To simulate ''_remap'' Use ''%%__call%%'' and ''_private'' methods only. ''template'' controller method ''display'' is now ''render'' ===== Libraries ===== ''Loader'' library has been removed. ''$this->load('something')'' syntax is obsolete and invalid. Libraries and models must now be created using the following syntax: ''$example = new Example();'' and ''$example = new Example_Model();'' Where possible and applicable, use Factories to instance libraries, and reference library objects via their instance: * ''$template = View::factory('admin')->set('title', $title')->render();'' * ''$myname = Session::instance()->get('myname')'' ==== Library Changes ==== * Pagination - ''create_links()'' method has been renamed to ''render()'' * Validation - Completely new implementation, new docs in progress, for now see http://forum.kohanaphp.com/comments.php?DiscussionID=872&page=1#Item_0 * ORM - A new implementation, new docs in progress. * Payment - Has been moved to a module * Archive - has been moved to a module * Session - method ''del'' renamed to ''delete'' Default database session table name is ''sessions'' Table schema is slightly changed. SEE [[libraries:session|Session]] ===== Modules ===== * Forge - Has been removed. * Media - Has been removed.