| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function startLock() |
||
| 46 | { |
||
| 47 | $lockFile = $this->getLockFileName(); |
||
| 48 | $this->lockFilePointer = fopen($lockFile, 'w'); |
||
| 49 | if (!$this->lockFilePointer) { |
||
| 50 | throw new Exception( |
||
| 51 | sprintf('Can not run action. Lock file not available: "%s"', $lockFile) |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | if (flock($this->lockFilePointer, LOCK_EX)) { |
||
| 55 | return true; |
||
| 56 | } else { |
||
| 57 | throw new Exception( |
||
| 58 | sprintf('Can not run action. Action locked: "%s".', $lockFile) |
||
| 59 | ); |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 85 |