Browse Source

Merge branch 'master' into activerecord-interface

* master: (30 commits)
  replaced inheritdoc tags.
  doc cleanup.
  Moved key serialization from data provider to data viewers.
  Fixes #1356: Alias for authFile in rbac/PhpManager not resolved
  Fixes #1296: stricter check of dashes in route.
  Fixes #1362: added itemOptions to Html::radioList and checkboxList.
  Fixes #1362: doc fix.
  really small doc typo fix
  Fixes #1332: generate subdirectories when needed during message extraction process.
  typo fix.
  Fixes #1335: support view extension fallback
  More TDB for the guide
  Added reference to Composer section of the guide from 1.1.x differences page
  Better docs structure and minor fixes
  More docs on performance
  Structure for console application docs
  Docs on using behaviors
  doc fix.
  Refactored MessageInterface::send().
  refactored EmailTarget with the new mailer interfaces.
  ...
tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
1499480934
  1. 2
      .travis.yml
  2. 38
      docs/guide/basics.md
  3. 39
      docs/guide/behaviors.md
  4. 6
      docs/guide/configuration.md
  5. 41
      docs/guide/console.md
  6. 5
      docs/guide/database-basics.md
  7. 18
      docs/guide/debugger.md
  8. 12
      docs/guide/gii.md
  9. 6
      docs/guide/i18n.md
  10. 47
      docs/guide/performance.md
  11. 5
      docs/guide/upgrade-from-v1.md
  12. 4
      docs/guide/url.md
  13. 8
      extensions/composer/Installer.php
  14. 2
      extensions/composer/Plugin.php
  15. 6
      extensions/elasticsearch/ActiveQuery.php
  16. 18
      extensions/elasticsearch/ActiveRecord.php
  17. 4
      extensions/gii/Generator.php
  18. 8
      extensions/gii/GiiAsset.php
  19. 6
      extensions/gii/Module.php
  20. 20
      extensions/gii/generators/controller/Generator.php
  21. 6
      extensions/gii/generators/crud/Generator.php
  22. 2
      extensions/gii/generators/crud/templates/search.php
  23. 18
      extensions/gii/generators/form/Generator.php
  24. 18
      extensions/gii/generators/model/Generator.php
  25. 6
      extensions/gii/generators/model/templates/model.php
  26. 16
      extensions/gii/generators/module/Generator.php
  27. 10
      extensions/redis/ActiveRecord.php
  28. 14
      extensions/redis/Cache.php
  29. 4
      extensions/sphinx/ActiveQuery.php
  30. 2
      extensions/sphinx/ActiveRecord.php
  31. 34
      extensions/sphinx/Command.php
  32. 4
      extensions/sphinx/Connection.php
  33. 2
      extensions/swiftmailer/Mailer.php
  34. 42
      extensions/swiftmailer/Message.php
  35. 2
      framework/yii/BaseYii.php
  36. 4
      framework/yii/assets/yii.js
  37. 11
      framework/yii/base/Application.php
  38. 12
      framework/yii/base/Controller.php
  39. 11
      framework/yii/base/View.php
  40. 2
      framework/yii/caching/WinCache.php
  41. 10
      framework/yii/console/controllers/MessageController.php
  42. 2
      framework/yii/console/controllers/MigrateController.php
  43. 12
      framework/yii/data/ActiveDataProvider.php
  44. 6
      framework/yii/data/ArrayDataProvider.php
  45. 20
      framework/yii/db/Command.php
  46. 2
      framework/yii/db/Migration.php
  47. 2
      framework/yii/db/cubrid/QueryBuilder.php
  48. 2
      framework/yii/db/mysql/QueryBuilder.php
  49. 2
      framework/yii/db/sqlite/QueryBuilder.php
  50. 22
      framework/yii/db/sqlite/Schema.php
  51. 2
      framework/yii/grid/CheckboxColumn.php
  52. 4
      framework/yii/grid/Column.php
  53. 4
      framework/yii/grid/GridView.php
  54. 8
      framework/yii/helpers/BaseConsole.php
  55. 18
      framework/yii/helpers/BaseHtml.php
  56. 3
      framework/yii/helpers/BaseVarDumper.php
  57. 70
      framework/yii/log/EmailTarget.php
  58. 2
      framework/yii/log/Target.php
  59. 17
      framework/yii/mail/BaseMessage.php
  60. 4
      framework/yii/mail/MessageInterface.php
  61. 11
      framework/yii/rbac/PhpManager.php
  62. 2
      framework/yii/validators/SafeValidator.php
  63. 2
      framework/yii/validators/Validator.php
  64. 2
      framework/yii/web/Controller.php
  65. 2
      framework/yii/widgets/FragmentCache.php
  66. 2
      framework/yii/widgets/ListView.php
  67. 4
      phpunit.xml.dist
  68. 2
      tests/unit/VendorTestCase.php
  69. 2
      tests/unit/extensions/sphinx/ActiveRecordTest.php
  70. 4
      tests/unit/extensions/swiftmailer/MessageTest.php
  71. 2
      tests/unit/framework/console/controllers/MessageControllerTest.php
  72. 2
      tests/unit/framework/db/sqlite/SqliteCommandTest.php
  73. 8
      tests/unit/framework/db/sqlite/SqliteConnectionTest.php
  74. 2
      tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
  75. 9
      tests/unit/framework/mail/BaseMessageTest.php
  76. 4
      tests/unit/framework/validators/UniqueValidatorTest.php

2
.travis.yml

@ -22,7 +22,7 @@ before_script:
- tests/unit/data/travis/sphinx-setup.sh
#script:
# - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor,sphinx
# - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
#after_script:
# - php vendor/bin/coveralls

38
docs/guide/basics.md

@ -78,9 +78,43 @@ directory and Yii will be able to autoload any class in this library.
Autoloading
-----------
TBD
All classes, interfaces and traits are loaded automatically at the moment they are used. There's no need to use
`include` or `require`. It is, as well, true for Composer-loaded packages and Yii extensions.
Autoloader works according to [PSR-0](). That means namespaces and class, interface and trait
names should correspond to file system paths except root namespace path that is defined by an alias.
For example, if standard alias `@app` refers to `/var/www/example.com/` then `\app\models\User` will be loaded from
`/var/www/example.com/app/models/User.php`.
Custom alias may be added using the following code:
```php
Yii::setAlias('shared', realpath('~/src/shared'));
```
Additional autoloaders may be registered using standard PHP `spl_autoload_register`.
Helper classes
--------------
TDB
Helper class typically contains static methods only and used as follows:
```php
use \yii\helpers\Html;
echo Html::encode('Test > test');
```
There are several classes provided by framework:
- ArrayHelper
- Console
- FileHelper
- Html
- HtmlPurifier
- Inflector
- Json
- Markdown
- Security
- StringHelper
- VarDumper

