From 429a9319c7e7ea3deef289b61a472e676c4fe68e Mon Sep 17 00:00:00 2001 From: Basil Date: Tue, 6 Oct 2020 15:29:25 +0200 Subject: [PATCH 1/3] use mysql mutex lock mechanism --- src/Module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module.php b/src/Module.php index 8a5e96913c..2d9404e2ea 100644 --- a/src/Module.php +++ b/src/Module.php @@ -550,7 +550,7 @@ public function registerComponents() 'adminqueue' => [ 'class' => 'yii\queue\db\Queue', 'db' => 'db', - 'mutex' => 'yii\mutex\FileMutex', + 'mutex' => 'yii\mutex\MysqlMutex', 'tableName' => 'admin_queue', 'channel' => 'default', 'as log' => 'luya\admin\behaviors\QueueLogBehavior', From 393cf1bfd7dc6b5db82ee1991e4a20cd31854341 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Tue, 6 Oct 2020 14:46:11 +0000 Subject: [PATCH 2/3] add changelog, upgrade and udpate test cases --- CHANGELOG.md | 1 + UPGRADE.md | 11 +++++++++++ src/Module.php | 9 ++++++++- tests/AdminConsoleSqLiteTestCase.php | 1 + tests/AdminModelTestCase.php | 1 + tests/NgRestTestCase.php | 1 + tests/data/configs/admin.php | 1 + tests/data/configs/console.php | 1 + 8 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 872a349105..881b08034b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE ## 3.7.0 ++ [#576](https://github.com/luyadev/luya-module-admin/pull/576) Use `MysqlMutex` as default Mutex class for the Admin Queue instead of `FileMutex` due to people have problems with file permissiosn when running the queue in cli mode. MysqlMutex is also the better approach when multiple works might run on different workloads. + [#575](https://github.com/luyadev/luya-module-admin/pull/575) New hungarian language option. + [#574](https://github.com/luyadev/luya-module-admin/pull/574) Add new toasts design (stronger colors). diff --git a/UPGRADE.md b/UPGRADE.md index d4b7657851..0037073b5f 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,6 +2,17 @@ This document will help you upgrading from a LUYA admin module version into another. For more detailed informations about the breaking changes **click the issue detail link**, there you can examples of how to change your code. +## from 3.6 to 3.7 + ++ [#576](https://github.com/luyadev/luya-module-admin/pull/576) Using the `yii\mutex\MysqlMutex` over `yii\mutex\FileMutex` as default mutex handler for admin queue components. This is due to less file permission conflicts when running cli consoles and runtime folder. In order to ensure the old behavior use the configuration below: +```php +'modules' => [ + 'admin' => [ + 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', + ] +] + ## from 3.1 to 3.2 + [#484](https://github.com/luyadev/luya-module-admin/pull/484) Changed `applyFilter()` method signature in class `luya\admin\modles\StorageFilterChain` from `applyFilter($loadFromPath, $imageSavePath)` to `applyFilter(ImageInterface $image, array $saveOptions)`. Since version 3.2 the applyFilter requires an instance of `Imagine\Image\ImageInterface` and returns an array containing two elements, the image object and the saving options. This method is internally used to apply the filter chain and is typically not used in an application. If you are, for some reason, calling this method update to the new signature. diff --git a/src/Module.php b/src/Module.php index 2d9404e2ea..dab646cd25 100644 --- a/src/Module.php +++ b/src/Module.php @@ -217,6 +217,13 @@ final class Module extends \luya\admin\base\Module implements CoreModuleInterfac * @since 2.0.4 */ public $bootstrapQueueCli = true; + + /** + * @var string The mutex class which should be used for the admin queue component. Changed from `yii\mutex\FileMutex` to `yii\mutex\MysqlMutex` as a database connection + * is required in the admin area and there are no conflicts with file permissions when running in cli mode. In order to ensure the old behavior use the FileMutex class. + * @since 3.7.0 + */ + public $queueMutexClass = 'yii\mutex\MysqlMutex'; /** * @var boolean The default value for {{luya\admin\models\StorageFile::$inline_disposition}} when uploading a new file. By default this is display which will force a download @@ -550,7 +557,7 @@ public function registerComponents() 'adminqueue' => [ 'class' => 'yii\queue\db\Queue', 'db' => 'db', - 'mutex' => 'yii\mutex\MysqlMutex', + 'mutex' => $this->queueMutexClass, 'tableName' => 'admin_queue', 'channel' => 'default', 'as log' => 'luya\admin\behaviors\QueueLogBehavior', diff --git a/tests/AdminConsoleSqLiteTestCase.php b/tests/AdminConsoleSqLiteTestCase.php index 1868efda8c..cd8240a3e3 100644 --- a/tests/AdminConsoleSqLiteTestCase.php +++ b/tests/AdminConsoleSqLiteTestCase.php @@ -26,6 +26,7 @@ public function getConfigArray() 'modules' => [ 'admin' => [ 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', ], 'crudmodulefolderadmin' => [ 'class' => 'admintests\data\modules\crudmodulefolder\admin\Module', diff --git a/tests/AdminModelTestCase.php b/tests/AdminModelTestCase.php index 9478b858eb..2cb8d4625f 100644 --- a/tests/AdminModelTestCase.php +++ b/tests/AdminModelTestCase.php @@ -39,6 +39,7 @@ public function getConfigArray() 'modules' => [ 'admin' => [ 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', ], ], ]; diff --git a/tests/NgRestTestCase.php b/tests/NgRestTestCase.php index 6f3007d46f..9356eaf223 100644 --- a/tests/NgRestTestCase.php +++ b/tests/NgRestTestCase.php @@ -24,6 +24,7 @@ public function getConfigArray() 'modules' => [ 'admin' => [ 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', ], ], ]; diff --git a/tests/data/configs/admin.php b/tests/data/configs/admin.php index 5f66b39d18..c410a4e62e 100644 --- a/tests/data/configs/admin.php +++ b/tests/data/configs/admin.php @@ -14,6 +14,7 @@ 'modules' => [ 'admin' => [ 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', ], 'crudmodulefolderadmin' => [ 'class' => 'admintests\data\modules\crudmodulefolder\admin\Module', diff --git a/tests/data/configs/console.php b/tests/data/configs/console.php index 07c303ad9a..7666309509 100644 --- a/tests/data/configs/console.php +++ b/tests/data/configs/console.php @@ -14,6 +14,7 @@ 'modules' => [ 'admin' => [ 'class' => 'luya\admin\Module', + 'queueMutexClass' => 'yii\mutex\FileMutex', ], 'crudmodulefolderadmin' => [ 'class' => 'admintests\data\modules\crudmodulefolder\admin\Module', From 5adbef864ff0768a3bb5b2afbb8be76ca83da6d5 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Tue, 6 Oct 2020 14:53:37 +0000 Subject: [PATCH 3/3] add changelog info --- CHANGELOG.md | 2 ++ UPGRADE.md | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 881b08034b..36d05e6c19 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE ## 3.7.0 +> This release contains a behavior change where MysqlMutex is default instead of FileMutex. Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes. + + [#576](https://github.com/luyadev/luya-module-admin/pull/576) Use `MysqlMutex` as default Mutex class for the Admin Queue instead of `FileMutex` due to people have problems with file permissiosn when running the queue in cli mode. MysqlMutex is also the better approach when multiple works might run on different workloads. + [#575](https://github.com/luyadev/luya-module-admin/pull/575) New hungarian language option. + [#574](https://github.com/luyadev/luya-module-admin/pull/574) Add new toasts design (stronger colors). diff --git a/UPGRADE.md b/UPGRADE.md index 0037073b5f..ebe3342c16 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -12,6 +12,7 @@ This document will help you upgrading from a LUYA admin module version into anot 'queueMutexClass' => 'yii\mutex\FileMutex', ] ] +``` ## from 3.1 to 3.2