8000 feature #26923 [FrameworkBundle] Allow user to specify folder for flo… · symfony/symfony@9ad492f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ad492f

Browse files
committed
feature #26923 [FrameworkBundle] Allow user to specify folder for flock (MaksSlesarenko)
This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] Allow user to specify folder for flock | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | License | MIT | Doc PR | In case multiple applications running on same server allow user to specify folder for flock example: ``` framework: lock:` 'flock://var/flock' # var/flock will be provided as path to flock constructor lock: 'flock:///var/flock' # /var/flock will be provided as path to flock constructor lock: flock # works as usual, null is provided to constructor and system temp folder is used ``` Commits ------- 244d762 added ability to specify folder for flock
2 parents a37bca4 + 244d762 commit 9ad492f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
use Symfony\Component\Lock\Factory;
6565
use Symfony\Component\Lock\Lock;
6666
use Symfony\Component\Lock\LockInterface;
67+
use Symfony\Component\Lock\Store\FlockStore;
6768
use Symfony\Component\Lock\Store\StoreFactory;
6869
use Symfony\Component\Lock\StoreInterface;
6970
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
@@ -1405,6 +1406,14 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
14051406
case 'flock' === $storeDsn:
14061407
$storeDefinition = new Reference('lock.store.flock');
14071408
break;
1409+
case 0 === strpos($storeDsn, 'flock://'):
1410+
$flockPath = substr($storeDsn, 8);
1411+
1412+
$storeDefinitionId = '.lock.flock.store.'.$container->hash($storeDsn);
1413+
$container->register($storeDefinitionId, FlockStore::class)->addArgument($flockPath);
1414+
1415+
$storeDefinition = new Reference($storeDefinitionId);
1416+
break;
14081417
case 'semaphore' === $storeDsn:
14091418
$storeDefinition = new Reference('lock.store.semaphore');
14101419
break;

0 commit comments

Comments
 (0)
0