This is documentation for Kohana v2.3.x.
Status | Draft |
---|
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.
All functionality from the Config
and Log
classes has moved to the core Kohana
class. See 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
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.prefix
- Removed. 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._allowed
- Removed.
Note1: Config files config/log.php
and config/hooks.php
are removed. Now configured in core config
media
controller has been removed.
Special Methods _default
and _remap
are replaced by __call($method, $arguments)
see 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
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')
create_links()
method has been renamed to render()
del
renamed to delete
Default database session table name is sessions
Table schema is slightly changed. SEE Session