38 private $lockFilePath;
43 private $tmpDirectory;
70 $this->lockFilePath = $this->getFilePath($lockName);
72 while ($this->isProcessLocked()) {
76 $this->tmpDirectory->writeFile($this->lockFilePath,
time());
89 $this->tmpDirectory->delete($this->lockFilePath);
97 private function isProcessLocked()
99 if ($this->tmpDirectory->isExist($this->lockFilePath)) {
101 $lockTime = (int)$this->tmpDirectory->readFile($this->lockFilePath);
102 if ((
time() - $lockTime) >= self::MAX_LOCK_TIME) {
103 $this->tmpDirectory->delete($this->lockFilePath);
107 }
catch (FileSystemException $e) {
123 private function getFilePath(
$name)
132 private function getState()
134 if (
null === $this->state) {
__construct(Filesystem $filesystem)
if(!isset($_GET['name'])) $name