getAbsolutePathToLockFile()); } public function lockBackend(string $redirectUriFromFileContent): bool { return GeneralUtility::writeFile($this->getAbsolutePathToLockFile(), $redirectUriFromFileContent, true); } public function unlock(): void { unlink($this->getAbsolutePathToLockFile()); } public function getAbsolutePathToLockFile(): string { // This setting is empty by default to utilize the fallback storage location. // If set specifically, this is the preference. if (($GLOBALS['TYPO3_CONF_VARS']['BE']['lockBackendFile'] ?? '') !== '') { return Environment::getProjectPath() . '/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBackendFile']; } return $this->getLockPath() . '/LOCK_BACKEND'; } public function getRedirectUriFromLockContents(): string { return file_get_contents($this->getAbsolutePathToLockFile()); } /** * Based on composer or legacy mode, return a fallback directory * location where LOCK_BACKEND can be stored. * Composer-mode: "var/lock" is preferred because it is recommended to * be shared and persist across deployments and the location * is writable by the webserver) * Legacy: "config/", because usually writable by webserver and persistent. */ protected function getLockPath(): string { return Environment::isComposerMode() ? Environment::getVarPath() . '/lock' : Environment::getConfigPath(); } }