39
docs/guide/behaviors.md

@ -1,4 +1,41 @@
Behaviors
=========
TDB
A behavior (also knows as mixin) can be used to enhance the functionality of an existing component without modifying its
code. In particular, it can "inject" its own methods and properties into the component and make them directly accessible
via the component. It can also respond to the events triggered in the component and thus intercept the normal
code execution. Unlike PHP traits, behaviors could be attached to classes at runtime.
Using behaviors
---------------
Behavior can be attached to any class that extends from `Component`. In order to do so you need to implement `behaviors`
method. Yii provides `AutoTimestamp` behavior that handles updating timestamp fields on saving active record model.
```php
class User extends ActiveRecord
{
// ...
public function behaviors()
{
return [
'timestamp' => [
'class' => 'yii\behaviors\AutoTimestamp',
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['create_time', 'update_time'],
ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time',
],
],
];
}
}
```
In the above `class` value is a string containing fully qualified behavior class name. All the other key-values are
assigned to corresponding properties of the class.
Creating your own behaviors
---------------------------
TBD

6
docs/guide/configuration.md

@ -21,7 +21,11 @@ console applications it's `yii`. Both are doing nearly the same job:
5. Creating new application instance using `$config` and running it.
The Bootstrap file is not the part of framework but your application so it's OK to adjust it to fit your application. Typical
adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read.
adjustments are the value of `YII_DEBUG` that should never be `true` on production and the way config is read:
```php
defined('YII_DEBUG') or define('YII_DEBUG', false);
```
Configuring application instance
--------------------------------

41
docs/guide/console.md

@ -1,4 +1,39 @@
Building console applications
=============================
Console applications
====================
TDB
Yii has full featured support of console. Console application structure in Yii is very similar to web application. It
consists of one or more [[\yii\console\Controller]] (often referred to as commands). Each has one or more actions.
Usage
-----
User executes controller action using the following syntax:
```
yii <route> [--param1=value1 --param2 ...]
```
For example, `MigrationController::create` with `MigrationController::$migrationTable` set can be called from command
line like the following:
```
yii migreate/create --migrationTable=my_migration
```
Entry script
------------
Configuration
-------------
Creating your own console commands
----------------------------------
### Controller
### Action
### Parameters
### Return codes

5
docs/guide/database-basics.md

