diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-26 14:18:01 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 12:38:19 +0200 |
commit | fd1ddad98df45bc3c18be7980c1cbe68ce6b219c (patch) | |
tree | e4017d3c979604f40e78cdc305f0ab191aedd4b9 /application/container | |
parent | 458b6b9918ec27154dd45416947bb93bedb97109 (diff) | |
download | Shaarli-fd1ddad98df45bc3c18be7980c1cbe68ce6b219c.tar.gz Shaarli-fd1ddad98df45bc3c18be7980c1cbe68ce6b219c.tar.zst Shaarli-fd1ddad98df45bc3c18be7980c1cbe68ce6b219c.zip |
Add mutex on datastore I/O operations
To make sure that there is no concurrent operation on the datastore file.
Fixes #1132
Diffstat (limited to 'application/container')
-rw-r--r-- | application/container/ContainerBuilder.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 55bb51b5..c21d58dd 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php | |||
@@ -4,6 +4,7 @@ declare(strict_types=1); | |||
4 | 4 | ||
5 | namespace Shaarli\Container; | 5 | namespace Shaarli\Container; |
6 | 6 | ||
7 | use malkusch\lock\mutex\FlockMutex; | ||
7 | use Shaarli\Bookmark\BookmarkFileService; | 8 | use Shaarli\Bookmark\BookmarkFileService; |
8 | use Shaarli\Bookmark\BookmarkServiceInterface; | 9 | use Shaarli\Bookmark\BookmarkServiceInterface; |
9 | use Shaarli\Config\ConfigManager; | 10 | use Shaarli\Config\ConfigManager; |
@@ -84,6 +85,7 @@ class ContainerBuilder | |||
84 | return new BookmarkFileService( | 85 | return new BookmarkFileService( |
85 | $container->conf, | 86 | $container->conf, |
86 | $container->history, | 87 | $container->history, |
88 | new FlockMutex(fopen(SHAARLI_MUTEX_FILE, 'r'), 2), | ||
87 | $container->loginManager->isLoggedIn() | 89 | $container->loginManager->isLoggedIn() |
88 | ); | 90 | ); |
89 | }; | 91 | }; |