1 | <?php |
||
17 | class FlockLock extends LockAbstract |
||
18 | { |
||
19 | protected $dirname; |
||
20 | protected $files = array(); |
||
21 | |||
22 | /** |
||
23 | * @param string $dirname |
||
24 | */ |
||
25 | public function __construct($dirname) |
||
31 | |||
32 | /** |
||
33 | * @param string $name |
||
34 | * @param bool $blocking |
||
35 | * @return bool |
||
36 | */ |
||
37 | 32 | protected function getLock($name, $blocking) |
|
56 | |||
57 | /** |
||
58 | * Release lock |
||
59 | * |
||
60 | * @param string $name name of lock |
||
61 | * @return bool |
||
62 | */ |
||
63 | 32 | public function releaseLock($name) |
|
75 | |||
76 | /** |
||
77 | * @param string $name |
||
78 | * @return string |
||
79 | */ |
||
80 | protected function getFilePath($name) |
||
84 | |||
85 | /** |
||
86 | * @param string $name |
||
87 | * @return bool |
||
88 | */ |
||
89 | protected function setupFileHandle($name) |
||
104 | |||
105 | public function __clone() |
||
110 | 10 | ||
111 | /** |
||
112 | * Try to release any obtained locks when object is destroyed |
||
113 | * |
||
114 | * This is a safe guard for cases when your php script dies unexpectedly. |
||
115 | * It's not guaranteed it will work either. |
||
116 | * |
||
117 | * You should not depend on __destruct() to release your locks, |
||
118 | * instead release them with `$released = $this->releaseLock()`A |
||
119 | * and check `$released` if lock was properly released |
||
120 | */ |
||
121 | public function __destruct() |
||
127 | 10 | ||
128 | /** |
||
129 | * Check if lock is locked |
||
130 | * |
||
131 | * @param string $name name of lock |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isLocked($name) |
||
142 | } |
||
143 |