| @@ 61-63 (lines=3) @@ | ||
| 58 | */ |
|
| 59 | protected function markAcquire($path, $type) { |
|
| 60 | if ($type === self::LOCK_SHARED) { |
|
| 61 | if (!isset($this->acquiredLocks['shared'][$path])) { |
|
| 62 | $this->acquiredLocks['shared'][$path] = 0; |
|
| 63 | } |
|
| 64 | $this->acquiredLocks['shared'][$path]++; |
|
| 65 | } else { |
|
| 66 | $this->acquiredLocks['exclusive'][$path] = true; |
|
| @@ 98-100 (lines=3) @@ | ||
| 95 | protected function markChange($path, $targetType) { |
|
| 96 | if ($targetType === self::LOCK_SHARED) { |
|
| 97 | unset($this->acquiredLocks['exclusive'][$path]); |
|
| 98 | if (!isset($this->acquiredLocks['shared'][$path])) { |
|
| 99 | $this->acquiredLocks['shared'][$path] = 0; |
|
| 100 | } |
|
| 101 | $this->acquiredLocks['shared'][$path]++; |
|
| 102 | } elseif ($targetType === self::LOCK_EXCLUSIVE) { |
|
| 103 | $this->acquiredLocks['exclusive'][$path] = true; |
|
| @@ 227-229 (lines=3) @@ | ||
| 224 | ); |
|
| 225 | } else { |
|
| 226 | // since we only keep one shared lock in the db we need to check if we have more then one shared lock locally manually |
|
| 227 | if (isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 1) { |
|
| 228 | throw new LockedException($path); |
|
| 229 | } |
|
| 230 | $result = $this->connection->executeUpdate( |
|
| 231 | 'UPDATE `*PREFIX*file_locks` SET `lock` = -1, `ttl` = ? WHERE `key` = ? AND `lock` = 1', |
|
| 232 | [$expire, $path] |
|