Commit 1b358723 by Carsten Brandt

Merge branch 'master' of github.com:yiisoft/yii2

* 'master' of github.com:yiisoft/yii2: typo fixed extension list file location. doc fix. moved extension list under yiisoft. updated read me. updated license information. reorganized extension directories. Adjusted jui directories. moved mutex back from extensions. Changed the exit status to normal. Specify the exact type of the exception. Small typos PhpDoc comment Missing return statement Changed php-diff dependency to use code from master (they haven't tagged changes we need yet) Added ability to get all GET, POST, PUT, DELETE or PATCH parameters to Request Add batchInsert method to yii\db\Migration Fixes #1117: added support to map a single view directory to multiple themed view directories. Fixes #1116.
parents c8c377e6 fc05ded1
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
...@@ -15,7 +15,7 @@ return [ ...@@ -15,7 +15,7 @@ return [
'preload' => ['log'], 'preload' => ['log'],
'controllerNamespace' => 'backend\controllers', 'controllerNamespace' => 'backend\controllers',
'modules' => [], 'modules' => [],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,
......
...@@ -15,7 +15,7 @@ return [ ...@@ -15,7 +15,7 @@ return [
'controllerNamespace' => 'console\controllers', 'controllerNamespace' => 'console\controllers',
'modules' => [ 'modules' => [
], ],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'db' => $params['components.db'], 'db' => $params['components.db'],
'cache' => $params['components.cache'], 'cache' => $params['components.cache'],
......
...@@ -16,7 +16,7 @@ return [ ...@@ -16,7 +16,7 @@ return [
'modules' => [ 'modules' => [
'gii' => 'yii\gii\Module' 'gii' => 'yii\gii\Module'
], ],
'extensions' => require(__DIR__ . '/../../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,
......
...@@ -18,7 +18,7 @@ if (empty($params['env'])) { ...@@ -18,7 +18,7 @@ if (empty($params['env'])) {
if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) { if (!ctype_digit($answer) || !in_array($answer, range(0, count($envs) - 1))) {
echo "\n Quit initialization.\n"; echo "\n Quit initialization.\n";
exit(1); exit(0);
} }
if (isset($envNames[$answer])) { if (isset($envNames[$answer])) {
...@@ -42,7 +42,7 @@ if (empty($params['env'])) { ...@@ -42,7 +42,7 @@ if (empty($params['env'])) {
$answer = trim(fgets(STDIN)); $answer = trim(fgets(STDIN));
if (strncasecmp($answer, 'y', 1)) { if (strncasecmp($answer, 'y', 1)) {
echo "\n Quit initialization.\n"; echo "\n Quit initialization.\n";
exit(1); exit(0);
} }
} }
......
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
...@@ -6,7 +6,7 @@ return [ ...@@ -6,7 +6,7 @@ return [
'preload' => ['log'], 'preload' => ['log'],
'controllerPath' => dirname(__DIR__) . '/commands', 'controllerPath' => dirname(__DIR__) . '/commands',
'controllerNamespace' => 'app\commands', 'controllerNamespace' => 'app\commands',
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'cache' => [ 'cache' => [
'class' => 'yii\caching\FileCache', 'class' => 'yii\caching\FileCache',
......
...@@ -3,7 +3,7 @@ $params = require(__DIR__ . '/params.php'); ...@@ -3,7 +3,7 @@ $params = require(__DIR__ . '/params.php');
$config = [ $config = [
'id' => 'bootstrap', 'id' => 'bootstrap',
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
'extensions' => require(__DIR__ . '/../vendor/yii-extensions.php'), 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'request' => [ 'request' => [
'enableCsrfValidation' => true, 'enableCsrfValidation' => true,
......
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ...@@ -29,4 +29,4 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
ActiveRecord implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record). ActiveRecord implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record).
The idea is that an ActiveRecord object is associated with a row in a database table The idea is that an ActiveRecord object is associated with a row in a database table
so object properties are mapped to colums of the corresponding database row. so object properties are mapped to columns of the corresponding database row.
For example, a `Customer` object is associated with a row in the `tbl_customer` For example, a `Customer` object is associated with a row in the `tbl_customer`
table. Instead of writing raw SQL statements to access the data in the table, table. Instead of writing raw SQL statements to access the data in the table,
you can call intuitive methods available in the corresponding ActiveRecord class you can call intuitive methods available in the corresponding ActiveRecord class
......
...@@ -7,7 +7,7 @@ of controlling it. ...@@ -7,7 +7,7 @@ of controlling it.
Access control basics Access control basics
--------------------- ---------------------
Basic acces control is very simple to implement using [[\yii\web\AccessControl]]: Basic access control is very simple to implement using [[\yii\web\AccessControl]]:
```php ```php
class SiteController extends Controller class SiteController extends Controller
......
...@@ -121,7 +121,7 @@ extension. After installing and enabling it you will be able to use extended syn ...@@ -121,7 +121,7 @@ extension. After installing and enabling it you will be able to use extended syn
that allows you to specify formatting style. that allows you to specify formatting style.
Full reference is [available at ICU website](http://icu-project.org/apiref/icu4c/classMessageFormat.html) but since it's Full reference is [available at ICU website](http://icu-project.org/apiref/icu4c/classMessageFormat.html) but since it's
a bit crypric we have our own reference below. a bit cryptic we have our own reference below.
### Numbers ### Numbers
......
...@@ -45,7 +45,7 @@ $query->select(['tbl_user.name AS author', 'tbl_post.title as title']) // <-- sp ...@@ -45,7 +45,7 @@ $query->select(['tbl_user.name AS author', 'tbl_post.title as title']) // <-- sp
->leftJoin('tbl_post', 'tbl_post.user_id = tbl_user.id'); // <-- join with another table ->leftJoin('tbl_post', 'tbl_post.user_id = tbl_user.id'); // <-- join with another table
``` ```
In the code above we've used `leftJoin` method to select from two related tables at the same time. Firsrt parameter In the code above we've used `leftJoin` method to select from two related tables at the same time. First parameter
specifies table name and the second is the join condition. Query builder has the following methods to join tables: specifies table name and the second is the join condition. Query builder has the following methods to join tables:
- `innerJoin` - `innerJoin`
......
...@@ -8,7 +8,7 @@ Standard Yii validators ...@@ -8,7 +8,7 @@ Standard Yii validators
----------------------- -----------------------
Standard Yii validators could be specified using aliases instead of referring to class names. Here's the list of all Standard Yii validators could be specified using aliases instead of referring to class names. Here's the list of all
validators budled with Yii with their most useful properties: validators bundled with Yii with their most useful properties:
### `boolean`: [[BooleanValidator]] ### `boolean`: [[BooleanValidator]]
......
...@@ -38,7 +38,7 @@ Widgets ...@@ -38,7 +38,7 @@ Widgets
Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some Widgets are a self-contained building blocks for your views. A widget may contain advanced logic, typically takes some
configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md), configuration and data and returns HTML. There is a good number of widgets bundled with Yii such as [active form](form.md),
breadcrumbs, menu or [wrappers around bootstrap component framework](boostrap-widgets.md). Additionally there are breadcrumbs, menu or [wrappers around bootstrap component framework](bootstrap-widgets.md). Additionally there are
extensions providing additional widgets such as official one for jQueryUI components. extensions providing additional widgets such as official one for jQueryUI components.
In order to use widget you need to do the following: In order to use widget you need to do the following:
......
...@@ -85,13 +85,13 @@ class Installer extends LibraryInstaller ...@@ -85,13 +85,13 @@ class Installer extends LibraryInstaller
protected function loadExtensions() protected function loadExtensions()
{ {
$file = $this->vendorDir . '/yii-extensions.php'; $file = $this->vendorDir . '/yiisoft/extensions.php';
return is_file($file) ? require($file) : []; return is_file($file) ? require($file) : [];
} }
protected function saveExtensions(array $extensions) protected function saveExtensions(array $extensions)
{ {
$file = $this->vendorDir . '/yii-extensions.php'; $file = $this->vendorDir . '/yiisoft/extensions.php';
file_put_contents($file, "<?php\nreturn " . var_export($extensions, true) . ";\n"); file_put_contents($file, "<?php\nreturn " . var_export($extensions, true) . ";\n");
} }
......
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
......
...@@ -26,8 +26,9 @@ class Plugin implements PluginInterface ...@@ -26,8 +26,9 @@ class Plugin implements PluginInterface
{ {
$installer = new Installer($io, $composer); $installer = new Installer($io, $composer);
$composer->getInstallationManager()->addInstaller($installer); $composer->getInstallationManager()->addInstaller($installer);
$file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yii-extensions.php'; $file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yiisoft/extensions.php';
if (!is_file($file)) { if (!is_file($file)) {
@mkdir(dirname($file));
file_put_contents($file, "<?php\nreturn [];\n"); file_put_contents($file, "<?php\nreturn [];\n");
} }
} }
......
Yii 2.0 Public Preview - Composer Installer Yii 2 Composer Installer
=========================================== ========================
Thank you for choosing Yii - a high-performance component-based PHP framework.
If you are looking for a production-ready PHP framework, please use
[Yii v1.1](https://github.com/yiisoft/yii).
Yii 2.0 is still under heavy development. We may make significant changes
without prior notices. **Yii 2.0 is not ready for production use yet.**
[![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2) [![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2)
This is the yii2 composer installer. This is the composer installer for Yii 2 extensions. It implements a new composer package type named `yii2-extension`,
which should be used by all Yii 2 extensions if they are distributed as composer packages.
Installation Usage
------------ -----
This extension offers you enhanced Composer handling for your yii2-project. It will therefore require you to use Composer. To use Yii 2 composer installer, simply set `type` to be `yii2-extension` in your `composer.json`,
like the following:
```json
{
"type": "yii2-extension",
"require": {
"yiisoft/yii2": "*"
},
...
}
``` ```
php composer.phar require yiisoft/yii2-composer "*"
```
*Note: You might have to run `php composer.phar selfupdate` before using this extension.*
Usage & Documentation
---------------------
This extension allows you to hook to certain composer events and automate preparing your Yii2 application for further usage. You may specify a bootstrap class in the `extra` section. The `init()` method of the class will be executed each time
the Yii 2 application is responding to a request. For example,
After the package is installed, the `composer.json` file has to be modified to enable this extension.
```json
To see it in action take a look at the example apps in the repository: {
"type": "yii2-extension",
- [Basic](https://github.com/suralc/yii2/blob/master/apps/basic/composer.json#L27) ...,
- [Advanced](https://github.com/suralc/yii2/blob/extensions-readme/apps/advanced/composer.json) "extra": {
"bootstrap": "yii\\jui\\Extension"
However it might be useful to read through the official composer [documentation](http://getcomposer.org/doc/articles/scripts.md) }
to understand what this extension can do for you and what it can't. }
```
You can also use this as a template to create your own composer additions to ease development and deployment of your app. The `Installer` class also implements a static method `setPermission()` that can be called after
a Yii 2 projected is installed, through the `post-create-project-cmd` composer script.
The method will set specified directories or files to be writable or executable, depending on
the corresponding parameters set in the `extra` section of the `composer.json` file.
For example,
```json
{
"name": "yiisoft/yii2-app-basic",
"type": "project",
...
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"extra": {
"writable": [
"runtime",
"web/assets"
],
"executable": [
"yii"
]
}
}
```
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
"autoload": { "autoload": {
"psr-0": { "yii\\composer\\": "" } "psr-0": { "yii\\composer\\": "" }
}, },
"target-dir": "yii/composer",
"extra": { "extra": {
"class": "yii\\composer\\Plugin" "class": "yii\\composer\\Plugin"
}, },
......
The Yii framework is free software. It is released under the terms of The Yii framework is free software. It is released under the terms of
the following BSD License. the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com) Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"autoload": { "autoload": {
"psr-0": { "yii\\jui\\": "" } "psr-0": { "yii\\jui\\": "" }
}, },
"target-dir": "yii/jui",
"extra": { "extra": {
"bootstrap": "yii\\jui\\Extension" "bootstrap": "yii\\jui\\Extension"
} }
......
The Yii framework is free software. It is released under the terms of
the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment