Kohana v3.3.2

This commit is contained in:
Deon George 2014-09-06 23:43:07 +10:00
parent f96694b18f
commit 8888719653
236 changed files with 1685 additions and 996 deletions

167
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,167 @@
# Developing locally
Since Kohana maintains many concurrent versions at once, there is no single `master` branch. All versions have branches named with a prefix of it's version:
- 3.2/master
- 3.2/develop
- 3.3/master
- 3.3/develop
and so on. All development of versions happens in the develop branch of that version. Before a release, new features are added here. After a major release is actually released, only bugfixes can happen here. New features and api changes must happen in the develop branch of the next version.
## Branch name meanings
- **3.3/master** - master branches are for releases. Only release merge commits can be applied to this branch. You should never make a non-merge commit to this branch, and all merge commits should come from the release branch or hotfix branch (detailed below). This branch lasts forever.
- **3.3/hotfix/*** - hotfix branches are for emergency maintenance after a release. If an important security or other kind of important issue is discovered after a release, it should be done here, and merged to master. This branch should be created from master and merged back into master and develop when complete. This branch is deleted after it's done.
- **3.3/develop** - If a version is not released, this branch is for merging features into. If the version is released, this branch is for applying bugfix commits to. This branch lasts forever.
- **3.3/release/*** - release branches are for maintenance work before a release. This branch should be branched from the develop branch only. Change the version number/code name here, and apply any other maintenance items needed before actually releasing. Merges from master should only come from this branch. It should be merged to develop when it's complete as well. This branch is deleted after it's done.
- **3.3/feature/*** - Details on these branches are outlined below. This branch is deleted after it's done.
If an bug/issue applies to multiple versions of kohana, it is first fixed in the lowest supported version it applies to, then merged to each higher branch it applies to. Each merge should only happen one version up. 3.1 should merge to 3.2, and 3.2 should merge to 3.3. 3.1 should not merge directly to 3.3.
To work on a specific release branch you need to check it out then check out the appropriate system branch.
Release branch names follow the same convention in both kohana/kohana and kohana/core.
To work on 3.3.x you'd do the following:
> git clone git://github.com/kohana/kohana.git
# ....
> cd kohana
> git submodule update --init
# ....
> git checkout 3.3/develop
# Switched to branch '3.3/develop'
> git submodule foreach "git fetch && git checkout 3.3/develop"
# ...
It's important that you follow the last step, because unlike svn, git submodules point at a
specific commit rather than the tip of a branch. If you cd into the system folder after
a `git submodule update` and run `git status` you'll be told:
# Not currently on any branch.
nothing to commit (working directory clean)
***
# Contributing to the project
All features and bugfixes must be fully tested and reference an issue in the [tracker](http://dev.kohanaframework.org/projects/kohana3), **there are absolutely no exceptions**.
It's highly recommended that you write/run unit tests during development as it can help you pick up on issues early on. See the Unit Testing section below.
## Creating new features
New features or API breaking modifications should be developed in separate branches so as to isolate them
until they're stable.
**Features without tests written will be rejected! There are NO exceptions.**
The naming convention for feature branches is:
{version}/feature/{issue number}-{short hyphenated description}
// e.g.
3.2/feature/4045-rewriting-config-system
When a new feature is complete and fully tested it can be merged into its respective release branch using
`git pull --no-ff`. The `--no-ff` switch is important as it tells git to always create a commit
detailing what branch you're merging from. This makes it a lot easier to analyse a feature's history.
Here's a quick example:
> git status
# On branch 3.2/feature/4045-rewriting-everything
> git checkout 3.1/develop
# Switched to branch '3.1/develop'
> git merge --no-ff 3.2/feature/4045-rewriting-everything
**If a change you make intentionally breaks the api then please correct the relevant tests before pushing!**
## Bug fixing
If you're making a bugfix then before you start create a unit test which reproduces the bug,
using the `@ticket` notation in the test to reference the bug's issue number
(e.g. `@ticket 4045` for issue #4045).
If you run the unit tests then the one you've just made should fail.
Once you've written the bugfix, run the tests again before you commit to make sure that the
fix actually works,then commit both the fix and the test.
**Bug fixes without tests written will be rejected! There are NO exceptions.**
There is no need to create separate branches for bugfixes, creating them in the main develop
branch is perfectly acceptable.
## Tagging releases
Tag names should be prefixed with a `v`, this helps to separate tag references from branch references in git.
For example, if you were creating a tag for the `3.1.0` release the tag name would be `v3.1.0`
# Merging Changes from Remote Repositories
Now that you have a remote repository, you can pull changes in the remote "kohana" repository
into your local repository:
> git pull kohana 3.1/master
**Note:** Before you pull changes you should make sure that any modifications you've made locally
have been committed.
Sometimes a commit you've made locally will conflict with one made in the "kohana" one.
There are a couple of scenarios where this might happen:
## The conflict is to do with a few unrelated commits and you want to keep changes made in both commits
You'll need to manually modify the files to resolve the conflict, see the "Resolving a merge"
section [in the git-scm book](http://book.git-scm.com/3_basic_branching_and_merging.html) for more info
## You've fixed something locally which someone else has already done in the remote repo
The simplest way to fix this is to remove all the changes that you've made locally.
You can do this using
> git reset --hard kohana
## You've fixed something locally which someone else has already fixed but you also have separate commits you'd like to keep
If this is the case then you'll want to use a tool called rebase. First of all we need to
get rid of the conflicts created due to the merge:
> git reset --hard HEAD
Then find the hash of the offending local commit and run:
> git rebase -i {offending commit hash}
i.e.
> git rebase -i 57d0b28
A text editor will open with a list of commits, delete the line containing the offending commit
before saving the file & closing your editor.
Git will remove the commit and you can then pull/merge the remote changes.
# Unit Testing
Kohana currently uses phpunit for unit testing. This is installed with composer.
## How to run the tests
* Install [Phing](http://phing.info)
* Make sure you have the [unittest](http://github.com/kohana/unittest) module enabled.
* Install [Composer](http://getcomposer.org)
* Run `php composer.phar install` from the root of this repository
* Finally, run `phing test`
This will run the unit tests for core and all the modules and tell you if anything failed. If you haven't changed anything and you get failures, please create a new issue on [the tracker](http://dev.kohanaframework.org) and paste the output (including the error) in the issue.

View File

@ -56,6 +56,13 @@ spl_autoload_register(array('Kohana', 'auto_load'));
*/ */
ini_set('unserialize_callback_func', 'spl_autoload_call'); ini_set('unserialize_callback_func', 'spl_autoload_call');
/**
* Set the mb_substitute_character to "none"
*
* @link http://www.php.net/manual/function.mb-substitute-character.php
*/
mb_substitute_character('none');
// -- Configuration and initialization ----------------------------------------- // -- Configuration and initialization -----------------------------------------
/** /**
@ -63,6 +70,12 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
*/ */
I18n::lang('en-us'); I18n::lang('en-us');
if (isset($_SERVER['SERVER_PROTOCOL']))
{
// Replace the default protocol.
HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
}
/** /**
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied. * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
* *

View File

@ -1,5 +1,6 @@
{ {
"require": { "require": {
"phpunit/phpunit": "3.7.*" "phpunit/phpunit": "3.7.24",
"phing/phing": "dev-master"
} }
} }

View File

@ -0,0 +1,33 @@
{
"name": "kohana/auth",
"type": "kohana-module",
"description": "The official Kohana auth module",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "authentication"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

33
modules/cache/composer.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
"name": "kohana/cache",
"type": "kohana-module",
"description": "The official Kohana cache management module",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "cache"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -0,0 +1,33 @@
{
"name": "kohana/codebench",
"type": "kohana-module",
"description": "The official Kohana benchmarking module",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "benchmarking"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -240,6 +240,7 @@ class Kohana_Database_MySQL extends Database {
'fixed' => array('type' => 'float', 'exact' => TRUE), 'fixed' => array('type' => 'float', 'exact' => TRUE),
'fixed unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => '0'), 'fixed unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => '0'),
'float unsigned' => array('type' => 'float', 'min' => '0'), 'float unsigned' => array('type' => 'float', 'min' => '0'),
'geometry' => array('type' => 'string', 'binary' => TRUE),
'int unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'), 'int unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'integer unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'), 'integer unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'longblob' => array('type' => 'string', 'binary' => TRUE, 'character_maximum_length' => '4294967295'), 'longblob' => array('type' => 'string', 'binary' => TRUE, 'character_maximum_length' => '4294967295'),

View File

@ -0,0 +1,37 @@
{
"name": "kohana/database",
"type": "kohana-module",
"description": "The official Kohana module for database interactions, building queries, and prepared statements",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "database"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"suggest": {
"ext-mysql": "*",
"ext-pdo": "*"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -25,6 +25,21 @@ CONNECTION_ARRAY
TABLE_PREFIX TABLE_PREFIX
: Prefix that will be added to all table names by the [query builder](#query_building). : Prefix that will be added to all table names by the [query builder](#query_building).
CHARACTER_SET
: The character set to use for the connection with the database.
[!!] Setting Character Set won't work for PDO based connections because of incompatibility with PHP prior to 5.3.6. Use the DSN or options config instead. Example Below:
return array
(
'default' => array
(
'type' => 'PDO',
'connection' => array(
'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"),
),
),
);
## Example ## Example

View File

@ -10,13 +10,17 @@
*/ */
class Kohana_Image_GD extends Image { class Kohana_Image_GD extends Image {
// Is GD bundled or separate? // Which GD functions are available?
protected static $_bundled; const IMAGEROTATE = 'imagerotate';
const IMAGECONVOLUTION = 'imageconvolution';
const IMAGEFILTER = 'imagefilter';
const IMAGELAYEREFFECT = 'imagelayereffect';
protected static $_available_functions = array();
/** /**
* Checks if GD is enabled and bundled. Bundled GD is required for some * Checks if GD is enabled and verify that key methods exist, some of which require GD to
* methods to work. Exceptions will be thrown from those methods when GD is * be bundled with PHP. Exceptions will be thrown from those methods when GD is not
* not bundled. * bundled.
* *
* @return boolean * @return boolean
*/ */
@ -26,19 +30,15 @@ class Kohana_Image_GD extends Image {
{ {
throw new Kohana_Exception('GD is either not installed or not enabled, check your configuration'); throw new Kohana_Exception('GD is either not installed or not enabled, check your configuration');
} }
$functions = array(
if (defined('GD_BUNDLED')) Image_GD::IMAGEROTATE,
Image_GD::IMAGECONVOLUTION,
Image_GD::IMAGEFILTER,
Image_GD::IMAGELAYEREFFECT
);
foreach ($functions as $function)
{ {
// Get the version via a constant, available in PHP 5. Image_GD::$_available_functions[$function] = function_exists($function);
Image_GD::$_bundled = GD_BUNDLED;
}
else
{
// Get the version information
$info = gd_info();
// Extract the bundled status
Image_GD::$_bundled = (bool) preg_match('/\bbundled\b/i', $info['GD Version']);
} }
if (defined('GD_VERSION')) if (defined('GD_VERSION'))
@ -246,7 +246,7 @@ class Kohana_Image_GD extends Image {
*/ */
protected function _do_rotate($degrees) protected function _do_rotate($degrees)
{ {
if ( ! Image_GD::$_bundled) if (empty(Image_GD::$_available_functions[Image_GD::IMAGEROTATE]))
{ {
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
array(':function' => 'imagerotate')); array(':function' => 'imagerotate'));
@ -328,7 +328,7 @@ class Kohana_Image_GD extends Image {
*/ */
protected function _do_sharpen($amount) protected function _do_sharpen($amount)
{ {
if ( ! Image_GD::$_bundled) if (empty(Image_GD::$_available_functions[Image_GD::IMAGECONVOLUTION]))
{ {
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
array(':function' => 'imageconvolution')); array(':function' => 'imageconvolution'));
@ -367,7 +367,7 @@ class Kohana_Image_GD extends Image {
*/ */
protected function _do_reflection($height, $opacity, $fade_in) protected function _do_reflection($height, $opacity, $fade_in)
{ {
if ( ! Image_GD::$_bundled) if (empty(Image_GD::$_available_functions[Image_GD::IMAGEFILTER]))
{ {
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
array(':function' => 'imagefilter')); array(':function' => 'imagefilter'));
@ -448,7 +448,7 @@ class Kohana_Image_GD extends Image {
*/ */
protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity) protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity)
{ {
if ( ! Image_GD::$_bundled) if (empty(Image_GD::$_available_functions[Image_GD::IMAGELAYEREFFECT]))
{ {
throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD',
array(':function' => 'imagelayereffect')); array(':function' => 'imagelayereffect'));

View File

@ -0,0 +1,36 @@
{
"name": "kohana/image",
"type": "kohana-module",
"description": "The official Kohana module for manipulating images",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "image"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"suggest": {
"ext-gd": "*"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -170,7 +170,7 @@ class Kohana_Minion_CLI {
// Create temporary file // Create temporary file
file_put_contents($vbscript, 'wscript.echo(InputBox("'.addslashes($text).'"))'); file_put_contents($vbscript, 'wscript.echo(InputBox("'.addslashes($text).'"))');
$password = shell_exec('cscript //nologo '.escapeshellarg($command)); $password = shell_exec('cscript //nologo '.escapeshellarg($text));
// Remove temporary file. // Remove temporary file.
unlink($vbscript); unlink($vbscript);

View File

@ -33,7 +33,7 @@ class Kohana_Minion_Exception extends Kohana_Exception {
{ {
echo Kohana_Exception::text($e); echo Kohana_Exception::text($e);
} }
$exit_code = $e->getCode(); $exit_code = $e->getCode();
// Never exit "0" after an exception. // Never exit "0" after an exception.
@ -59,6 +59,6 @@ class Kohana_Minion_Exception extends Kohana_Exception {
public function format_for_cli() public function format_for_cli()
{ {
return Kohana_Exception::text($e); return Kohana_Exception::text($this);
} }
} }

View File

@ -206,7 +206,7 @@ abstract class Kohana_Minion_Task {
public function build_validation(Validation $validation) public function build_validation(Validation $validation)
{ {
// Add a rule to each key making sure it's in the task // Add a rule to each key making sure it's in the task
foreach ($validation->as_array() as $key => $value) foreach ($validation->data() as $key => $value)
{ {
$validation->rule($key, array($this, 'valid_option'), array(':validation', ':field')); $validation->rule($key, array($this, 'valid_option'), array(':validation', ':field'));
} }

View File

@ -0,0 +1,33 @@
{
"name": "kohana/minion",
"type": "kohana-module",
"description": "The official kohana module for running tasks via the CLI",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "task"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -1,32 +1,3 @@
# Minion Setup # Minion Setup
To use minion, you'll need to make a small change to your index.php file: [!!] Since Kohana `3.3.x`, minion requires no additional setup to use.
-/**
- * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
- * If no source is specified, the URI will be automatically detected.
- */
-echo Request::factory()
- ->execute()
- ->send_headers(TRUE)
- ->body();
+if (PHP_SAPI == 'cli') // Try and load minion
+{
+ class_exists('Minion_Task') OR die('minion required!');
+ set_exception_handler(array('Kohana_Minion_Exception_Handler', 'handler'));
+
+ Minion_Task::factory(Minion_CLI::options())->execute();
+}
+else
+{
+ /**
+ * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
+ * If no source is specified, the URI will be automatically detected.
+ */
+ echo Request::factory()
+ ->execute()
+ ->send_headers(TRUE)
+ ->body();
+}
This will short-circuit your index file to intercept any cli calls, and route them to the minion module.

View File

@ -6,8 +6,8 @@ Writing a task in minion is very easy. Simply create a new class called `Task_<T
class Task_Demo extends Minion_Task class Task_Demo extends Minion_Task
{ {
protected $_defaults = array( protected $_options = array(
'foo' = 'bar', 'foo' => 'bar',
'bar' => NULL, 'bar' => NULL,
); );
@ -28,7 +28,7 @@ You'll notice a few things here:
- You need a main `_execute()` method. It should take one array parameter. - You need a main `_execute()` method. It should take one array parameter.
- This parameter contains any command line options passed to the task. - This parameter contains any command line options passed to the task.
- For example, if you call the task above with `./minion --task=demo --foo=foobar` then `$params` will contain: `array('foo' => 'foobar', 'bar' => NULL)` - For example, if you call the task above with `./minion --task=demo --foo=foobar` then `$params` will contain: `array('foo' => 'foobar', 'bar' => NULL)`
- It needs to have a `protected $_defaults` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected. - It needs to have a `protected $_options` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected.
## Namespacing Tasks ## Namespacing Tasks
@ -68,4 +68,4 @@ Tasks can have built-in help. Minion will read class docblocks that you specify:
*/ */
class Minion_Task_Demo extends Minion_Task class Minion_Task_Demo extends Minion_Task
The `@` tags in the class comments will also be displayed in a human readable format. When writing your task comments, you should specify how to use it, and any parameters it accepts. The `@` tags in the class comments will also be displayed in a human readable format. When writing your task comments, you should specify how to use it, and any parameters it accepts.

View File

@ -0,0 +1,70 @@
<?php
/**
* Test case for Minion_Util
*
* @package Kohana/Minion
* @group kohana
* @group kohana.minion
* @category Test
* @author Kohana Team
* @copyright (c) 2009-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Minion_TaskTest extends Kohana_Unittest_TestCase
{
/**
* Provides test data for test_convert_task_to_class_name()
*
* @return array
*/
public function provider_convert_task_to_class_name()
{
return array(
array('Task_Db_Migrate', 'db:migrate'),
array('Task_Db_Status', 'db:status'),
array('', ''),
);
}
/**
* Tests that a task can be converted to a class name
*
* @test
* @covers Minion_Task::convert_task_to_class_name
* @dataProvider provider_convert_task_to_class_name
* @param string Expected class name
* @param string Input task name
*/
public function test_convert_task_to_class_name($expected, $task_name)
{
$this->assertSame($expected, Minion_Task::convert_task_to_class_name($task_name));
}
/**
* Provides test data for test_convert_class_to_task()
*
* @return array
*/
public function provider_convert_class_to_task()
{
return array(
array('db:migrate', 'Task_Db_Migrate'),
);
}
/**
* Tests that the task name can be found from a class name / object
*
* @test
* @covers Minion_Task::convert_class_to_task
* @dataProvider provider_convert_class_to_task
* @param string Expected task name
* @param mixed Input class
*/
public function test_convert_class_to_task($expected, $class)
{
$this->assertSame($expected, Minion_Task::convert_class_to_task($class));
}
}

View File

@ -51,6 +51,10 @@ class Kohana_Auth_ORM extends Auth {
if ( ! $roles->loaded()) if ( ! $roles->loaded())
return FALSE; return FALSE;
} }
else
{
$roles = $role;
}
} }
return $user->has('roles', $roles); return $user->has('roles', $roles);

View File

@ -288,8 +288,11 @@ class Kohana_ORM extends Model implements serializable {
*/ */
protected function _initialize() protected function _initialize()
{ {
// Set the object name and plural name // Set the object name if none predefined
$this->_object_name = strtolower(substr(get_class($this), 6)); if (empty($this->_object_name))
{
$this->_object_name = strtolower(substr(get_class($this), 6));
}
// Check if this model has already been initialized // Check if this model has already been initialized
if ( ! $init = Arr::get(ORM::$_init_cache, $this->_object_name, FALSE)) if ( ! $init = Arr::get(ORM::$_init_cache, $this->_object_name, FALSE))
@ -1501,14 +1504,14 @@ class Kohana_ORM extends Model implements serializable {
* Returns the number of relationships * Returns the number of relationships
* *
* // Counts the number of times the login role is attached to $model * // Counts the number of times the login role is attached to $model
* $model->has('roles', ORM::factory('role', array('name' => 'login'))); * $model->count_relations('roles', ORM::factory('role', array('name' => 'login')));
* // Counts the number of times role 5 is attached to $model * // Counts the number of times role 5 is attached to $model
* $model->has('roles', 5); * $model->count_relations('roles', 5);
* // Counts the number of times any of roles 1, 2, 3, or 4 are attached to * // Counts the number of times any of roles 1, 2, 3, or 4 are attached to
* // $model * // $model
* $model->has('roles', array(1, 2, 3, 4)); * $model->count_relations('roles', array(1, 2, 3, 4));
* // Counts the number roles attached to $model * // Counts the number roles attached to $model
* $model->has('roles') * $model->count_relations('roles')
* *
* @param string $alias Alias of the has_many "through" relationship * @param string $alias Alias of the has_many "through" relationship
* @param mixed $far_keys Related model, primary key, or an array of primary keys * @param mixed $far_keys Related model, primary key, or an array of primary keys
@ -1641,7 +1644,7 @@ class Kohana_ORM extends Model implements serializable {
$this->_build(Database::SELECT); $this->_build(Database::SELECT);
$records = $this->_db_builder->from(array($this->_table_name, $this->_object_name)) $records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
->select(array(DB::expr('COUNT(*)'), 'records_found')) ->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
->execute($this->_db) ->execute($this->_db)
->get('records_found'); ->get('records_found');
@ -1651,7 +1654,7 @@ class Kohana_ORM extends Model implements serializable {
$this->reset(); $this->reset();
// Return the total number of records in a table // Return the total number of records in a table
return $records; return (int) $records;
} }
/** /**

34
modules/orm/composer.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "kohana/orm",
"type": "kohana-module",
"description": "The official Kohana ORM module",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "ORM", "database"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"kohana/database": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -89,9 +89,9 @@ abstract class Kohana_Unittest_Database_TestCase extends PHPUnit_Extensions_Data
// Get the unittesting db connection // Get the unittesting db connection
$config = Kohana::$config->load('database.'.$this->_database_connection); $config = Kohana::$config->load('database.'.$this->_database_connection);
if($config['type'] !== 'pdo') if(strtolower($config['type']) !== 'pdo')
{ {
$config['connection']['dsn'] = $config['type'].':'. $config['connection']['dsn'] = strtolower($config['type']).':'.
'host='.$config['connection']['hostname'].';'. 'host='.$config['connection']['hostname'].';'.
'dbname='.$config['connection']['database']; 'dbname='.$config['connection']['database'];
} }

View File

@ -163,7 +163,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
return self::assertNotType($expected, $actual, $message); return self::assertNotType($expected, $actual, $message);
} }
return self::assertNotInstanceOf($expected, $actual, $message); return parent::assertNotInstanceOf($expected, $actual, $message);
} }
/** /**
@ -182,7 +182,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message); return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message);
} }
return self::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message); return parent::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message);
} }
/** /**
@ -219,7 +219,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
return self::assertAttributeType($expected, $attributeName, $classOrObject, $message); return self::assertAttributeType($expected, $attributeName, $classOrObject, $message);
} }
return self::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message); return parent::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message);
} }
/** /**
@ -237,7 +237,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
return self::assertNotType($expected, $actual, $message); return self::assertNotType($expected, $actual, $message);
} }
return self::assertNotInternalType($expected, $actual, $message); return parent::assertNotInternalType($expected, $actual, $message);
} }
/** /**
@ -256,6 +256,6 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase {
return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message); return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message);
} }
return self::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message); return parent::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message);
} }
} }

View File

@ -0,0 +1,34 @@
{
"name": "kohana/unittest",
"type": "kohana-module",
"description": "PHPUnit integration for running unit tests on the Kohana framework",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3",
"phpunit/phpunit": "3.7.*"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -198,7 +198,7 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
// (different case, orm vs ORM, auth vs Auth) redirect // (different case, orm vs ORM, auth vs Auth) redirect
if ($_class->class->name != $class) if ($_class->class->name != $class)
{ {
$this->request->redirect($this->request->route()->uri(array('class'=>$_class->class->name))); $this->redirect($this->request->route()->uri(array('class'=>$_class->class->name)));
} }
// If this classes immediate parent is Kodoc_Missing, then it should 404 // If this classes immediate parent is Kodoc_Missing, then it should 404

View File

@ -0,0 +1,33 @@
{
"name": "kohana/userguide",
"type": "kohana-module",
"description": "Kohana user guide and live API documentation module",
"homepage": "http://kohanaframework.org",
"license": "BSD-3-Clause",
"keywords": ["kohana", "framework", "docs"],
"authors": [
{
"name": "Kohana Team",
"email": "team@kohanaframework.org",
"homepage": "http://kohanaframework.org/team",
"role": "developer"
}
],
"support": {
"issues": "http://dev.kohanaframework.org",
"forum": "http://forum.kohanaframework.org",
"irc": "irc://irc.freenode.net/kohana",
"source": "http://github.com/kohana/core"
},
"require": {
"composer/installers": "~1.0",
"kohana/core": ">=3.3",
"php": ">=5.3.3"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
}
}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class Arr extends Kohana_Arr {} class Arr extends Kohana_Arr {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class Config extends Kohana_Config {} class Config extends Kohana_Config {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class Config_File extends Kohana_Config_File {} class Config_File extends Kohana_Config_File {}

View File

@ -1,4 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class Config_Group extends Kohana_Config_Group {}
class Config_Group extends Kohana_Config_Group {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class File extends Kohana_File {} class File extends Kohana_File {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTML extends Kohana_HTML {} class HTML extends Kohana_HTML {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
abstract class HTTP extends Kohana_HTTP {} abstract class HTTP extends Kohana_HTTP {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception extends Kohana_HTTP_Exception {} class HTTP_Exception extends Kohana_HTTP_Exception {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_300 extends Kohana_HTTP_Exception_300 {} class HTTP_Exception_300 extends Kohana_HTTP_Exception_300 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_301 extends Kohana_HTTP_Exception_301 {} class HTTP_Exception_301 extends Kohana_HTTP_Exception_301 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_302 extends Kohana_HTTP_Exception_302 {} class HTTP_Exception_302 extends Kohana_HTTP_Exception_302 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_303 extends Kohana_HTTP_Exception_303 {} class HTTP_Exception_303 extends Kohana_HTTP_Exception_303 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_304 extends Kohana_HTTP_Exception_304 {} class HTTP_Exception_304 extends Kohana_HTTP_Exception_304 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_305 extends Kohana_HTTP_Exception_305 {} class HTTP_Exception_305 extends Kohana_HTTP_Exception_305 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_307 extends Kohana_HTTP_Exception_307 {} class HTTP_Exception_307 extends Kohana_HTTP_Exception_307 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_400 extends Kohana_HTTP_Exception_400 {} class HTTP_Exception_400 extends Kohana_HTTP_Exception_400 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_401 extends Kohana_HTTP_Exception_401 {} class HTTP_Exception_401 extends Kohana_HTTP_Exception_401 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_402 extends Kohana_HTTP_Exception_402 {} class HTTP_Exception_402 extends Kohana_HTTP_Exception_402 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_403 extends Kohana_HTTP_Exception_403 {} class HTTP_Exception_403 extends Kohana_HTTP_Exception_403 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {} class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_405 extends Kohana_HTTP_Exception_405 {} class HTTP_Exception_405 extends Kohana_HTTP_Exception_405 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_406 extends Kohana_HTTP_Exception_406 {} class HTTP_Exception_406 extends Kohana_HTTP_Exception_406 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_407 extends Kohana_HTTP_Exception_407 {} class HTTP_Exception_407 extends Kohana_HTTP_Exception_407 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_408 extends Kohana_HTTP_Exception_408 {} class HTTP_Exception_408 extends Kohana_HTTP_Exception_408 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_409 extends Kohana_HTTP_Exception_409 {} class HTTP_Exception_409 extends Kohana_HTTP_Exception_409 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_410 extends Kohana_HTTP_Exception_410 {} class HTTP_Exception_410 extends Kohana_HTTP_Exception_410 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_411 extends Kohana_HTTP_Exception_411 {} class HTTP_Exception_411 extends Kohana_HTTP_Exception_411 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_412 extends Kohana_HTTP_Exception_412 {} class HTTP_Exception_412 extends Kohana_HTTP_Exception_412 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_413 extends Kohana_HTTP_Exception_413 {} class HTTP_Exception_413 extends Kohana_HTTP_Exception_413 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_414 extends Kohana_HTTP_Exception_414 {} class HTTP_Exception_414 extends Kohana_HTTP_Exception_414 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_415 extends Kohana_HTTP_Exception_415 {} class HTTP_Exception_415 extends Kohana_HTTP_Exception_415 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_416 extends Kohana_HTTP_Exception_416 {} class HTTP_Exception_416 extends Kohana_HTTP_Exception_416 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_417 extends Kohana_HTTP_Exception_417 {} class HTTP_Exception_417 extends Kohana_HTTP_Exception_417 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_500 extends Kohana_HTTP_Exception_500 {} class HTTP_Exception_500 extends Kohana_HTTP_Exception_500 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_501 extends Kohana_HTTP_Exception_501 {} class HTTP_Exception_501 extends Kohana_HTTP_Exception_501 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_502 extends Kohana_HTTP_Exception_502 {} class HTTP_Exception_502 extends Kohana_HTTP_Exception_502 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_503 extends Kohana_HTTP_Exception_503 {} class HTTP_Exception_503 extends Kohana_HTTP_Exception_503 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_504 extends Kohana_HTTP_Exception_504 {} class HTTP_Exception_504 extends Kohana_HTTP_Exception_504 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Exception_505 extends Kohana_HTTP_Exception_505 {} class HTTP_Exception_505 extends Kohana_HTTP_Exception_505 {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
abstract class HTTP_Exception_Expected extends Kohana_HTTP_Exception_Expected {} abstract class HTTP_Exception_Expected extends Kohana_HTTP_Exception_Expected {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
abstract class HTTP_Exception_Redirect extends Kohana_HTTP_Exception_Redirect {} abstract class HTTP_Exception_Redirect extends Kohana_HTTP_Exception_Redirect {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class HTTP_Header extends Kohana_HTTP_Header {} class HTTP_Header extends Kohana_HTTP_Header {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
interface HTTP_Message extends Kohana_HTTP_Message {} interface HTTP_Message extends Kohana_HTTP_Message {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
interface HTTP_Request extends Kohana_HTTP_Request {} interface HTTP_Request extends Kohana_HTTP_Request {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
interface HTTP_Response extends Kohana_HTTP_Response {} interface HTTP_Response extends Kohana_HTTP_Response {}

View File

@ -1,3 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.'); <?php defined('SYSPATH') OR die('No direct script access.');
class Inflector extends Kohana_Inflector {} class Inflector extends Kohana_Inflector {}

View File

@ -207,8 +207,13 @@ class Kohana_Arr {
$delimiter = Arr::$delimiter; $delimiter = Arr::$delimiter;
} }
// Split the keys by delimiter // The path has already been separated into keys
$keys = explode($delimiter, $path); $keys = $path;
if ( ! is_array($path))
{
// Split the keys by delimiter
$keys = explode($delimiter, $path);
}
// Set current $array to inner-most array path // Set current $array to inner-most array path
while (count($keys) > 1) while (count($keys) > 1)
@ -283,7 +288,7 @@ class Kohana_Arr {
* *
* // Get the values "username", "password" from $_POST * // Get the values "username", "password" from $_POST
* $auth = Arr::extract($_POST, array('username', 'password')); * $auth = Arr::extract($_POST, array('username', 'password'));
* *
* // Get the value "level1.level2a" from $data * // Get the value "level1.level2a" from $data
* $data = array('level1' => array('level2a' => 'value 1', 'level2b' => 'value 2')); * $data = array('level1' => array('level2a' => 'value 1', 'level2b' => 'value 2'));
* Arr::extract($data, array('level1.level2a', 'password')); * Arr::extract($data, array('level1.level2a', 'password'));
@ -617,4 +622,4 @@ class Kohana_Arr {
return $flat; return $flat;
} }
} // End arr }

View File

@ -3,7 +3,7 @@
* Wrapper for configuration arrays. Multiple configuration readers can be * Wrapper for configuration arrays. Multiple configuration readers can be
* attached to allow loading configuration from files, database, etc. * attached to allow loading configuration from files, database, etc.
* *
* Configuration directives cascade across config sources in the same way that * Configuration directives cascade across config sources in the same way that
* files cascade across the filesystem. * files cascade across the filesystem.
* *
* Directives from sources high in the sources list will override ones from those * Directives from sources high in the sources list will override ones from those
@ -74,9 +74,9 @@ class Kohana_Config {
} }
/** /**
* Load a configuration group. Searches all the config sources, merging all the * Load a configuration group. Searches all the config sources, merging all the
* directives found into a single config group. Any changes made to the config * directives found into a single config group. Any changes made to the config
* in this group will be mirrored across all writable sources. * in this group will be mirrored across all writable sources.
* *
* $array = $config->load($name); * $array = $config->load($name);
* *
@ -146,7 +146,7 @@ class Kohana_Config {
/** /**
* Copy one configuration group to all of the other writers. * Copy one configuration group to all of the other writers.
* *
* $config->copy($name); * $config->copy($name);
* *
* @param string $group configuration group name * @param string $group configuration group name
@ -181,7 +181,7 @@ class Kohana_Config {
{ {
continue; continue;
} }
// Copy each value in the config // Copy each value in the config
$source->write($group, $key, $value); $source->write($group, $key, $value);
} }
@ -189,4 +189,4 @@ class Kohana_Config {
return $this; return $this;
} }
} // End Kohana_Config }

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2012 Kohana Team * @copyright (c) 2009-2012 Kohana Team
* @license http://kohanaframework.org/license * @license http://kohanaframework.org/license
*/ */
class Kohana_Config_File extends Kohana_Config_File_Reader class Kohana_Config_File extends Kohana_Config_File_Reader
{ {
// @see Kohana_Config_File_Reader // @see Kohana_Config_File_Reader
} }

View File

@ -1,4 +1,4 @@
<?php <?php defined('SYSPATH') OR die('No direct script access.');
/** /**
* File-based configuration reader. Multiple configuration directories can be * File-based configuration reader. Multiple configuration directories can be
* used by attaching multiple instances of this class to [Kohana_Config]. * used by attaching multiple instances of this class to [Kohana_Config].
@ -53,4 +53,4 @@ class Kohana_Config_File_Reader implements Kohana_Config_Reader {
return $config; return $config;
} }
} // End Kohana_Config }

View File

@ -4,15 +4,15 @@
* The group wrapper acts as an interface to all the config directives * The group wrapper acts as an interface to all the config directives
* gathered from across the system. * gathered from across the system.
* *
* This is the object returned from Kohana_Config::load * This is the object returned from Kohana_Config::load
* *
* Any modifications to configuration items should be done through an instance of this object * Any modifications to configuration items should be done through an instance of this object
* *
* @package Kohana * @package Kohana
* @category Configuration * @category Configuration
* @author Kohana Team * @author Kohana Team
* @copyright (c) 2012 Kohana Team * @copyright (c) 2012-2014 Kohana Team
* @license http://kohanaphp.com/license * @license http://kohanaframework.org/license
*/ */
class Kohana_Config_Group extends ArrayObject { class Kohana_Config_Group extends ArrayObject {
@ -31,7 +31,7 @@ class Kohana_Config_Group extends ArrayObject {
protected $_group_name = ''; protected $_group_name = '';
/** /**
* Constructs the group object. Kohana_Config passes the config group * Constructs the group object. Kohana_Config passes the config group
* and its config items to the object here. * and its config items to the object here.
* *
* @param Kohana_Config $instance "Owning" instance of Kohana_Config * @param Kohana_Config $instance "Owning" instance of Kohana_Config
@ -77,7 +77,7 @@ class Kohana_Config_Group extends ArrayObject {
{ {
return $this->_group_name; return $this->_group_name;
} }
/** /**
* Get a variable from the configuration or return the default value. * Get a variable from the configuration or return the default value.
* *
@ -110,7 +110,7 @@ class Kohana_Config_Group extends ArrayObject {
/** /**
* Overrides ArrayObject::offsetSet() * Overrides ArrayObject::offsetSet()
* This method is called when config is changed via * This method is called when config is changed via
* *
* $config->var = 'asd'; * $config->var = 'asd';
* *
@ -127,4 +127,5 @@ class Kohana_Config_Group extends ArrayObject {
return parent::offsetSet($key, $value); return parent::offsetSet($key, $value);
} }
} }

View File

@ -11,9 +11,9 @@
*/ */
interface Kohana_Config_Reader extends Kohana_Config_Source interface Kohana_Config_Reader extends Kohana_Config_Source
{ {
/** /**
* Tries to load the specificed configuration group * Tries to load the specified configuration group
* *
* Returns FALSE if group does not exist or an array if it does * Returns FALSE if group does not exist or an array if it does
* *
@ -21,5 +21,5 @@ interface Kohana_Config_Reader extends Kohana_Config_Source
* @return boolean|array * @return boolean|array
*/ */
public function load($group); public function load($group);
} }

View File

@ -7,8 +7,8 @@
* @package Kohana * @package Kohana
* @category Configuration * @category Configuration
* @author Kohana Team * @author Kohana Team
* @copyright (c) 2012 Kohana Team * @copyright (c) 2012-2014 Kohana Team
* @license http://kohanaphp.com/license * @license http://kohanaframework.org/license
*/ */
interface Kohana_Config_Source {} interface Kohana_Config_Source {}

View File

@ -3,19 +3,19 @@
/** /**
* Interface for config writers * Interface for config writers
* *
* Specifies the methods that a config writer must implement * Specifies the methods that a config writer must implement
* *
* @package Kohana * @package Kohana
* @author Kohana Team * @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team * @copyright (c) 2008-2014 Kohana Team
* @license http://kohanaphp.com/license * @license http://kohanaframework.org/license
*/ */
interface Kohana_Config_Writer extends Kohana_Config_Source interface Kohana_Config_Writer extends Kohana_Config_Source
{ {
/** /**
* Writes the passed config for $group * Writes the passed config for $group
* *
* Returns chainable instance on success or throws * Returns chainable instance on success or throws
* Kohana_Config_Exception on failure * Kohana_Config_Exception on failure
* *
* @param string $group The config group * @param string $group The config group
@ -24,4 +24,5 @@ interface Kohana_Config_Writer extends Kohana_Config_Source
* @return boolean * @return boolean
*/ */
public function write($group, $key, $config); public function write($group, $key, $config);
} }

View File

@ -51,15 +51,15 @@ abstract class Kohana_Controller {
/** /**
* Executes the given action and calls the [Controller::before] and [Controller::after] methods. * Executes the given action and calls the [Controller::before] and [Controller::after] methods.
* *
* Can also be used to catch exceptions from actions in a single place. * Can also be used to catch exceptions from actions in a single place.
* *
* 1. Before the controller action is called, the [Controller::before] method * 1. Before the controller action is called, the [Controller::before] method
* will be called. * will be called.
* 2. Next the controller action will be called. * 2. Next the controller action will be called.
* 3. After the controller action is called, the [Controller::after] method * 3. After the controller action is called, the [Controller::after] method
* will be called. * will be called.
* *
* @throws HTTP_Exception_404 * @throws HTTP_Exception_404
* @return Response * @return Response
*/ */
@ -105,7 +105,7 @@ abstract class Kohana_Controller {
* Automatically executed after the controller action. Can be used to apply * Automatically executed after the controller action. Can be used to apply
* transformation to the response, add extra output, and execute * transformation to the response, add extra output, and execute
* other custom code. * other custom code.
* *
* @return void * @return void
*/ */
public function after() public function after()
@ -124,16 +124,16 @@ abstract class Kohana_Controller {
*/ */
public static function redirect($uri = '', $code = 302) public static function redirect($uri = '', $code = 302)
{ {
return HTTP::redirect($uri, $code); return HTTP::redirect( (string) $uri, $code);
} }
/** /**
* Checks the browser cache to see the response needs to be returned, * Checks the browser cache to see the response needs to be returned,
* execution will halt and a 304 Not Modified will be sent if the * execution will halt and a 304 Not Modified will be sent if the
* browser cache is up to date. * browser cache is up to date.
* *
* $this->check_cache(sha1($content)); * $this->check_cache(sha1($content));
* *
* @param string $etag Resource Etag * @param string $etag Resource Etag
* @return Response * @return Response
*/ */
@ -142,4 +142,4 @@ abstract class Kohana_Controller {
return HTTP::check_cache($this->request, $this->response, $etag); return HTTP::check_cache($this->request, $this->response, $etag);
} }
} // End Controller }

View File

@ -47,4 +47,4 @@ abstract class Kohana_Controller_Template extends Controller {
parent::after(); parent::after();
} }
} // End Controller_Template }

View File

@ -124,7 +124,6 @@ class Kohana_Cookie {
* *
* @param string $name cookie name * @param string $name cookie name
* @return boolean * @return boolean
* @uses Cookie::set
*/ */
public static function delete($name) public static function delete($name)
{ {
@ -149,7 +148,7 @@ class Kohana_Cookie {
// Require a valid salt // Require a valid salt
if ( ! Cookie::$salt) if ( ! Cookie::$salt)
{ {
throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt.'); throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt in your bootstrap.php. For more information check the documentation');
} }
// Determine the user agent // Determine the user agent
@ -158,4 +157,4 @@ class Kohana_Cookie {
return sha1($agent.$name.$value.Cookie::$salt); return sha1($agent.$name.$value.Cookie::$salt);
} }
} // End cookie }

View File

@ -16,8 +16,8 @@
class Kohana_Core { class Kohana_Core {
// Release version and codename // Release version and codename
const VERSION = '3.3.0'; const VERSION = '3.3.1';
const CODENAME = 'badius'; const CODENAME = 'peregrinus';
// Common environment type constants for consistency and convenience // Common environment type constants for consistency and convenience
const PRODUCTION = 10; const PRODUCTION = 10;
@ -383,7 +383,7 @@ class Kohana_Core {
/** /**
* Reverts the effects of the `register_globals` PHP setting by unsetting * Reverts the effects of the `register_globals` PHP setting by unsetting
* all global varibles except for the default super globals (GPCS, etc), * all global variables except for the default super globals (GPCS, etc),
* which is a [potential security hole.][ref-wikibooks] * which is a [potential security hole.][ref-wikibooks]
* *
* This is called automatically by [Kohana::init] if `register_globals` is * This is called automatically by [Kohana::init] if `register_globals` is
@ -521,7 +521,7 @@ class Kohana_Core {
/** /**
* Provides auto-loading support of classes that follow Kohana's old class * Provides auto-loading support of classes that follow Kohana's old class
* naming conventions. * naming conventions.
* *
* This is included for compatibility purposes with older modules. * This is included for compatibility purposes with older modules.
* *
* @param string $class Class name * @param string $class Class name
@ -927,7 +927,7 @@ class Kohana_Core {
} }
/** /**
* Get a message from a file. Messages are arbitary strings that are stored * Get a message from a file. Messages are arbitrary strings that are stored
* in the `messages/` directory and reference by a key. Translation is not * in the `messages/` directory and reference by a key. Translation is not
* performed on the returned values. See [message files](kohana/files/messages) * performed on the returned values. See [message files](kohana/files/messages)
* for more information. * for more information.
@ -1037,7 +1037,7 @@ class Kohana_Core {
/** /**
* Generates a version string based on the variables defined above. * Generates a version string based on the variables defined above.
* *
* @return string * @return string
*/ */
public static function version() public static function version()
@ -1045,4 +1045,4 @@ class Kohana_Core {
return 'Kohana Framework '.Kohana::VERSION.' ('.Kohana::CODENAME.')'; return 'Kohana Framework '.Kohana::VERSION.' ('.Kohana::CODENAME.')';
} }
} // End Kohana }

View File

@ -600,4 +600,4 @@ class Kohana_Date {
return $time->format($timestamp_format); return $time->format($timestamp_format);
} }
} // End date }

View File

@ -5,8 +5,8 @@
* @package Kohana * @package Kohana
* @category Base * @category Base
* @author Kohana Team * @author Kohana Team
* @copyright (c) 2008-2012 Kohana Team * @copyright (c) 2008-2014 Kohana Team
* @license http://kohanaphp.com/license * @license http://kohanaframework.org/license
*/ */
class Kohana_Debug { class Kohana_Debug {

View File

@ -210,4 +210,4 @@ class Kohana_Encrypt {
return rtrim(mcrypt_decrypt($this->_cipher, $this->_key, $data, $this->_mode, $iv), "\0"); return rtrim(mcrypt_decrypt($this->_cipher, $this->_key, $data, $this->_mode, $iv), "\0");
} }
} // End Encrypt }

View File

@ -182,4 +182,4 @@ class Kohana_Feed {
return $feed; return $feed;
} }
} // End Feed }

View File

@ -163,16 +163,16 @@ class Kohana_File {
// Write files in 8k blocks // Write files in 8k blocks
$block_size = 1024 * 8; $block_size = 1024 * 8;
// Total number of peices // Total number of pieces
$peices = 0; $pieces = 0;
while ( ! feof($file)) while ( ! feof($file))
{ {
// Create another piece // Create another piece
$peices += 1; $pieces += 1;
// Create a new file piece // Create a new file piece
$piece = str_pad($peices, 3, '0', STR_PAD_LEFT); $piece = str_pad($pieces, 3, '0', STR_PAD_LEFT);
$piece = fopen($filename.'.'.$piece, 'wb+'); $piece = fopen($filename.'.'.$piece, 'wb+');
// Number of bytes read // Number of bytes read
@ -195,7 +195,7 @@ class Kohana_File {
// Close the file // Close the file
fclose($file); fclose($file);
return $peices; return $pieces;
} }
/** /**
@ -214,7 +214,7 @@ class Kohana_File {
// Read files in 8k blocks // Read files in 8k blocks
$block_size = 1024 * 8; $block_size = 1024 * 8;
// Total number of peices // Total number of pieces
$pieces = 0; $pieces = 0;
while (is_file($piece = $filename.'.'.str_pad($pieces + 1, 3, '0', STR_PAD_LEFT))) while (is_file($piece = $filename.'.'.str_pad($pieces + 1, 3, '0', STR_PAD_LEFT)))
@ -231,11 +231,11 @@ class Kohana_File {
fwrite($file, fread($piece, $block_size)); fwrite($file, fread($piece, $block_size));
} }
// Close the peice // Close the piece
fclose($piece); fclose($piece);
} }
return $pieces; return $pieces;
} }
} // End file }

View File

@ -2,7 +2,7 @@
/** /**
* Form helper class. Unless otherwise noted, all generated HTML will be made * Form helper class. Unless otherwise noted, all generated HTML will be made
* safe using the [HTML::chars] method. This prevents against simple XSS * safe using the [HTML::chars] method. This prevents against simple XSS
* attacks that could otherwise be trigged by inserting HTML characters into * attacks that could otherwise be triggered by inserting HTML characters into
* form fields. * form fields.
* *
* @package Kohana * @package Kohana
@ -431,4 +431,4 @@ class Kohana_Form {
return '<label'.HTML::attributes($attributes).'>'.$text.'</label>'; return '<label'.HTML::attributes($attributes).'>'.$text.'</label>';
} }
} // End form }

View File

@ -144,4 +144,4 @@ class Kohana_Fragment {
Kohana::cache(Fragment::_cache_key($name, $i18n), NULL, -3600); Kohana::cache(Fragment::_cache_key($name, $i18n), NULL, -3600);
} }
} // End Fragment }

View File

@ -342,4 +342,4 @@ class Kohana_HTML {
return $compiled; return $compiled;
} }
} // End html }

View File

@ -11,8 +11,8 @@
* @category HTTP * @category HTTP
* @author Kohana Team * @author Kohana Team
* @since 3.1.0 * @since 3.1.0
* @copyright (c) 2008-2012 Kohana Team * @copyright (c) 2008-2014 Kohana Team
* @license http://kohanaphp.com/license * @license http://kohanaframework.org/license
*/ */
abstract class Kohana_HTTP { abstract class Kohana_HTTP {
@ -44,7 +44,7 @@ abstract class Kohana_HTTP {
* Checks the browser cache to see the response needs to be returned, * Checks the browser cache to see the response needs to be returned,
* execution will halt and a 304 Not Modified will be sent if the * execution will halt and a 304 Not Modified will be sent if the
* browser cache is up to date. * browser cache is up to date.
* *
* @param Request $request Request * @param Request $request Request
* @param Response $response Response * @param Response $response Response
* @param string $etag Resource ETag * @param string $etag Resource ETag
@ -214,4 +214,5 @@ abstract class Kohana_HTTP {
return implode('&', $encoded); return implode('&', $encoded);
} }
} // End Kohana_HTTP
}

View File

@ -4,7 +4,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
/** /**
* Creates an HTTP_Exception of the specified type. * Creates an HTTP_Exception of the specified type.
* *
* @param integer $code the http status code * @param integer $code the http status code
* @param string $message status message, custom content to display with error * @param string $message status message, custom content to display with error
* @param array $variables translation variables * @param array $variables translation variables
@ -13,7 +13,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
public static function factory($code, $message = NULL, array $variables = NULL, Exception $previous = NULL) public static function factory($code, $message = NULL, array $variables = NULL, Exception $previous = NULL)
{ {
$class = 'HTTP_Exception_'.$code; $class = 'HTTP_Exception_'.$code;
return new $class($message, $variables, $previous); return new $class($message, $variables, $previous);
} }
@ -44,15 +44,15 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
/** /**
* Store the Request that triggered this exception. * Store the Request that triggered this exception.
* *
* @param Request $request Request object that triggered this exception. * @param Request $request Request object that triggered this exception.
* @return Response * @return HTTP_Exception
*/ */
public function request(Request $request = NULL) public function request(Request $request = NULL)
{ {
if ($request === NULL) if ($request === NULL)
return $this->_request; return $this->_request;
$this->_request = $request; $this->_request = $request;
return $this; return $this;
@ -60,7 +60,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
/** /**
* Generate a Response for the current Exception * Generate a Response for the current Exception
* *
* @uses Kohana_Exception::response() * @uses Kohana_Exception::response()
* @return Response * @return Response
*/ */
@ -69,4 +69,4 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception {
return Kohana_Exception::response($this); return Kohana_Exception::response($this);
} }
} // End Kohana_HTTP_Exception }

View File

@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_300 extends HTTP_Exception_Redirect {
*/ */
protected $_code = 300; protected $_code = 300;
} }

View File

@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_301 extends HTTP_Exception_Redirect {
*/ */
protected $_code = 301; protected $_code = 301;
} }

View File

@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_302 extends HTTP_Exception_Redirect {
*/ */
protected $_code = 302; protected $_code = 302;
} }

View File

@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_303 extends HTTP_Exception_Redirect {
*/ */
protected $_code = 303; protected $_code = 303;
} }

View File

@ -6,5 +6,5 @@ class Kohana_HTTP_Exception_304 extends HTTP_Exception_Expected {
* @var integer HTTP 304 Not Modified * @var integer HTTP 304 Not Modified
*/ */
protected $_code = 304; protected $_code = 304;
} }

View File

@ -9,7 +9,7 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected {
/** /**
* Specifies the proxy to replay this request via * Specifies the proxy to replay this request via
* *
* @param string $location URI of the proxy * @param string $location URI of the proxy
*/ */
public function location($uri = NULL) public function location($uri = NULL)
@ -24,7 +24,7 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected {
/** /**
* Validate this exception contains everything needed to continue. * Validate this exception contains everything needed to continue.
* *
* @throws Kohana_Exception * @throws Kohana_Exception
* @return bool * @return bool
*/ */
@ -38,4 +38,5 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected {
return TRUE; return TRUE;
} }
}
}

Some files were not shown because too many files have changed in this diff Show More