| @@ 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; |
|
| @@ 95-97 (lines=3) @@ | ||
| 92 | protected function markChange($path, $targetType) { |
|
| 93 | if ($targetType === self::LOCK_SHARED) { |
|
| 94 | unset($this->acquiredLocks['exclusive'][$path]); |
|
| 95 | if (!isset($this->acquiredLocks['shared'][$path])) { |
|
| 96 | $this->acquiredLocks['shared'][$path] = 0; |
|
| 97 | } |
|
| 98 | $this->acquiredLocks['shared'][$path]++; |
|
| 99 | } else if ($targetType === self::LOCK_EXCLUSIVE) { |
|
| 100 | $this->acquiredLocks['exclusive'][$path] = true; |
|
| @@ 217-219 (lines=3) @@ | ||
| 214 | ); |
|
| 215 | } else { |
|
| 216 | // since we only keep one shared lock in the db we need to check if we have more then one shared lock locally manually |
|
| 217 | if (isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 1) { |
|
| 218 | throw new LockedException($path); |
|
| 219 | } |
|
| 220 | $result = $this->connection->executeUpdate( |
|
| 221 | 'UPDATE `*PREFIX*file_locks` SET `lock` = -1, `ttl` = ? WHERE `key` = ? AND `lock` = 1', |
|
| 222 | [$expire, $path] |
|