Skip to content

Commit 96a6d4d

Browse files
authored
Merge branch 'master' into transaction
2 parents e67cebb + b453773 commit 96a6d4d

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Yii Framework 2 mongodb extension Change Log
44
2.1.10 under development
55
------------------------
66

7-
- Enh #294: Add transactions support (ziaratban)
7+
- Enh #294: transactions support (ziaratban)
8+
- Bug #308: Fix `yii\mongodb\file\Upload::addFile()` error when uploading file with readonly permissions (sparchatus)
9+
810

911

1012
2.1.9 November 19, 2019

docs/guide-ja/topics-migrations.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,26 @@ yii mongodb-migrate
3030
# 最後に適用されたマイグレーションを取り消す
3131
yii mongodb-migrate/down
3232
```
33+
## 二つ以上の DB エンジンを使用するアプリケーションのための特殊な構成
34+
35+
アプリケーションが複数のデータベースを使う場合の例です。
36+
37+
- MySQL + MongoDB
38+
39+
マイグレーション・コマンドを実行すると、同時に MySQL と MongoDB の両方のマイグレーション・ファイルが対象として扱われます。これは両者が既定では同じフォルダを共有するためです。
40+
41+
**問題: MongoDB が MySQL のマイグレーション・ファイルを実行しようとし、MySQL が MongoDB のマイグレーション・ファイルを実行しようとする。**
42+
43+
この問題を回避するためには、`migrations` フォルダの下に `mongodb` という新しいフォルダを作って、コンソール・アプリケーションを次のようにセットアップすることが出来ます。
44+
45+
```php
46+
return [
47+
// ...
48+
'controllerMap' => [
49+
'mongodb-migrate' => [
50+
'class' => 'yii\mongodb\console\controllers\MigrateController',
51+
'migrationPath' => '@app/migrations/mongodb',
52+
],
53+
],
54+
];
55+
```

src/file/Upload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function addFile($filename)
178178
$this->filename = basename($filename);
179179
}
180180

181-
$stream = fopen($filename, 'r+');
181+
$stream = fopen($filename, 'r');
182182
if ($stream === false) {
183183
throw new InvalidParamException("Unable to read file '{$filename}'");
184184
}
@@ -277,4 +277,4 @@ private function insertFile()
277277
$this->collection->insert($fileDocument);
278278
return $fileDocument;
279279
}
280-
}
280+
}

0 commit comments

Comments
 (0)