Commit dee3f0f6 by Qiang Xue

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

parents f184d824 b6189203
...@@ -3,7 +3,6 @@ use yii\helpers\Html; ...@@ -3,7 +3,6 @@ use yii\helpers\Html;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
* @var \yii\mail\MessageInterface $message
* @var string $content * @var string $content
*/ */
?> ?>
...@@ -11,7 +10,7 @@ use yii\helpers\Html; ...@@ -11,7 +10,7 @@ use yii\helpers\Html;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= $message->getCharset() ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
......
...@@ -3,7 +3,6 @@ use yii\helpers\Html; ...@@ -3,7 +3,6 @@ use yii\helpers\Html;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
* @var \yii\mail\MessageInterface $message
* @var string $content * @var string $content
*/ */
?> ?>
...@@ -11,7 +10,7 @@ use yii\helpers\Html; ...@@ -11,7 +10,7 @@ use yii\helpers\Html;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= $message->getCharset() ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
......
...@@ -142,7 +142,6 @@ use yii\helpers\Html; ...@@ -142,7 +142,6 @@ use yii\helpers\Html;
/** /**
* @var \yii\web\View $this view component instance * @var \yii\web\View $this view component instance
* @var \yii\mail\BaseMessage $message instance of newly created mail message
* @var string $content main view render result * @var string $content main view render result
*/ */
?> ?>
...@@ -150,7 +149,7 @@ use yii\helpers\Html; ...@@ -150,7 +149,7 @@ use yii\helpers\Html;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= $message->getCharset() ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
<style type="text/css"> <style type="text/css">
.heading {...} .heading {...}
.list {...} .list {...}
......
...@@ -38,6 +38,7 @@ Yii Framework 2 Change Log ...@@ -38,6 +38,7 @@ Yii Framework 2 Change Log
- Bug #3601: Fixed the bug that the refresh URL was not generated correctly by `Captcha` (qiangxue, klevron) - Bug #3601: Fixed the bug that the refresh URL was not generated correctly by `Captcha` (qiangxue, klevron)
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark) - Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
- Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul) - Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul)
- Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue)
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue) - Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark) - Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark)
- Enh #2837: Error page now shows arguments in stack trace method calls (samdark) - Enh #2837: Error page now shows arguments in stack trace method calls (samdark)
...@@ -63,6 +64,7 @@ Yii Framework 2 Change Log ...@@ -63,6 +64,7 @@ Yii Framework 2 Change Log
- Enh #3562: Adding rotateByCopy to yii\log\FileTarget (pawzar) - Enh #3562: Adding rotateByCopy to yii\log\FileTarget (pawzar)
- Enh #3574: Add integrity check support for SQLite (zeeke) - Enh #3574: Add integrity check support for SQLite (zeeke)
- Enh #3597: Nested array support for HTML5 custom "data-*" attributes (armab) - Enh #3597: Nested array support for HTML5 custom "data-*" attributes (armab)
- Enh #3607: Added support for limit in migrations actions: history, new, redo (Ragazzo)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue) - Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue) - Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
- Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue) - Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue)
......
...@@ -216,7 +216,7 @@ class Controller extends Component implements ViewContextInterface ...@@ -216,7 +216,7 @@ class Controller extends Component implements ViewContextInterface
$methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))); $methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id))));
if (method_exists($this, $methodName)) { if (method_exists($this, $methodName)) {
$method = new \ReflectionMethod($this, $methodName); $method = new \ReflectionMethod($this, $methodName);
if ($method->getName() === $methodName) { if ($method->isPublic() && $method->getName() === $methodName) {
return new InlineAction($id, $this, $methodName); return new InlineAction($id, $this, $methodName);
} }
} }
......
...@@ -214,11 +214,13 @@ class MigrateController extends Controller ...@@ -214,11 +214,13 @@ class MigrateController extends Controller
} }
$migrations = $this->getMigrationHistory($limit); $migrations = $this->getMigrationHistory($limit);
if (empty($migrations)) { if (empty($migrations)) {
echo "No migration has been done before.\n"; echo "No migration has been done before.\n";
return self::EXIT_CODE_NORMAL; return self::EXIT_CODE_NORMAL;
} }
$migrations = array_keys($migrations); $migrations = array_keys($migrations);
$n = count($migrations); $n = count($migrations);
...@@ -249,6 +251,7 @@ class MigrateController extends Controller ...@@ -249,6 +251,7 @@ class MigrateController extends Controller
* ~~~ * ~~~
* yii migrate/redo # redo the last applied migration * yii migrate/redo # redo the last applied migration
* yii migrate/redo 3 # redo the last 3 applied migrations * yii migrate/redo 3 # redo the last 3 applied migrations
* yii migrate/redo all # redo all migrations
* ~~~ * ~~~
* *
* @param integer $limit the number of migrations to be redone. Defaults to 1, * @param integer $limit the number of migrations to be redone. Defaults to 1,
...@@ -259,17 +262,23 @@ class MigrateController extends Controller ...@@ -259,17 +262,23 @@ class MigrateController extends Controller
*/ */
public function actionRedo($limit = 1) public function actionRedo($limit = 1)
{ {
$limit = (int) $limit; if ($limit === 'all') {
if ($limit < 1) { $limit = null;
throw new Exception("The step argument must be greater than 0."); } else {
$limit = (int) $limit;
if ($limit < 1) {
throw new Exception("The step argument must be greater than 0.");
}
} }
$migrations = $this->getMigrationHistory($limit); $migrations = $this->getMigrationHistory($limit);
if (empty($migrations)) { if (empty($migrations)) {
echo "No migration has been done before.\n"; echo "No migration has been done before.\n";
return self::EXIT_CODE_NORMAL; return self::EXIT_CODE_NORMAL;
} }
$migrations = array_keys($migrations); $migrations = array_keys($migrations);
$n = count($migrations); $n = count($migrations);
...@@ -410,7 +419,7 @@ class MigrateController extends Controller ...@@ -410,7 +419,7 @@ class MigrateController extends Controller
* ~~~ * ~~~
* yii migrate/history # showing the last 10 migrations * yii migrate/history # showing the last 10 migrations
* yii migrate/history 5 # showing the last 5 migrations * yii migrate/history 5 # showing the last 5 migrations
* yii migrate/history 0 # showing the whole history * yii migrate/history all # showing the whole history
* ~~~ * ~~~
* *
* @param integer $limit the maximum number of migrations to be displayed. * @param integer $limit the maximum number of migrations to be displayed.
...@@ -418,8 +427,17 @@ class MigrateController extends Controller ...@@ -418,8 +427,17 @@ class MigrateController extends Controller
*/ */
public function actionHistory($limit = 10) public function actionHistory($limit = 10)
{ {
$limit = (int) $limit; if ($limit === 'all') {
$limit = null;
} else {
$limit = (int) $limit;
if ($limit < 1) {
throw new Exception("The step argument must be greater than 0.");
}
}
$migrations = $this->getMigrationHistory($limit); $migrations = $this->getMigrationHistory($limit);
if (empty($migrations)) { if (empty($migrations)) {
echo "No migration has been done before.\n"; echo "No migration has been done before.\n";
} else { } else {
...@@ -444,7 +462,7 @@ class MigrateController extends Controller ...@@ -444,7 +462,7 @@ class MigrateController extends Controller
* ~~~ * ~~~
* yii migrate/new # showing the first 10 new migrations * yii migrate/new # showing the first 10 new migrations
* yii migrate/new 5 # showing the first 5 new migrations * yii migrate/new 5 # showing the first 5 new migrations
* yii migrate/new 0 # showing all new migrations * yii migrate/new all # showing all new migrations
* ~~~ * ~~~
* *
* @param integer $limit the maximum number of new migrations to be displayed. * @param integer $limit the maximum number of new migrations to be displayed.
...@@ -452,13 +470,22 @@ class MigrateController extends Controller ...@@ -452,13 +470,22 @@ class MigrateController extends Controller
*/ */
public function actionNew($limit = 10) public function actionNew($limit = 10)
{ {
$limit = (int) $limit; if ($limit === 'all') {
$limit = null;
} else {
$limit = (int) $limit;
if ($limit < 1) {
throw new Exception("The step argument must be greater than 0.");
}
}
$migrations = $this->getNewMigrations(); $migrations = $this->getNewMigrations();
if (empty($migrations)) { if (empty($migrations)) {
echo "No new migrations found. Your system is up-to-date.\n"; echo "No new migrations found. Your system is up-to-date.\n";
} else { } else {
$n = count($migrations); $n = count($migrations);
if ($limit > 0 && $n > $limit) { if ($limit && $n > $limit) {
$migrations = array_slice($migrations, 0, $limit); $migrations = array_slice($migrations, 0, $limit);
echo "Showing $limit out of $n new " . ($n === 1 ? 'migration' : 'migrations') . ":\n"; echo "Showing $limit out of $n new " . ($n === 1 ? 'migration' : 'migrations') . ":\n";
} else { } else {
......
...@@ -35,7 +35,7 @@ return [ ...@@ -35,7 +35,7 @@ return [
'Page not found.' => 'Pagina non trovata', 'Page not found.' => 'Pagina non trovata',
'Please fix the following errors:' => 'Per favore correggi i seguenti errori:', 'Please fix the following errors:' => 'Per favore correggi i seguenti errori:',
'Please upload a file.' => 'Per favore carica il file.', 'Please upload a file.' => 'Per favore carica il file.',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => 'Mostro <b>{begin, number}-{end, number}</b> di <b>{totalCount, number}</b> {totalCount, plural, one{elemento} other{elementi}}.', 'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => 'Visualizzo <b>{begin, number}-{end, number}</b> di <b>{totalCount, number}</b> {totalCount, plural, one{elemento} other{elementi}}.',
'The file "{file}" is not an image.' => 'Questo file "{file}" non è una immagine.', 'The file "{file}" is not an image.' => 'Questo file "{file}" non è una immagine.',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Il file "{file}"è troppo grande. La dimensione non può superare {limit, number} {limit, plural, one{byte} other{bytes}}.', 'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Il file "{file}"è troppo grande. La dimensione non può superare {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Il file "{file}" è troppo piccollo. La dimensione non può essere più piccola di {limit, number} {limit, plural, one{byte} other{bytes}}.', 'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Il file "{file}" è troppo piccollo. La dimensione non può essere più piccola di {limit, number} {limit, plural, one{byte} other{bytes}}.',
......
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