@ -9,8 +9,8 @@ uniform API and solves some inconsistencies between different DBMS. By default Y
- [SQLite](http://sqlite.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [CUBRID](http://www.cubrid.org/) (version 9.1.0 and higher).
- Oracle
- MSSQL
- [Oracle](http://www.oracle.com/us/products/database/overview/index.html)
- [MSSQL](https://www.microsoft.com/en-us/sqlserver/default.aspx)
Configuration
@ -42,6 +42,7 @@ return [
// ...
];
```
Please refer to the [PHP manual](http://www.php.net/manual/en/function.PDO-construct.php) for more details
on the format of the DSN string.

18
docs/guide/debugger.md

@ -7,19 +7,21 @@ about currently opened page while using debugger you can analyze data collected
Installing and configuring
--------------------------
How to use it
-------------
Add these lines to your config file:
```
'preload' => ['debug'],
'modules' => [
'debug' => ['yii\debug\Module']
]
'preload' => ['debug'],
'modules' => [
'debug' => ['yii\debug\Module']
]
```
**Watch out: by default the debug module only works when browsing the website from the localhost. If you want to use it on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP.**
**Watch out: by default the debug module only works when browsing the website from the localhost. If you want to use it
on a remote (staging) server, add the parameter allowedIPs to the config to whitelist your IP.**
How to use it
-------------
Creating your own panels
------------------------

12
docs/guide/gii.md

@ -7,17 +7,17 @@ as well as complete CRUD controllers.
Installing and configuring
--------------------------
How to use it
-------------
Add these lines to your config file:
```php
'modules' => [
'gii' => ['yii\gii\Module']
]
'modules' => [
'gii' => ['yii\gii\Module']
]
```
How to use it
-------------
Creating your own templates
---------------------------

6
docs/guide/i18n.md

@ -47,7 +47,7 @@ translation of the message from source language into target language. Message it
echo \Yii::t('app', 'This is a string to translate!');
```
Yii tries to load approprite translation from one of the message sources defined via `i18n` component configuration:
Yii tries to load appropriate translation from one of the message sources defined via `i18n` component configuration:
```php
'components' => [
@ -239,7 +239,7 @@ you'll get "Inconsistent types declared for an argument: U_ARGUMENT_TYPE_MISMATC
Total {count, number} {count, plural, one{item} other{items}}.
```
To learn which inflection forms you should specify for your language you can referer to
To learn which inflection forms you should specify for your language you can referrer to
[rules reference at unicode.org](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html).
### Selections
@ -264,3 +264,5 @@ Formatters
In order to use formatters you need to install and enable [intl](http://www.php.net/manual/en/intro.intl.php) PHP
extension.
TBD: provided classes overview.

47
docs/guide/performance.md

@ -28,9 +28,10 @@ logger may record additional debug information for every message being logged.
### Enabling PHP opcode cache
Enabling the PHP opcode cache improves any PHP application performance and lowers
memory usage significantly. Yii is no exception. It was tested with
[APC PHP extension](http://php.net/manual/en/book.apc.php) that caches
and optimizes PHP intermediate code and avoids the time spent in parsing PHP
memory usage significantly. Yii is no exception. It was tested with both
[PHP 5.5 OPcache](http://php.net/manual/en/book.opcache.php) and
[APC PHP extension](http://php.net/manual/en/book.apc.php). Both cache
and optimize PHP intermediate code and avoid the time spent in parsing PHP
scripts for every incoming request.
### Turning on ActiveRecord database schema caching
@ -69,7 +70,10 @@ Note that `cache` application component should be configured.
### Combining and Minimizing Assets
TBD
It is possible to combine and minimize assets, typically JavaScript and CSS, in order to slightly improve page load
time and therefore deliver better experience for end user of your application.
In order to learn how it can be achieved, refer to [assets](assets.md) guide section.
### Using better storage for sessions
@ -118,7 +122,38 @@ save the rendering cost for the whole page.
### Leveraging HTTP to save processing time and bandwidth
TBD
Leveraging HTTP caching saves both processing time, bandwidth and resources significantly. It can be implemented by
sending either `ETag` or `Last-Modified` header in your application response. If browser is implemented according to
HTTP specification (most browsers are), content will be fetched only if it is different from what it was prevously.
Forming proper headers is time consuming task so Yii provides a shortcut in form of controller filter
[[\yii\web\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like
the following:
```php
public function behaviors()
{
return [
'httpCache' => [
'class' => \yii\web\HttpCache::className(),
'only' => ['list'],
'lastModified' => function ($action, $params) {
$q = new Query();
return strtotime($q->from('users')->max('updated_timestamp'));
},
// 'etagSeed' => function ($action, $params) {
// return // generate etag seed here
//}
],
];
}
```
In the code above one can use either `etagSeed` or `lastModified`. Implementing both isn't necessary. The goal is to
determine if content was modified in a way that is cheaper than fetching and rendering that content. `lastModified`
should return unix timestamp of the last content modification while `etagSeed` should return a string that is then
used to generate `ETag` header value.
### Database Optimization
@ -140,7 +175,7 @@ to create one or several objects to represent each row of query result. For data
intensive applications, using DAO or database APIs at lower level could be
a better choice.
Last but not least, use LIMIT in your SELECT queries. This avoids fetching
Last but not least, use `LIMIT` in your `SELECT` queries. This avoids fetching
overwhelming data from database and exhausting the memory allocated to PHP.
### Using asArray

5
docs/guide/upgrade-from-v1.md

@ -518,5 +518,8 @@ TBD
Integration with Composer
-------------------------
TBD
Yii is fully inegrated with the package manager for PHP named Composer that resolves dependencies, keeps your code
up to date updating it semi-automatically and manages autoloading for third party libraries no matter which autoloading
these are using.
In order to learn more refer to [composer](composer.md) and [installation](installation.md) sections of the guide.

4
docs/guide/url.md

@ -92,6 +92,8 @@ return [
### Handling REST
TBD: [[\yii\web\VerbFiler]]
URL parsing
-----------
@ -118,3 +120,5 @@ return [
Creating your own rule classes
------------------------------
TBD

8
extensions/composer/Installer.php

@ -26,7 +26,7 @@ class Installer extends LibraryInstaller
const EXTENSION_FILE = 'yiisoft/extensions.php';
/**
* {@inheritdoc}
* @inheritdoc
*/
public function supports($packageType)
{
@ -34,7 +34,7 @@ class Installer extends LibraryInstaller
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
@ -49,7 +49,7 @@ class Installer extends LibraryInstaller
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
@ -63,7 +63,7 @@ class Installer extends LibraryInstaller
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{

2
extensions/composer/Plugin.php

@ -20,7 +20,7 @@ use Composer\Plugin\PluginInterface;
class Plugin implements PluginInterface
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public function activate(Composer $composer, IOInterface $io)
{

6
extensions/elasticsearch/ActiveQuery.php

@ -139,7 +139,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function search($db = null, $options = [])
{
@ -161,7 +161,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function scalar($field, $db = null)
{
@ -177,7 +177,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function column($field, $db = null)
{

18
extensions/elasticsearch/ActiveRecord.php

@ -61,7 +61,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function find($q = null)
{
@ -138,7 +138,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
// TODO add percolate functionality http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function createQuery()
{
@ -146,7 +146,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function createActiveRelation($config = [])
{
@ -175,7 +175,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getPrimaryKey($asArray = false)
{
@ -187,7 +187,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getOldPrimaryKey($asArray = false)
{
@ -430,7 +430,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function updateAllCounters($counters, $condition = null, $params = [])
{
@ -438,7 +438,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function getTableSchema()
{
@ -446,7 +446,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function tableName()
{
@ -454,7 +454,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function findBySql($sql, $params = [])
{

4
extensions/gii/Generator.php

@ -63,7 +63,7 @@ abstract class Generator extends Model
abstract public function generate();
/**
* {@inheritdoc}
* @inheritdoc
*/
public function init()
{
@ -164,7 +164,7 @@ abstract class Generator extends Model
}
/**
* {@inheritdoc}
* @inheritdoc
*
* Child classes should override this method like the following so that the parent
* rules are included:

8
extensions/gii/GiiAsset.php

@ -18,25 +18,25 @@ use yii\web\AssetBundle;
class GiiAsset extends AssetBundle
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public $sourcePath = '@yii/gii/assets';
/**
* {@inheritdoc}
* @inheritdoc
*/
public $css = [
'main.css',
'typeahead.js-bootstrap.css',
];
/**
* {@inheritdoc}
* @inheritdoc
*/
public $js = [
'gii.js',
'typeahead.js',
];
/**
* {@inheritdoc}
* @inheritdoc
*/
public $depends = [
'yii\web\YiiAsset',

6
extensions/gii/Module.php

@ -54,7 +54,7 @@ use yii\web\HttpException;
class Module extends \yii\base\Module
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public $controllerNamespace = 'yii\gii\controllers';
/**
@ -92,7 +92,7 @@ class Module extends \yii\base\Module
/**
* {@inheritdoc}
* @inheritdoc
*/
public function init()
{
@ -103,7 +103,7 @@ class Module extends \yii\base\Module
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function beforeAction($action)
{

20
extensions/gii/generators/controller/Generator.php

@ -38,7 +38,7 @@ class Generator extends \yii\gii\Generator
public $actions = 'index';
/**
* {@inheritdoc}
* @inheritdoc
*/
public function init()
{
@ -47,7 +47,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getName()
{
@ -55,7 +55,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDescription()
{
@ -64,7 +64,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function rules()
{
@ -79,7 +79,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{
@ -92,7 +92,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function requiredTemplates()
{
@ -103,7 +103,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function stickyAttributes()
{
@ -111,7 +111,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function hints()
{
@ -134,7 +134,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function successMessage()
{
@ -149,7 +149,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function generate()
{

6
extensions/gii/generators/crud/Generator.php

@ -69,7 +69,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function hints()
{
@ -95,7 +95,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function stickyAttributes()
{
@ -123,7 +123,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function generate()
{

2
extensions/gii/generators/crud/templates/search.php

@ -40,7 +40,7 @@ class <?= $searchModelClass ?> extends Model
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{

18
extensions/gii/generators/form/Generator.php

@ -26,7 +26,7 @@ class Generator extends \yii\gii\Generator
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getName()
{
@ -34,7 +34,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDescription()
{
@ -42,7 +42,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function generate()
{
@ -55,7 +55,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function rules()
{
@ -72,7 +72,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{
@ -85,7 +85,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function requiredTemplates()
{
@ -93,7 +93,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function stickyAttributes()
{
@ -101,7 +101,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function hints()
{
@ -114,7 +114,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function successMessage()
{

18
extensions/gii/generators/model/Generator.php

@ -32,7 +32,7 @@ class Generator extends \yii\gii\Generator
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getName()
{
@ -40,7 +40,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDescription()
{
@ -48,7 +48,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function rules()
{
@ -68,7 +68,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{
@ -84,7 +84,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function hints()
{
@ -111,7 +111,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function autoCompleteData()
{
@ -128,7 +128,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function requiredTemplates()
{
@ -136,7 +136,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function stickyAttributes()
{
@ -144,7 +144,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function generate()
{

6
extensions/gii/generators/model/templates/model.php

@ -33,7 +33,7 @@ namespace <?= $generator->ns ?>;
class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') . "\n" ?>
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function tableName()
{
@ -41,7 +41,7 @@ class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') .
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function rules()
{
@ -49,7 +49,7 @@ class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') .
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{

16
extensions/gii/generators/module/Generator.php

@ -24,7 +24,7 @@ class Generator extends \yii\gii\Generator
public $moduleID;
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getName()
{
@ -32,7 +32,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDescription()
{
@ -40,7 +40,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function rules()
{
@ -54,7 +54,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attributeLabels()
{
@ -65,7 +65,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function hints()
{
@ -76,7 +76,7 @@ class Generator extends \yii\gii\Generator
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function successMessage()
{
@ -104,7 +104,7 @@ EOD;
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function requiredTemplates()
{
@ -112,7 +112,7 @@ EOD;
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function generate()
{

10
extensions/redis/ActiveRecord.php

@ -48,7 +48,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function createQuery()
{
@ -56,7 +56,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function createActiveRelation($config = [])
{
@ -87,7 +87,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function insert($runValidation = true, $attributes = null)
{
@ -294,7 +294,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function getTableSchema()
{
@ -302,7 +302,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public static function findBySql($sql, $params = [])
{

14
extensions/redis/Cache.php

@ -105,7 +105,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function getValue($key)
{
@ -113,7 +113,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function getValues($keys)
{
@ -127,7 +127,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function setValue($key, $value, $expire)
{
@ -140,7 +140,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function setValues($data, $expire)
{
@ -174,7 +174,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function addValue($key, $value, $expire)
{
@ -187,7 +187,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function deleteValue($key)
{
@ -195,7 +195,7 @@ class Cache extends \yii\caching\Cache
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function flushValues()
{

4
extensions/sphinx/ActiveQuery.php

@ -176,7 +176,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function defaultConnection()
{
@ -201,4 +201,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
return $result;
}
}
}

2
extensions/sphinx/ActiveRecord.php

@ -1385,6 +1385,8 @@ abstract class ActiveRecord extends Model
$this->populateRelation($offset, $item);
return;
}
} catch (InvalidParamException $e) {
// shut down exception : has getter, but not relation
} catch (UnknownMethodException $e) {
throw $e->getPrevious();
}

34
extensions/sphinx/Command.php

@ -197,7 +197,7 @@ class Command extends \yii\db\Command
// Not Supported :
/**
* {@inheritdoc}
* @inheritdoc
*/
public function createTable($table, $columns, $options = null)
{
@ -205,7 +205,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function renameTable($table, $newName)
{
@ -213,7 +213,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function dropTable($table)
{
@ -221,7 +221,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function truncateTable($table)
{
@ -229,7 +229,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function addColumn($table, $column, $type)
{
@ -237,7 +237,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function dropColumn($table, $column)
{
@ -245,7 +245,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function renameColumn($table, $oldName, $newName)
{
@ -253,7 +253,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function alterColumn($table, $column, $type)
{
@ -261,7 +261,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function addPrimaryKey($name, $table, $columns)
{
@ -269,7 +269,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function dropPrimaryKey($name, $table)
{
@ -277,7 +277,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null)
{
@ -285,7 +285,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function dropForeignKey($name, $table)
{
@ -293,7 +293,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function createIndex($name, $table, $columns, $unique = false)
{
@ -301,7 +301,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function dropIndex($name, $table)
{
@ -309,7 +309,7 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function resetSequence($table, $value = null)
{
@ -317,10 +317,10 @@ class Command extends \yii\db\Command
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function checkIntegrity($check = true, $schema = '')
{
throw new NotSupportedException('"' . __METHOD__ . '" is not supported.');
}
}
}

4
extensions/sphinx/Connection.php

@ -62,7 +62,7 @@ use yii\base\NotSupportedException;
class Connection extends \yii\db\Connection
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public $schemaMap = [
'mysqli' => 'yii\sphinx\Schema', // MySQL
@ -129,4 +129,4 @@ class Connection extends \yii\db\Connection
{
throw new NotSupportedException('"' . __METHOD__ . '" is not supported.');
}
}
}

2
extensions/swiftmailer/Mailer.php

@ -123,7 +123,7 @@ class Mailer extends BaseMailer
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function sendMessage($message)
{

42
extensions/swiftmailer/Message.php

@ -41,7 +41,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCharset()
{
@ -49,7 +49,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setCharset($charset)
{
@ -58,7 +58,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getFrom()
{
@ -66,7 +66,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setFrom($from)
{
@ -75,7 +75,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getReplyTo()
{
@ -83,7 +83,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setReplyTo($replyTo)
{
@ -92,7 +92,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getTo()
{
@ -100,7 +100,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setTo($to)
{
@ -109,7 +109,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCc()
{
@ -117,7 +117,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setCc($cc)
{
@ -126,7 +126,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getBcc()
{
@ -134,7 +134,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setBcc($bcc)
{
@ -143,7 +143,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getSubject()
{
@ -151,7 +151,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setSubject($subject)
{
@ -160,7 +160,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setTextBody($text)
{
@ -169,7 +169,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setHtmlBody($html)
{
@ -222,7 +222,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attach($fileName, array $options = [])
{
@ -238,7 +238,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function attachContent($content, array $options = [])
{
@ -254,7 +254,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function embed($fileName, array $options = [])
{
@ -269,7 +269,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function embedContent($content, array $options = [])
{
@ -284,7 +284,7 @@ class Message extends BaseMessage
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function toString()
{

2
framework/yii/BaseYii.php

@ -519,12 +519,14 @@ class BaseYii
* Configures an object with the initial property values.
* @param object $object the object to be configured
* @param array $properties the property initial values given in terms of name-value pairs.
* @return object the object itself
*/
public static function configure($object, $properties)
{
foreach ($properties as $name => $value) {
$object->$name = $value;
}
return $object;
}
/**

4
framework/yii/assets/yii.js

@ -58,14 +58,14 @@ yii = (function ($) {
changeableSelector: 'select, input, textarea',
/**
* @return string|undefined the CSRF variable name. Undefined is returned is CSRF validation is not enabled.
* @return string|undefined the CSRF variable name. Undefined is returned if CSRF validation is not enabled.
*/
getCsrfVar: function () {
return $('meta[name=csrf-var]').prop('content');
},
/**
* @return string|undefined the CSRF token. Undefined is returned is CSRF validation is not enabled.
* @return string|undefined the CSRF token. Undefined is returned if CSRF validation is not enabled.
*/
getCsrfToken: function () {
return $('meta[name=csrf-token]').prop('content');

11
framework/yii/base/Application.php

@ -199,7 +199,7 @@ abstract class Application extends Module
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function init()
{
@ -459,6 +459,15 @@ abstract class Application extends Module
}
/**
* Returns the mailer component.
* @return \yii\mail\MailerInterface the mailer interface
*/
public function getMail()
{
return $this->getComponent('mail');
}
/**
* Returns the auth manager for this application.
* @return \yii\rbac\Manager the auth manager for this application.
*/

12
framework/yii/base/Controller.php

@ -194,7 +194,7 @@ class Controller extends Component implements ViewContextInterface
$actionMap = $this->actions();
if (isset($actionMap[$id])) {
return Yii::createObject($actionMap[$id], $id, $this);
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) {
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) {
$methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id))));
if (method_exists($this, $methodName)) {
$method = new \ReflectionMethod($this, $methodName);
@ -417,9 +417,13 @@ class Controller extends Component implements ViewContextInterface
$file = $module->getLayoutPath() . DIRECTORY_SEPARATOR . $layout;
}
if (pathinfo($file, PATHINFO_EXTENSION) === '') {
$file .= $view->defaultExtension;
if (pathinfo($file, PATHINFO_EXTENSION) !== '') {
return $file;
}
return $file;
$path = $file . '.' . $view->defaultExtension;
if ($view->defaultExtension !== 'php' && !is_file($path)) {
$path = $file . '.php';
}
return $path;
}
}

11
framework/yii/base/View.php

@ -67,7 +67,7 @@ class View extends Component
/**
* @var string the default view file extension. This will be appended to view file names if they don't have file extensions.
*/
public $defaultExtension = '.php';
public $defaultExtension = 'php';
/**
* @var Theme|array the theme object or the configuration array for creating the theme object.
* If not set, it means theming is not enabled.
@ -171,7 +171,14 @@ class View extends Component
}
}
return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . $this->defaultExtension : $file;
if (pathinfo($file, PATHINFO_EXTENSION) !== '') {
return $file;
}
$path = $file . '.' . $this->defaultExtension;
if ($this->defaultExtension !== 'php' && !is_file($path)) {
$path = $file . '.php';
}
return $path;
}
/**

2
framework/yii/caching/WinCache.php

@ -13,7 +13,7 @@ namespace yii\caching;
* To use this application component, the [WinCache PHP extension](http://www.iis.net/expand/wincacheforphp)
* must be loaded. Also note that "wincache.ucenabled" should be set to "On" in your php.ini file.
*
* See {@link CCache} manual for common cache operations that are supported by WinCache.
* See [[Cache]] manual for common cache operations that are supported by WinCache.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0

10
framework/yii/console/controllers/MessageController.php

@ -107,11 +107,13 @@ class MessageController extends Controller
@mkdir($dir);
}
foreach ($messages as $category => $msgs) {
$file = str_replace("\\", '/', "$dir/$category.php");
$path = dirname($file);
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
$msgs = array_values(array_unique($msgs));
$this->generateMessageFile($msgs, $dir . DIRECTORY_SEPARATOR . $category . '.php',
$config['overwrite'],
$config['removeUnused'],
$config['sort']);
$this->generateMessageFile($msgs, $file, $config['overwrite'], $config['removeUnused'], $config['sort']);
}
}
}

2
framework/yii/console/controllers/MigrateController.php

@ -33,7 +33,7 @@ use yii\helpers\ArrayHelper;
*
* ~~~
* CREATE TABLE tbl_migration (
* version varchar(255) PRIMARY KEY,
* version varchar(180) PRIMARY KEY,
* apply_time integer
* )
* ~~~

12
framework/yii/data/ActiveDataProvider.php

@ -93,7 +93,7 @@ class ActiveDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareModels()
{
@ -111,7 +111,7 @@ class ActiveDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareKeys($models)
{
@ -138,9 +138,9 @@ class ActiveDataProvider extends BaseDataProvider
foreach ($models as $model) {
$kk = [];
foreach ($pks as $pk) {
$kk[] = $model[$pk];
$kk[$pk] = $model[$pk];
}
$keys[] = json_encode($kk);
$keys[] = $kk;
}
}
return $keys;
@ -150,7 +150,7 @@ class ActiveDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareTotalCount()
{
@ -162,7 +162,7 @@ class ActiveDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function setSort($value)
{

6
framework/yii/data/ArrayDataProvider.php

@ -66,7 +66,7 @@ class ArrayDataProvider extends BaseDataProvider
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareModels()
{
@ -87,7 +87,7 @@ class ArrayDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareKeys($models)
{
@ -107,7 +107,7 @@ class ArrayDataProvider extends BaseDataProvider
}
/**
* {@inheritdoc}
* @inheritdoc
*/
protected function prepareTotalCount()
{

20
framework/yii/db/Command.php

@ -278,9 +278,13 @@ class Command extends \yii\base\Component
return $n;
} catch (\Exception $e) {
Yii::endProfile($token, __METHOD__);
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
throw new Exception($message, $errorInfo, (int)$e->getCode(), $e);
if ($e instanceof Exception) {
throw $e;
} else {
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
throw new Exception($message, $errorInfo, (int)$e->getCode(), $e);
}
}
}
@ -411,9 +415,13 @@ class Command extends \yii\base\Component
return $result;
} catch (\Exception $e) {
Yii::endProfile($token, __METHOD__);
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
throw new Exception($message, $errorInfo, (int)$e->getCode(), $e);
if ($e instanceof Exception) {
throw $e;
} else {
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
throw new Exception($message, $errorInfo, (int)$e->getCode(), $e);
}
}
}

2
framework/yii/db/Migration.php

@ -312,7 +312,7 @@ class Migration extends \yii\base\Component
* Builds and executes a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the new column type. The {@link getColumnType} method will be invoked to convert abstract column type (if any)
* @param string $type the new column type. The [[getColumnType()]] method will be invoked to convert abstract column type (if any)
* into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL.
* For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'.
*/

2
framework/yii/db/cubrid/QueryBuilder.php

@ -69,7 +69,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function buildLimit($limit, $offset)
{

2
framework/yii/db/mysql/QueryBuilder.php

@ -142,7 +142,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function buildLimit($limit, $offset)
{

2
framework/yii/db/sqlite/QueryBuilder.php

@ -255,7 +255,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function buildLimit($limit, $offset)
{

22
framework/yii/db/sqlite/Schema.php

@ -50,6 +50,28 @@ class Schema extends \yii\db\Schema
];
/**
* Quotes a table name for use in a query.
* A simple table name has no schema prefix.
* @param string $name table name
* @return string the properly quoted table name
*/
public function quoteSimpleTableName($name)
{
return strpos($name, "`") !== false ? $name : "`" . $name . "`";
}
/**
* Quotes a column name for use in a query.
* A simple column name has no prefix.
* @param string $name column name
* @return string the properly quoted column name
*/
public function quoteSimpleColumnName($name)
{
return strpos($name, '`') !== false || $name === '*' ? $name : '`' . $name . '`';
}
/**
* Creates a query builder for the MySQL database.
* This method may be overridden by child classes to create a DBMS-specific query builder.
* @return QueryBuilder query builder instance

2
framework/yii/grid/CheckboxColumn.php

@ -44,7 +44,7 @@ class CheckboxColumn extends Column
/**
* Renders the header cell content.
* The default implementation simply renders {@link header}.
* The default implementation simply renders [[header]].
* This method may be overridden to customize the rendering of the header cell.
* @return string the rendering result
*/

4
framework/yii/grid/Column.php

@ -94,7 +94,7 @@ class Column extends Object
/**
* Renders the header cell content.
* The default implementation simply renders {@link header}.
* The default implementation simply renders [[header]].
* This method may be overridden to customize the rendering of the header cell.
* @return string the rendering result
*/
@ -105,7 +105,7 @@ class Column extends Object
/**
* Renders the footer cell content.
* The default implementation simply renders {@link footer}.
* The default implementation simply renders [[footer]].
* This method may be overridden to customize the rendering of the footer cell.
* @return string the rendering result
*/

4
framework/yii/grid/GridView.php

@ -162,7 +162,7 @@ class GridView extends BaseListView
/**
* Initializes the grid view.
* This method will initialize required property values and instantiate {@link columns} objects.
* This method will initialize required property values and instantiate [[columns]] objects.
*/
public function init()
{
@ -373,7 +373,7 @@ class GridView extends BaseListView
} else {
$options = $this->rowOptions;
}
$options['data-key'] = $key;
$options['data-key'] = is_array($key) ? json_encode($key) : $key;
return Html::tag('tr', implode('', $cells), $options);
}

8
framework/yii/helpers/BaseConsole.php

@ -142,7 +142,7 @@ class BaseConsole
/**
* Saves the current cursor position by sending ANSI control code SCP to the terminal.
* Position can then be restored with {@link restoreCursorPosition}.
* Position can then be restored with [[restoreCursorPosition()]].
*/
public static function saveCursorPosition()
{
@ -150,7 +150,7 @@ class BaseConsole
}
/**
* Restores the cursor position saved with {@link saveCursorPosition} by sending ANSI control code RCP to the terminal.
* Restores the cursor position saved with [[saveCursorPosition()]] by sending ANSI control code RCP to the terminal.
*/
public static function restoreCursorPosition()
{
@ -159,7 +159,7 @@ class BaseConsole
/**
* Hides the cursor by sending ANSI DECTCEM code ?25l to the terminal.
* Use {@link showCursor} to bring it back.
* Use [[showCursor()]] to bring it back.
* Do not forget to show cursor when your application exits. Cursor might stay hidden in terminal after exit.
*/
public static function hideCursor()
@ -168,7 +168,7 @@ class BaseConsole
}
/**
* Will show a cursor again when it has been hidden by {@link hideCursor} by sending ANSI DECTCEM code ?25h to the terminal.
* Will show a cursor again when it has been hidden by [[hideCursor()]] by sending ANSI DECTCEM code ?25h to the terminal.
*/
public static function showCursor()
{

18
framework/yii/helpers/BaseHtml.php

@ -739,6 +739,7 @@ class BaseHtml
* - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true.
* This option is ignored if `item` option is set.
* - separator: string, the HTML code that separates items.
* - itemOptions: array, the options for generating the radio button tag using [[checkbox()]].
* - item: callable, a callback that can be used to customize the generation of the HTML code
* corresponding to a single item in $items. The signature of this callback must be:
*
@ -758,6 +759,7 @@ class BaseHtml
}
$formatter = isset($options['item']) ? $options['item'] : null;
$itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
$encode = !isset($options['encode']) || $options['encode'];
$lines = [];
$index = 0;
@ -768,10 +770,10 @@ class BaseHtml
if ($formatter !== null) {
$lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value);
} else {
$lines[] = static::checkbox($name, $checked, [
$lines[] = static::checkbox($name, $checked, array_merge($itemOptions, [
'value' => $value,
'label' => $encode ? static::encode($label) : $label,
]);
]));
}
$index++;
}
@ -786,7 +788,7 @@ class BaseHtml
$separator = isset($options['separator']) ? $options['separator'] : "\n";
$tag = isset($options['tag']) ? $options['tag'] : 'div';
unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item']);
unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']);
return $hidden . static::tag($tag, implode($separator, $lines), $options);
}
@ -797,7 +799,7 @@ class BaseHtml
* @param string $name the name attribute of each radio button.
* @param string|array $selection the selected value(s).
* @param array $items the data item used to generate the radio buttons.
* The array keys are the labels, while the array values are the corresponding radio button values.
* The array values are the labels, while the array keys are the corresponding radio button values.
* @param array $options options (name => config) for the radio button list. The following options are supported:
*
* - unselect: string, the value that should be submitted when none of the radio buttons is selected.
@ -805,6 +807,7 @@ class BaseHtml
* - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true.
* This option is ignored if `item` option is set.
* - separator: string, the HTML code that separates items.
* - itemOptions: array, the options for generating the radio button tag using [[radio()]].
* - item: callable, a callback that can be used to customize the generation of the HTML code
* corresponding to a single item in $items. The signature of this callback must be:
*
@ -821,6 +824,7 @@ class BaseHtml
{
$encode = !isset($options['encode']) || $options['encode'];
$formatter = isset($options['item']) ? $options['item'] : null;
$itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
$lines = [];
$index = 0;
foreach ($items as $value => $label) {
@ -830,10 +834,10 @@ class BaseHtml
if ($formatter !== null) {
$lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value);
} else {
$lines[] = static::radio($name, $checked, [
$lines[] = static::radio($name, $checked, array_merge($itemOptions, [
'value' => $value,
'label' => $encode ? static::encode($label) : $label,
]);
]));
}
$index++;
}
@ -847,7 +851,7 @@ class BaseHtml
}
$tag = isset($options['tag']) ? $options['tag'] : 'div';
unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item']);
unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']);
return $hidden . static::tag($tag, implode($separator, $lines), $options);
}

3
framework/yii/helpers/BaseVarDumper.php

@ -111,10 +111,9 @@ class BaseVarDumper
} else {
$id = array_push(self::$_objects, $var);
$className = get_class($var);
$members = (array)$var;
$spaces = str_repeat(' ', $level * 4);
self::$_output .= "$className#$id\n" . $spaces . '(';
foreach ($members as $key => $value) {
foreach ((array)$var as $key => $value) {
$keyDisplay = strtr(trim($key), ["\0" => ':']);
self::$_output .= "\n" . $spaces . " [$keyDisplay] => ";
self::dumpInternal($value, $level + 1);

70
framework/yii/log/EmailTarget.php

@ -7,6 +7,10 @@
namespace yii\log;
use Yii;
use yii\base\InvalidConfigException;
use yii\mail\MailerInterface;
/**
* EmailTarget sends selected log messages to the specified email addresses.
*
@ -20,51 +24,57 @@ namespace yii\log;
class EmailTarget extends Target
{
/**
* @var array list of destination email addresses.
*/
public $emails = [];
/**
* @var string email subject
* @var array the configuration array for creating a [[\yii\mail\MessageInterface|message]] object.
* Note that the "to" option must be set, which specifies the destination email address(es).
*/
public $subject;
public $message = [];
/**
* @var string email sent-from address
* @var MailerInterface|string the mailer object or the application component ID of the mailer object.
* After the EmailTarget object is created, if you want to change this property, you should only assign it
* with a mailer object.
*/
public $sentFrom;
public $mail = 'mail';
/**
* @var array list of additional headers to use when sending an email.
* @inheritdoc
*/
public $headers = [];
public function init()
{
parent::init();
if (empty($this->message['to'])) {
throw new InvalidConfigException('The "to" option must be set for EmailTarget::message.');
}
if (empty($this->message['subject'])) {
$this->message['subject'] = Yii::t('yii', 'Application Log');
}
if (is_string($this->mail)) {
$this->mail = Yii::$app->getComponent($this->mail);
}
if (!$this->mail instanceof MailerInterface) {
throw new InvalidConfigException("EmailTarget::mailer must be either a mailer object or the application component ID of a mailer object.");
}
}
/**
* Sends log messages to specified email addresses.
*/
public function export()
{
$body = '';
foreach ($this->messages as $message) {
$body .= $this->formatMessage($message);
}
$body = wordwrap($body, 70);
$subject = $this->subject === null ? \Yii::t('yii', 'Application Log') : $this->subject;
foreach ($this->emails as $email) {
$this->sendEmail($subject, $body, $email, $this->sentFrom, $this->headers);
}
$messages = array_map([$this, 'formatMessage'], $this->messages);
$body = wordwrap(implode("\n", $messages), 70);
$this->composeMessage($body)->send($this->mail);
}
/**
* Sends an email.
* @param string $subject email subject
* @param string $body email body
* @param string $sentTo sent-to email address
* @param string $sentFrom sent-from email address
* @param array $headers additional headers to be used when sending the email
* Composes a mail message with the given body content.
* @param string $body the body content
* @return \yii\mail\MessageInterface $message
*/
protected function sendEmail($subject, $body, $sentTo, $sentFrom, $headers)
protected function composeMessage($body)
{
if ($sentFrom !== null) {
$headers[] = "From: {$sentFrom}";
}
mail($sentTo, $subject, $body, implode("\r\n", $headers));
$message = $this->mail->compose();
Yii::configure($message, $this->message);
$message->setTextBody($body);
return $message;
}
}

2
framework/yii/log/Target.php

@ -233,6 +233,6 @@ abstract class Target extends Component
$text = var_export($text, true);
}
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
return date('Y/m/d H:i:s', $timestamp) . " [$ip] [$level] [$category] $text\n";
return date('Y/m/d H:i:s', $timestamp) . " [$ip] [$level] [$category] $text";
}
}

17
framework/yii/mail/BaseMessage.php

@ -26,19 +26,14 @@ use Yii;
abstract class BaseMessage extends Object implements MessageInterface
{
/**
* @return MailerInterface the mailer component
* @inheritdoc
*/
public function getMailer()
public function send(MailerInterface $mailer = null)
{
return Yii::$app->getComponent('mail');
}
/**
* {@inheritdoc}
*/
public function send()
{
return $this->getMailer()->send($this);
if ($mailer === null) {
$mailer = Yii::$app->getMail();
}
return $mailer->send($this);
}
/**

4
framework/yii/mail/MessageInterface.php

@ -204,9 +204,11 @@ interface MessageInterface
/**
* Sends this email message.
* @param MailerInterface $mailer the mailer that should be used to send this message.
* If null, the "mail" application component will be used instead.
* @return boolean whether this message is sent successfully.
*/
public function send();
public function send(MailerInterface $mailer = null);
/**
* Returns string representation of this message.

11
framework/yii/rbac/PhpManager.php

@ -33,13 +33,12 @@ class PhpManager extends Manager
{
/**
* @var string the path of the PHP script that contains the authorization data.
* If not set, it will be using 'protected/data/rbac.php' as the data file.
* Make sure this file is writable by the Web server process if the authorization
* needs to be changed.
* This can be either a file path or a path alias to the file.
* Make sure this file is writable by the Web server process if the authorization needs to be changed online.
* @see loadFromFile()
* @see saveToFile()
*/
public $authFile;
public $authFile = '@app/data/rbac.php';
private $_items = []; // itemName => item
private $_children = []; // itemName, childName => child
@ -53,9 +52,7 @@ class PhpManager extends Manager
public function init()
{
parent::init();
if ($this->authFile === null) {
$this->authFile = Yii::getAlias('@app/data/rbac') . '.php';
}
$this->authFile = Yii::getAlias($this->authFile);
$this->load();
}

2
framework/yii/validators/SafeValidator.php

@ -16,7 +16,7 @@ namespace yii\validators;
class SafeValidator extends Validator
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public function validateAttribute($object, $attribute)
{

2
framework/yii/validators/Validator.php

@ -159,7 +159,7 @@ abstract class Validator extends Component
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function init()
{

2
framework/yii/web/Controller.php

@ -86,7 +86,7 @@ class Controller extends \yii\base\Controller
}
/**
* {@inheritdoc}
* @inheritdoc
*/
public function beforeAction($action)
{

2
framework/yii/widgets/FragmentCache.php

@ -94,7 +94,7 @@ class FragmentCache extends Widget
/**
* Marks the end of content to be cached.
* Content displayed before this method call and after {@link init()}
* Content displayed before this method call and after [[init()]]
* will be captured and saved in cache.
* This method does nothing if valid content is already found in cache.
*/

2
framework/yii/widgets/ListView.php

@ -88,7 +88,7 @@ class ListView extends BaseListView
$options = $this->itemOptions;
$tag = ArrayHelper::remove($options, 'tag', 'div');
if ($tag !== false) {
$options['data-key'] = $key;
$options['data-key'] = is_array($key) ? json_encode($key) : $key;
return Html::tag($tag, $content, $options);
} else {
return $content;

4
phpunit.xml.dist

@ -11,7 +11,7 @@
</testsuite>
</testsuites>
<filter>
<blacklist>
<blacklist>
<file>framework/yii/helpers/Json.php</file>
<file>framework/yii/helpers/StringHelper.php</file>
<file>framework/yii/helpers/VarDumper.php</file>
@ -20,7 +20,7 @@
<file>framework/yii/helpers/FileHelper.php</file>
<file>framework/yii/helpers/ArrayHelper.php</file>
<file>framework/yii/helpers/Console.php</file>
<file>framework/yii/i18n/GettextFile.php</file>
<file>framework/yii/i18n/GettextFile.php</file>
<file>framework/yii/web/ResponseFormatterInterface.php</file>
<directory suffix="Exception.php">framework/yii/base</directory>
<directory suffix=".php">framework/yii/db/mssql</directory>

2
tests/unit/VendorTestCase.php

@ -27,4 +27,4 @@ class VendorTestCase extends TestCase
throw new NotSupportedException("Vendor autoload file '{$vendorAutoload}' is missing.");
}
}
}
}

2
tests/unit/extensions/sphinx/ActiveRecordTest.php

@ -79,10 +79,10 @@ class ActiveRecordTest extends SphinxTestCase
// asArray
$article = ArticleIndex::find()->where('id=2')->asArray()->one();
unset($article['add_date']);
$this->assertEquals([
'id' => '2',
'author_id' => '2',
'add_date' => '1384466400',
'tag' => '3,4',
], $article);

4
tests/unit/extensions/swiftmailer/MessageTest.php

@ -56,7 +56,9 @@ class MessageTest extends VendorTestCase
*/
protected function createTestEmailComponent()
{
$component = new Mailer();
$component = new Mailer([
'useFileTransport' => true,
]);
return $component;
}

2
tests/unit/framework/console/controllers/MessageControllerTest.php

@ -108,7 +108,7 @@ class MessageControllerTest extends TestCase
}
/**
* Creates message command config file at {@link configFileName}
* Creates message command config file named as [[configFileName]].
* @param array $config message command config.
*/
protected function composeConfigFile(array $config)

2
tests/unit/framework/db/sqlite/SqliteCommandTest.php

@ -17,6 +17,6 @@ class SqliteCommandTest extends CommandTest
$sql = 'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t';
$command = $db->createCommand($sql);
$this->assertEquals("SELECT \"id\", 't'.\"name\" FROM 'tbl_customer' t", $command->sql);
$this->assertEquals("SELECT `id`, `t`.`name` FROM `tbl_customer` t", $command->sql);
}
}

8
tests/unit/framework/db/sqlite/SqliteConnectionTest.php

@ -30,8 +30,8 @@ class SqliteConnectionTest extends ConnectionTest
public function testQuoteTableName()
{
$connection = $this->getConnection(false);
$this->assertEquals("'table'", $connection->quoteTableName('table'));
$this->assertEquals("'schema'.'table'", $connection->quoteTableName('schema.table'));
$this->assertEquals("`table`", $connection->quoteTableName('table'));
$this->assertEquals("`schema`.`table`", $connection->quoteTableName('schema.table'));
$this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}'));
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}
@ -39,8 +39,8 @@ class SqliteConnectionTest extends ConnectionTest
public function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$this->assertEquals('"column"', $connection->quoteColumnName('column'));
$this->assertEquals("'table'.\"column\"", $connection->quoteColumnName('table.column'));
$this->assertEquals('`column`', $connection->quoteColumnName('column'));
$this->assertEquals("`table`.`column`", $connection->quoteColumnName('table.column'));
$this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]'));
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)'));

2
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php

@ -85,6 +85,6 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
public function testBatchInsert()
{
$sql = $this->getQueryBuilder()->batchInsert('{{tbl_customer}} t', ['t.id','t.name'], array(array(1,'a'), array(2,'b')));
$this->assertEquals("INSERT INTO {{tbl_customer}} t ('t'.\"id\", 't'.\"name\") SELECT 1, 'a' UNION ALL 2, 'b'", $sql);
$this->assertEquals("INSERT INTO {{tbl_customer}} t (`t`.`id`, `t`.`name`) SELECT 1, 'a' UNION ALL 2, 'b'", $sql);
}
}

9
tests/unit/framework/mail/BaseMessageTest.php

@ -40,18 +40,11 @@ class BaseMessageTest extends TestCase
// Tests :
public function testGetMailer()
{
$mailer = $this->getMailer();
$message = $mailer->compose();
$this->assertEquals($mailer, $message->getMailer());
}
public function testSend()
{
$mailer = $this->getMailer();
$message = $mailer->compose();
$message->send();
$message->send($mailer);
$this->assertEquals($message, $mailer->sentMessages[0], 'Unable to send message!');
}

4
tests/unit/framework/validators/UniqueValidatorTest.php

@ -80,9 +80,9 @@ class UniqueValidatorTest extends DatabaseTestCase
public function testValidateAttributeAttributeNotInTableException()
{
$this->setExpectedException('yii\base\InvalidConfigException');
$this->setExpectedException('yii\db\Exception');
$val = new UniqueValidator();
$m = new ValidatorTestMainModel();
$val->validateAttribute($m, 'testMainVal');
}
}
}

Loading…
Cancel
Save