Browse Source

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

tags/2.0.10
Klimov Paul 8 years ago
parent
commit
1b14f837ff
  1. 7
      docs/documentation_style_guide.md
  2. 4
      docs/guide-ru/db-active-record.md
  3. 2
      docs/guide-ru/db-query-builder.md
  4. 3
      framework/CHANGELOG.md
  5. 2
      framework/db/mysql/QueryBuilder.php
  6. 16
      framework/mutex/FileMutex.php
  7. 15
      tests/framework/mutex/FileMutexTest.php

7
docs/documentation_style_guide.md

@ -11,13 +11,16 @@ Guidelines to go by when writing or editing any Yii documentation.
* Demonstrate ideas using code as much as possible.
* Never use "we". It's the Yii development team or the Yii core team. Better yet to put things in terms of the framework or the guide.
* Use the Oxford comma (e.g., "this, that, and the other" not "this, that and the other").
* Numeric lists should be complete sentences that end with periods (or other punctuation).
* Bullet lists should be fragments that don't end with periods.
## Formatting
* Use *italics* for emphasis, never capitalization, bold, or underlines.
## Lists
* Numeric lists should be complete sentences that end with periods.
* Bullet lists should be fragments that end with semicolon except the last item, which should end with a period.
## Blocks
Blocks use the Markdown `> Type: `. There are four block types:

4
docs/guide-ru/db-active-record.md

@ -808,7 +808,7 @@ $orders = $customer->orders;
Если связь объявлена с помощью метода [[yii\db\ActiveRecord::hasMany()|hasMany()]], доступ к свойству связи вернёт
массив связных объектов Active Record; если связь объявлена с помощью метода [[yii\db\ActiveRecord::hasOne()|hasOne()]],
доступ к свойству связи вернёт связный Active Record объект или null, если связные данные не найдены.
доступ к свойству связи вернёт связный Active Record объект или `null`, если связные данные не найдены.
Когда вы запрашиваете свойство связи в первый раз, выполняется SQL-выражение как показано в примере выше. Если то же
самое свойство запрашивается вновь, будет возвращён результат предыдущего SQL-запроса без повторного выполнения
@ -1275,7 +1275,7 @@ $customer->unlink('orders', $customer->orders[0]);
```
По умолчанию метод [[yii\db\ActiveRecord::unlink()|unlink()]] задаст вторичному ключу (или ключам), который определяет
существующую связь, значение null. Однако вы можете запросить удаление строки таблицы, которая содержит значение
существующую связь, значение `null`. Однако вы можете запросить удаление строки таблицы, которая содержит значение
вторичного ключа, передав значение true в параметре `$delete` для этого метода.
Если связь построена на основе промежуточной таблицы, вызов метода [[yii\db\ActiveRecord::unlink()|unlink()]] инициирует

2
docs/guide-ru/db-query-builder.md

@ -200,7 +200,7 @@ $query->where([
]);
```
Как вы можете видеть, построитель запросов достаточно умен, чтобы правильно обрабатывать значения NULL или массивов.
Как вы можете видеть, построитель запросов достаточно умен, чтобы правильно обрабатывать значения `null` или массивов.
Вы также можете использовать подзапросы:

3
framework/CHANGELOG.md

@ -3,7 +3,7 @@ Yii Framework 2 Change Log
2.0.10 under development
------------------------
- Bug #12428: Fixed `yii\db\mysql\QueryBuilder` causes warning when insert default rows into a table without primary key (DrmagicE)
- Enh #9989: ActiveForm now respects formtarget, formmethod and formenctype attributes of submit button (AnatolyRugalev)
- Enh #12296: Added value validation to `yii\log\Target::setLevels()` (Mak-Di)
- Enh #12073: Added the ability to suppress the generation of input hint when it is specified through `Model::attributeHints()` (PowerGamer1)
@ -51,6 +51,7 @@ Yii Framework 2 Change Log
- Bug #12331: Fixed bug with incorrect currency formatter output, when `$thousandSeparator` was explicitly set (cebe)
- Bug #11347: Fixed `yii\widgets\Pjax::registerClientScript()` to pass custom `container` to the PJAX JS plugin (silverfire)
- Bug #12293: Fixed MSSQL `Schema::resolveTableNames()` when using linked database tables (hAppywAy)
- Bug #12431: Fix bug when lock file was not removed after `yii\mutex\FileMutex::release()` (rob006)
- Enh: Method `yii\console\controllers\AssetController::getAssetManager()` automatically enables `yii\web\AssetManager::forceCopy` in case it is not explicitly specified (pana1990, klimov-paul)
- Enh #12382: Changed `yii\widgets\MaskedInput` to use `jQuery` instead of `$` to prevent conflicts (samdark)

2
framework/db/mysql/QueryBuilder.php

@ -209,7 +209,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
}
if (empty($names) && $tableSchema !== null) {
$columns = !empty($tableSchema->primaryKey) ? $tableSchema->primaryKey : reset($tableSchema->columns)->name;
$columns = !empty($tableSchema->primaryKey) ? $tableSchema->primaryKey : [reset($tableSchema->columns)->name];
foreach ($columns as $name) {
$names[] = $schema->quoteColumnName($name);
$placeholders[] = 'DEFAULT';

16
framework/mutex/FileMutex.php

@ -89,13 +89,12 @@ class FileMutex extends Mutex
*/
protected function acquireLock($name, $timeout = 0)
{
$fileName = $this->mutexPath . '/' . md5($name) . '.lock';
$file = fopen($fileName, 'w+');
$file = fopen($this->getLockFilePath($name), 'w+');
if ($file === false) {
return false;
}
if ($this->fileMode !== null) {
@chmod($fileName, $this->fileMode);
@chmod($this->getLockFilePath($name), $this->fileMode);
}
$waitTime = 0;
while (!flock($file, LOCK_EX | LOCK_NB)) {
@ -123,9 +122,20 @@ class FileMutex extends Mutex
return false;
} else {
fclose($this->_files[$name]);
unlink($this->getLockFilePath($name));
unset($this->_files[$name]);
return true;
}
}
/**
* Generate path for lock file.
* @param string $name
* @return string
* @since 2.0.10
*/
protected function getLockFilePath($name) {
return $this->mutexPath . '/' . md5($name) . '.lock';
}
}

15
tests/framework/mutex/FileMutexTest.php

@ -9,13 +9,13 @@ use yiiunit\TestCase;
* Class FileMutexTest
*
* @group mutex
*
*
* @package yii\tests\unit\framework\mutex
*/
class FileMutexTest extends TestCase
{
use MutexTestTrait;
protected function setUp() {
parent::setUp();
if (DIRECTORY_SEPARATOR === '\\') {
@ -34,4 +34,15 @@ class FileMutexTest extends TestCase
]);
}
public function testDeleteLockFile()
{
$mutex = $this->createMutex();
$fileName = $mutex->mutexPath . '/' . md5(self::$mutexName) . '.lock';
$mutex->acquire(self::$mutexName);
$this->assertFileExists($fileName);
$mutex->release(self::$mutexName);
$this->assertFileNotExists($fileName);
}
}

Loading…
Cancel
Save