diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index a80b4aae8d7..68ee5461eb7 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -10,6 +10,7 @@ use Yii; use yii\base\Exception; use yii\console\Controller; +use yii\helpers\ArrayHelper; /** * ReleaseController is there to help preparing releases @@ -25,49 +26,54 @@ class ReleaseController extends Controller * Usage: * * ``` - * ./build/build release/prepare 2.0.0-beta + * ./build/build release/prepare framework 2.0.0-beta + * ./build/build release/prepare redis 2.0.0-beta * ``` * */ - public function actionPrepare($version) + public function actionPrepare(array $what, $version) { - $this->resortChangelogs($version); - $this->mergeChangelogs($version); - $this->closeChangelogs($version); - $this->composerSetStability($version); - $this->updateYiiVersion($version); + $this->resortChangelogs($what, $version); + $this->closeChangelogs($what, $version); + $this->composerSetStability($what, $version); + if (in_array('framework', $what)) { + $this->updateYiiVersion($version); + } } /** * Usage: * * ``` - * ./build/build release/done 2.0.0-dev 2.0.0-rc + * ./build/build release/done framework 2.0.0-dev 2.0.0-rc + * ./build/build release/done redis 2.0.0-dev 2.0.0-rc * ``` */ - public function actionDone($devVersion, $nextVersion) + public function actionDone(array $what, $devVersion, $nextVersion) { - $this->openChangelogs($nextVersion); - $this->composerSetStability('dev'); - $this->updateYiiVersion($devVersion); + $this->openChangelogs($what, $nextVersion); + $this->composerSetStability($what, 'dev'); + if (in_array('framework', $what)) { + $this->updateYiiVersion($devVersion); + } } - protected function closeChangelogs($version) + protected function closeChangelogs($what, $version) { $v = str_replace('\\-', '[\\- ]', preg_quote($version, '/')); $headline = $version . ' ' . date('F d, Y'); $this->sed( '/'.$v.' under development\n(-+?)\n/', $headline . "\n" . str_repeat('-', strlen($headline)) . "\n", - $this->getChangelogs() + $this->getChangelogs($what) ); } - protected function openChangelogs($version) + protected function openChangelogs($what, $version) { $headline = "\n$version under development\n"; $headline .= str_repeat('-', strlen($headline) - 2) . "\n\n"; - foreach($this->getChangelogs() as $file) { + foreach($this->getChangelogs($what) as $file) { $lines = explode("\n", file_get_contents($file)); $hl = [ array_shift($lines), @@ -79,9 +85,9 @@ protected function openChangelogs($version) } } - protected function resortChangelogs($version) + protected function resortChangelogs($what, $version) { - foreach($this->getChangelogs() as $file) { + foreach($this->getChangelogs($what) as $file) { // split the file into relevant parts list($start, $changelog, $end) = $this->splitChangelog($file, $version); $changelog = $this->resortChangelog($changelog); @@ -89,31 +95,6 @@ protected function resortChangelogs($version) } } - protected function mergeChangelogs($version) - { - $file = $this->getFrameworkChangelog(); - // split the file into relevant parts - list($start, $changelog, $end) = $this->splitChangelog($file, $version); - - $changelog = $this->resortChangelog($changelog); - - $changelog[] = ''; - $extensions = $this->getExtensionChangelogs(); - asort($extensions); - foreach($extensions as $changelogFile) { - if (!preg_match('~extensions/([a-z]+)/CHANGELOG\\.md~', $changelogFile, $m)) { - throw new Exception("Illegal extension changelog file: " . $changelogFile); - } - list( , $extensionChangelog, ) = $this->splitChangelog($changelogFile, $version); - $name = $m[1]; - $ucname = ucfirst($name); - $changelog[] = "### $ucname Extension (yii2-$name)"; - $changelog = array_merge($changelog, $extensionChangelog); - } - - file_put_contents($file, implode("\n", array_merge($start, $changelog, $end))); - } - /** * Extract changelog content for a specific version */ @@ -150,14 +131,34 @@ protected function resortChangelog($changelog) foreach($changelog as $i => $line) { $changelog[$i] = rtrim($line); } + $changelog = array_filter($changelog); + + $i = 0; + ArrayHelper::multisort($changelog, function($line) use (&$i) { + if (preg_match('/^- (Chg|Enh|Bug)( #\d+(, #\d+)*)?: .+$/', $line, $m)) { + $o = ['Bug' => 'C', 'Enh' => 'D', 'Chg' => 'E']; + print_r($m); + return $o[$m[1]] . ' ' . (!empty($m[2]) ? $m[2] : 'AAAA' . $i++); + } + return 'B' . $i++; + }, SORT_ASC, SORT_NATURAL); + + // re-add leading and trailing lines + array_unshift($changelog, ''); + $changelog[] = ''; + $changelog[] = ''; - // TODO sorting return $changelog; } - protected function getChangelogs() + protected function getChangelogs($what) { - return array_merge([$this->getFrameworkChangelog()], $this->getExtensionChangelogs()); + $changelogs = []; + if (in_array('framework', $what)) { + $changelogs[] = $this->getFrameworkChangelog(); + } + + return array_merge($changelogs, $this->getExtensionChangelogs($what)); } protected function getFrameworkChangelog() @@ -165,13 +166,34 @@ protected function getFrameworkChangelog() return YII2_PATH . '/CHANGELOG.md'; } - protected function getExtensionChangelogs() + protected function getExtensionChangelogs($what) { - return glob(dirname(YII2_PATH) . '/extensions/*/CHANGELOG.md'); + return array_filter(glob(dirname(YII2_PATH) . '/extensions/*/CHANGELOG.md'), function($elem) use ($what) { + foreach($what as $ext) { + if (strpos($elem, "extensions/$ext/CHANGELOG.md") !== false) { + return true; + } + } + return false; + }); } - protected function composerSetStability($version) + protected function composerSetStability($what, $version) { + $apps = []; + if (in_array('app-advanced', $what)) { + $apps[] = dirname(YII2_PATH) . '/apps/advanced/composer.json'; + } + if (in_array('app-basic', $what)) { + $apps[] = dirname(YII2_PATH) . '/apps/basic/composer.json'; + } + if (in_array('app-benchmark', $what)) { + $apps[] = dirname(YII2_PATH) . '/apps/benchmark/composer.json'; + } + if (empty($apps)) { + return; + } + $stability = 'stable'; if (strpos($version, 'alpha') !== false) { $stability = 'alpha'; @@ -186,11 +208,7 @@ protected function composerSetStability($version) $this->sed( '/"minimum-stability": "(.+?)",/', '"minimum-stability": "' . $stability . '",', - [ - dirname(YII2_PATH) . '/apps/advanced/composer.json', - dirname(YII2_PATH) . '/apps/basic/composer.json', - dirname(YII2_PATH) . '/apps/benchmark/composer.json', - ] + $apps ); } diff --git a/framework/BaseYii.php b/framework/BaseYii.php index 77c9861df13..65a5c827766 100644 --- a/framework/BaseYii.php +++ b/framework/BaseYii.php @@ -93,7 +93,7 @@ class BaseYii */ public static function getVersion() { - return '2.0.6-dev'; + return '2.0.6'; } /** diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index b48f788fca8..b5f40a3be86 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -1,8 +1,8 @@ Yii Framework 2 Change Log ========================== -2.0.6 under development ------------------------ +2.0.6 August 05, 2015 +--------------------- - Bug #4763: Fixed display issue with overlapping call stack item on exception display page (cebe) - Bug #7305: Logging of Exception objects resulted in failure of the logger i.e. no logs being written (cebe) @@ -15,12 +15,12 @@ Yii Framework 2 Change Log - Bug #8483: Sequence name in `Schema::getLastInsertId()` was not properly quoted (nineinchnick) - Bug #8506: Cleaning of output buffer in `Widget::run()` conflicts with `Pjax` widget which did the cleanup itself (cebe, joester89) - Bug #8544: Fixed `yii\db\ActiveRecord` does not update attribute specified at `optimisticLock()` after save (klimov-paul) -- Bug #8551: `yii\pgsql\QueryBuilder::batchInsert()` may cause "undefined index" error (arkhamvm) +- Bug #8549: Fixed `yii\caching\FileCache` doesn't lock cache files when reading (iworker) +- Bug #8551: `yii\pgsql\QueryBuilder::batchInsert()` may cause "undefined index" error (arkhamvm) - Bug #8585: Fixed `yii\helpers\Html::activeTextarea()` does not allow value overriding via options (klimov-paul) - Bug #8592: Fixed `yii\db\Command::getRawSql()` unable to parse params specified without colon (':') (klimov-paul) - Bug #8593: Fixed `yii\db\ActiveQuery` produces incorrect SQL for aggregations, when `sql` field is set (klimov-paul) - Bug #8595: Fixed `yii\rbac\DbManager::checkAccessFromCache()` to check against auth items loaded in cache recursively (achretien, qiangxue) -- Bug #8549: Fixed `yii\caching\FileCache` doesn't lock cache files when reading (iworker) - Bug #8606: Fixed `yii\web\Response::xSendFile()` does not reset format (vyants) - Bug #8627: Fixed `yii\db\Migration` produces incorrect results due to table schema caching (klimov-paul) - Bug #8661: Fixed `yii.activeForm.js` scrolling to top (nkovacs) @@ -48,7 +48,7 @@ Yii Framework 2 Change Log - Enh #7259: Added `errorAttributes` parameter to ActiveForm `afterValidate` event. Made scrolling to first error optional (nkovacs) - Enh #8070: `yii\console\controllers\MessageController` now sorts created messages, even if there is no new one, while saving to PHP file (klimov-paul) - Enh #8286: `yii\console\controllers\MessageController` improved allowing extraction of nested translator calls (klimov-paul) -- Ehn #8373: Check also `post_max_size` parameter in `yii\validators\FileValidator::getSizeLimit()` (maxxer) +- Enh #8373: Check also `post_max_size` parameter in `yii\validators\FileValidator::getSizeLimit()` (maxxer) - Enh #8415: `yii\helpers\Html` allows correct rendering of conditional comments containing `!IE` (salaros, klimov-paul) - Enh #8444: Added `yii\widgets\LinkPager::$linkOptions` to allow configuring HTML attributes of the `a` tags (zinzinday) - Enh #8486: Added support to automatically set the `maxlength` attribute for `Html::activeTextArea()` and `Html::activePassword()` (klimov-paul) diff --git a/framework/classes.php b/framework/classes.php index f8364cd35d4..135a9d73ee3 100644 --- a/framework/classes.php +++ b/framework/classes.php @@ -95,6 +95,7 @@ 'yii\db\BaseActiveRecord' => YII2_PATH . '/db/BaseActiveRecord.php', 'yii\db\BatchQueryResult' => YII2_PATH . '/db/BatchQueryResult.php', 'yii\db\ColumnSchema' => YII2_PATH . '/db/ColumnSchema.php', + 'yii\db\ColumnSchemaBuilder' => YII2_PATH . '/db/ColumnSchemaBuilder.php', 'yii\db\Command' => YII2_PATH . '/db/Command.php', 'yii\db\Connection' => YII2_PATH . '/db/Connection.php', 'yii\db\DataReader' => YII2_PATH . '/db/DataReader.php', @@ -108,6 +109,7 @@ 'yii\db\QueryInterface' => YII2_PATH . '/db/QueryInterface.php', 'yii\db\QueryTrait' => YII2_PATH . '/db/QueryTrait.php', 'yii\db\Schema' => YII2_PATH . '/db/Schema.php', + 'yii\db\SchemaBuilderTrait' => YII2_PATH . '/db/SchemaBuilderTrait.php', 'yii\db\StaleObjectException' => YII2_PATH . '/db/StaleObjectException.php', 'yii\db\TableSchema' => YII2_PATH . '/db/TableSchema.php', 'yii\db\Transaction' => YII2_PATH . '/db/Transaction.php', @@ -120,6 +122,7 @@ 'yii\db\mssql\TableSchema' => YII2_PATH . '/db/mssql/TableSchema.php', 'yii\db\mysql\QueryBuilder' => YII2_PATH . '/db/mysql/QueryBuilder.php', 'yii\db\mysql\Schema' => YII2_PATH . '/db/mysql/Schema.php', + 'yii\db\oci\ColumnSchemaBuilder' => YII2_PATH . '/db/oci/ColumnSchemaBuilder.php', 'yii\db\oci\QueryBuilder' => YII2_PATH . '/db/oci/QueryBuilder.php', 'yii\db\oci\Schema' => YII2_PATH . '/db/oci/Schema.php', 'yii\db\pgsql\QueryBuilder' => YII2_PATH . '/db/pgsql/QueryBuilder.php', @@ -280,6 +283,7 @@ 'yii\web\Link' => YII2_PATH . '/web/Link.php', 'yii\web\Linkable' => YII2_PATH . '/web/Linkable.php', 'yii\web\MethodNotAllowedHttpException' => YII2_PATH . '/web/MethodNotAllowedHttpException.php', + 'yii\web\MultiFieldSession' => YII2_PATH . '/web/MultiFieldSession.php', 'yii\web\NotAcceptableHttpException' => YII2_PATH . '/web/NotAcceptableHttpException.php', 'yii\web\NotFoundHttpException' => YII2_PATH . '/web/NotFoundHttpException.php', 'yii\web\Request' => YII2_PATH . '/web/Request.php',