66 if (!GeneralUtility::mkdir($path)) {
70 if (!is_writable($path)) {
73 $this->filePath = $path .
'simple_' . md5((
string)$subject);
108 GeneralUtility::isAllowedAbsPath($this->filePath)
111 if (@unlink($this->filePath) ===
false) {
145 public function acquire($mode = self::LOCK_CAPABILITY_EXCLUSIVE)
151 if (file_exists($this->filePath)) {
152 $maxExecutionTime = (int)ini_get(
'max_execution_time');
153 $maxAge = time() - ($maxExecutionTime ?: 120);
154 if (@filectime($this->filePath) < $maxAge) {
156 @unlink($this->filePath);
163 $filePointer = @fopen($this->filePath,
'x');
164 if ($filePointer !==
false) {
165 fclose($filePointer);
166 GeneralUtility::fixPermissions($this->filePath);
170 if ($mode & self::LOCK_CAPABILITY_NOBLOCK) {
174 usleep($this->step * 1000);
177 if ($mode & self::LOCK_CAPABILITY_NOBLOCK && !$this->
isAcquired && $wouldBlock) {
178 throw new LockAcquireWouldBlockException(
'Failed to acquire lock because the request would block.', 1460976403);
197 @unlink($this->filePath);