Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use mysql mutex lock mechanism #576

Merged
merged 3 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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).

Expand Down
12 changes: 12 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

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.
Expand Down
9 changes: 8 additions & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -550,7 +557,7 @@ public function registerComponents()
'adminqueue' => [
'class' => 'yii\queue\db\Queue',
'db' => 'db',
'mutex' => 'yii\mutex\FileMutex',
'mutex' => $this->queueMutexClass,
'tableName' => 'admin_queue',
'channel' => 'default',
'as log' => 'luya\admin\behaviors\QueueLogBehavior',
Expand Down
1 change: 1 addition & 0 deletions tests/AdminConsoleSqLiteTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tests/AdminModelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function getConfigArray()
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
],
];
Expand Down
1 change: 1 addition & 0 deletions tests/NgRestTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function getConfigArray()
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
],
];
Expand Down
1 change: 1 addition & 0 deletions tests/data/configs/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
'crudmodulefolderadmin' => [
'class' => 'admintests\data\modules\crudmodulefolder\admin\Module',
Expand Down
1 change: 1 addition & 0 deletions tests/data/configs/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
'crudmodulefolderadmin' => [
'class' => 'admintests\data\modules\crudmodulefolder\admin\Module',
Expand Down