| @@ 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; |
|
| @@ 223-225 (lines=3) @@ | ||
| 220 | ); |
|
| 221 | } else { |
|
| 222 | // since we only keep one shared lock in the db we need to check if we have more then one shared lock locally manually |
|
| 223 | if (isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 1) { |
|
| 224 | throw new LockedException($path); |
|
| 225 | } |
|
| 226 | $result = $this->connection->executeUpdate( |
|
| 227 | 'UPDATE `*PREFIX*file_locks` SET `lock` = -1, `ttl` = ? WHERE `key` = ? AND `lock` = 1', |
|
| 228 | [$expire, $path] |
|