Commit f0cf8699 authored by Marc Egger's avatar Marc Egger
Browse files

replace relative with absolute paths done except for phpUnit path setting

parent 47f7dfba
Pipeline #4977 failed with stages
in 2 minutes and 1 second
......@@ -38,7 +38,7 @@ $status = HTTP_400_BAD_REQUEST;
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => '']);
$data = $qfq->dataReport();
......
......@@ -73,7 +73,7 @@ $flagSuccess = false;
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => '']);
$answer = $qfq->delete();
......
......@@ -18,7 +18,7 @@ use IMATHUZH\Qfq\Core\Helper\Path;
*
*/
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$dirty = new Dirty();
$answer = $dirty->process();
......
......@@ -22,7 +22,7 @@ $output = '';
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$download = new Download();
// If all is fine: process() will output file via print() !!
......
......@@ -51,7 +51,7 @@ $answer[API_MESSAGE] = '';
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => '']);
$data = $qfq->dragAndDrop();
......
......@@ -38,7 +38,7 @@ $answer[API_MESSAGE] = '';
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$fileUpload = new File();
$fileUpload->process();
......
......@@ -52,7 +52,7 @@ $answer[API_MESSAGE] = '';
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => '']);
$data = $qfq->updateForm();
......
......@@ -20,7 +20,7 @@ use IMATHUZH\Qfq\Core\Store\Config;
* Main
*/
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$html2pdf = new Html2Pdf(Config::getConfigArray());
$html2pdf->outputHtml2Pdf();
......
......@@ -22,7 +22,7 @@ $data = array();
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$form = OnString::splitPathInfoToIdForm($_SERVER['PATH_INFO'] ?? '', $restId, $restForm);
// get latest `ìd`
......
......@@ -52,7 +52,7 @@ $answer[API_MESSAGE] = '';
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => ""]);
$data = $qfq->saveForm();
......
......@@ -36,7 +36,7 @@ $status = HTTP_400_BAD_REQUEST;
try {
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$qfq = new QuickFormQuery(['bodytext' => '']);
$qfq->setting();
......
......@@ -19,7 +19,7 @@ use IMATHUZH\Qfq\Core\Helper\Path;
*
*/
try {
Path::setMainPaths(Path::API_TO_APP);
Path::setMainPaths();
$typeAhead = new TypeAhead();
$answer = $typeAhead->process();
......
......@@ -35,7 +35,7 @@ class QfqController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
$flagOk = false;
try {
Path::setMainPaths('');
Path::setMainPaths();
$contentObject = $this->configurationManager->getContentObject();
// By T3 default 'E_NOTICE' is unset. E.g. 'Undefined Index' will throw an exception.
......
......@@ -71,9 +71,8 @@ class Delete {
// Take care the necessary target directories exist.
$cwd = getcwd();
$cwdToApp = Path::cwdToApp();
$sitePath = Path::absoluteApp();
if ($cwd === false || $sitePath === false || !HelperFile::chdir($sitePath, '')) {
if ($cwd === false || $sitePath === false || !HelperFile::chdir($sitePath)) {
throw new \UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'getcwd() failed or SITE_PATH undefined or chdir() failed', ERROR_MESSAGE_TO_DEVELOPER => "getcwd() failed or SITE_PATH undefined or chdir('$sitePath') failed."]),
ERROR_IO_CHDIR);
......@@ -94,7 +93,7 @@ class Delete {
}
HelperFile::chdir($cwd, $cwdToApp);
HelperFile::chdir($cwd);
}
/**
......
......@@ -39,15 +39,15 @@ class FormAsFile
$formFromDb = $database->selectFormByName($formName, [F_ID, F_FILE_STATS]);
// Get file stats from file system
$cwdToFormFile = self::formPathFileName($formName, $database);
$fileReadException = function () use ($cwdToFormFile, $database, $formName) {
$absoluteFormFilePath = self::formPathFileName($formName, $database);
$fileReadException = function () use ($absoluteFormFilePath, $database, $formName) {
Thrower::userFormException(
"Form file not found or missing permission: '" . baseName($cwdToFormFile) . "'. Form names are case sensitive. Similar forms: "
"Form file not found or missing permission: '" . baseName($absoluteFormFilePath) . "'. Form names are case sensitive. Similar forms: "
. implode(', ', array_filter(self::formFileNames($database), function ($f) use ($formName) {return strtolower($f) === strtolower($formName);})),
"Form definition file not found or no permission to read file: '$cwdToFormFile'"
"Form definition file not found or no permission to read file: '$absoluteFormFilePath'"
);
};
if(!file_exists($cwdToFormFile)) {
if(!file_exists($absoluteFormFilePath)) {
if ($keepIfNeverExported && isset($formFromDb[F_ID]) && (!isset($formFromDb[F_FILE_STATS]) || !self::isValidFileStats($formFromDb[F_FILE_STATS]))) {
// if file not exists and form was never exported, then export
self::exportForm($formName, $database);
......@@ -56,7 +56,7 @@ class FormAsFile
$fileReadException();
}
}
$fileStatsNew = self::formFileStatsJson($cwdToFormFile);
$fileStatsNew = self::formFileStatsJson($absoluteFormFilePath);
if ($fileStatsNew === false) {
self::deleteFormDB($formName, $database, "Failed to read form file stats.");
$fileReadException();
......@@ -68,7 +68,7 @@ class FormAsFile
}
// Read form file
$fileContents = file_get_contents($cwdToFormFile);
$fileContents = file_get_contents($absoluteFormFilePath);
if ($fileContents === false) {
self::deleteFormDB($formName, $database, "Failed to read form file.");
$fileReadException();
......@@ -77,7 +77,7 @@ class FormAsFile
// form elements exist?
if (!isset($formFromFile[F_FILE_FORM_ELEMENT])) {
Thrower::userFormException('Failed to import form file.', "Json key '" . F_FILE_FORM_ELEMENT . "' in file '$cwdToFormFile' is missing.");
Thrower::userFormException('Failed to import form file.', "Json key '" . F_FILE_FORM_ELEMENT . "' in file '$absoluteFormFilePath' is missing.");
}
// make sure container names are unique and non-empty
......@@ -85,14 +85,14 @@ class FormAsFile
foreach ($formFromFile[F_FILE_FORM_ELEMENT] as $formElementFromFile) {
$keysNotSet = OnArray::keysNotSet([FE_CLASS, FE_NAME], $formElementFromFile);
if (!empty($keysNotSet)) {
Thrower::userFormException('Failed to import form file.', "One or more required keys are missing in FormElement definition in file: '$cwdToFormFile'. Missing keys: " . implode(', ', $keysNotSet));
Thrower::userFormException('Failed to import form file.', "One or more required keys are missing in FormElement definition in file: '$absoluteFormFilePath'. Missing keys: " . implode(', ', $keysNotSet));
}
if ($formElementFromFile[FE_CLASS] === FE_CLASS_CONTAINER) {
if (in_array($formElementFromFile[FE_NAME], $containerNames)) {
Thrower::userFormException('Failed to import form file.', "Multiple formElements of class container with the same name '" . $formElementFromFile[FE_NAME] . "' in form file '$cwdToFormFile'");
Thrower::userFormException('Failed to import form file.', "Multiple formElements of class container with the same name '" . $formElementFromFile[FE_NAME] . "' in form file '$absoluteFormFilePath'");
}
if ($formElementFromFile[FE_NAME] == '') {
Thrower::userFormException('Failed to import form file.', "Found formElement of class container with empty name in form file '$cwdToFormFile'");
Thrower::userFormException('Failed to import form file.', "Found formElement of class container with empty name in form file '$absoluteFormFilePath'");
}
$containerNames[] = $formElementFromFile[FE_NAME];
}
......@@ -131,7 +131,7 @@ class FormAsFile
if (array_key_exists(FE_FILE_CONTAINER_NAME, $formElementFromFile)) {
$containerName = $formElementFromFile[FE_FILE_CONTAINER_NAME];
if (!isset($containerIds[$containerName])) {
Thrower::userFormException('Failed to import form file.', "Key '" . FE_FILE_CONTAINER_NAME . "' points to non-existing container with name '$containerName' in definition of formElement with name '" . $formElementFromFile[FE_NAME] . "' in file '$cwdToFormFile'");
Thrower::userFormException('Failed to import form file.', "Key '" . FE_FILE_CONTAINER_NAME . "' points to non-existing container with name '$containerName' in definition of formElement with name '" . $formElementFromFile[FE_NAME] . "' in file '$absoluteFormFilePath'");
}
$containerId = $containerIds[$containerName];
$feId = $formElementFromFile[FE_ID];
......@@ -198,22 +198,22 @@ class FormAsFile
* Create copy of given form file in form/_backup. If given file does not exist, do nothing.
* New file name: <formName>.YYYMMDDhhmmss.file.json
*
* @param string $cwdToFormFile
* @param string $absoluteFormFilePath
* @throws \UserFormException
*/
private static function backupFormFile(string $cwdToFormFile)
private static function backupFormFile(string $absoluteFormFilePath)
{
if (file_exists($cwdToFormFile))
if (file_exists($absoluteFormFilePath))
{
if (!is_readable($cwdToFormFile)) {
Thrower::userFormException('Error while trying to backup form file.', "Form file is not readable: $cwdToFormFile");
if (!is_readable($absoluteFormFilePath)) {
Thrower::userFormException('Error while trying to backup form file.', "Form file is not readable: $absoluteFormFilePath");
}
// copy file
$cwdToBackupFile = self::newBackupPathFileName(basename($cwdToFormFile, '.json'), 'file');
$success = copy($cwdToFormFile, $cwdToBackupFile);
$absoluteBackupFilePath = self::newBackupPathFileName(basename($absoluteFormFilePath, '.json'), 'file');
$success = copy($absoluteFormFilePath, $absoluteBackupFilePath);
if ($success === false) {
Thrower::userFormException('Error while trying to backup form file.', "Can't copy file $cwdToFormFile to $cwdToBackupFile");
Thrower::userFormException('Error while trying to backup form file.', "Can't copy file $absoluteFormFilePath to $absoluteBackupFilePath");
}
}
}
......@@ -525,8 +525,8 @@ class FormAsFile
private static function backupFormDb(int $formId, Database $database)
{
list($formName, $formId, $formJson) = self::formToJson('', $database, $formId);
$cwdToBackupFile = self::newBackupPathFileName($formName, 'db');
HelperFile::file_put_contents($cwdToBackupFile, $formJson);
$absoluteBackupFilePath = self::newBackupPathFileName($formName, 'db');
HelperFile::file_put_contents($absoluteBackupFilePath, $formJson);
}
......@@ -606,22 +606,22 @@ class FormAsFile
*/
private static function formPath(Database $database): string
{
$cwdToForm = Path::cwdToProject(Path::PROJECT_TO_FORM);
if (!is_dir($cwdToForm)) {
$absoluteFormPath = Path::absoluteProject(Path::PROJECT_TO_FORM);
if (!is_dir($absoluteFormPath)) {
// create path
$success = mkdir($cwdToForm, 0777, true);
$success = mkdir($absoluteFormPath, 0777, true);
if ($success === false) {
throw new \UserFormException(json_encode([
ERROR_MESSAGE_TO_USER => "Can't create form file path.",
ERROR_MESSAGE_TO_DEVELOPER => "Can't create path: " . $cwdToForm]),
ERROR_MESSAGE_TO_DEVELOPER => "Can't create path: " . $absoluteFormPath]),
ERROR_IO_WRITE_FILE);
}
// export all forms
self::exportAllForms($database);
}
return $cwdToForm;
return $absoluteFormPath;
}
/**
......@@ -771,25 +771,25 @@ class FormAsFile
private static function newBackupPathFileName(string $formName, string $tag): string
{
// create backup path if not exists
$cwdToBackup = Path::cwdToProject(Path::PROJECT_TO_FORM, Path::FORM_TO_FORM_BACKUP);
if (!is_dir($cwdToBackup)) {
$success = mkdir($cwdToBackup, 0777, true);
$absoluteBackupPath = Path::absoluteProject(Path::PROJECT_TO_FORM, Path::FORM_TO_FORM_BACKUP);
if (!is_dir($absoluteBackupPath)) {
$success = mkdir($absoluteBackupPath, 0777, true);
if ($success === false) {
Thrower::userFormException('Error while trying to backup form file.', "Can't create backup path: $cwdToBackup");
Thrower::userFormException('Error while trying to backup form file.', "Can't create backup path: $absoluteBackupPath");
}
}
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.json.' . date('Y-m-d_H-i-s') . ".$tag");
$absoluteBackupFilePath = Path::join($absoluteBackupPath, $formName . '.json.' . date('Y-m-d_H-i-s') . ".$tag");
// add index to filename if backup file with current timestamp already exists
$index = 1;
while (file_exists($cwdToBackupFile)) {
$cwdToBackupFile = Path::join($cwdToBackup, $formName . '.json.' . date('Y-m-d_H-i-s') . ".$index.$tag");
while (file_exists($absoluteBackupFilePath)) {
$absoluteBackupFilePath = Path::join($absoluteBackupPath, $formName . '.json.' . date('Y-m-d_H-i-s') . ".$index.$tag");
$index ++;
if ($index > 20) {
Thrower::userFormException('Error while trying to backup form file.', 'Infinite loop.');
}
}
return $cwdToBackupFile;
return $absoluteBackupFilePath;
}
}
\ No newline at end of file
......@@ -117,14 +117,14 @@ class HelperFile {
return $vars;
}
$pathFileNameRelToCwd = Path::cwdToApp($pathFileNameRelToApp);
$absolutePathFileName = Path::absoluteApp($pathFileNameRelToApp);
if (!file_exists($pathFileNameRelToCwd)) {
if (!file_exists($absolutePathFileName)) {
return $vars;
}
$vars[VAR_FILE_MIME_TYPE] = self::getMimeType($pathFileNameRelToCwd);
$vars[VAR_FILE_SIZE] = filesize($pathFileNameRelToCwd);
$vars[VAR_FILE_MIME_TYPE] = self::getMimeType($absolutePathFileName);
$vars[VAR_FILE_SIZE] = filesize($absolutePathFileName);
if ($vars[VAR_FILE_SIZE] === false) {
$vars[VAR_FILE_SIZE] = '-';
......@@ -250,20 +250,17 @@ class HelperFile {
* PHP System function: chdir() with QFQ exception.
*
* @param $newCwd
* @param string $pathNewCwdToApp Path from the new cwd to the App directory.
* @return string
* @throws \CodeException
* @throws \UserFormException
*/
public static function chdir($newCwd, string $pathNewCwdToApp) {
public static function chdir($newCwd) {
if (false === @chdir($newCwd)) {
$msg = self::errorGetLastAsString() . " - chdir($newCwd)";
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'chdir failed', ERROR_MESSAGE_TO_DEVELOPER => $msg]), ERROR_IO_CHDIR);
}
Path::setMainPaths($pathNewCwdToApp);
return true;
}
......@@ -370,13 +367,11 @@ class HelperFile {
public static function mkDirParent($pathFileName, $chmodDir = false) {
$path = "";
$cwd = '';
$cwdToApp = '';
// Leading '/' will be removed - chdir to / to still use correct path
if ($pathFileName[0] == '/') {
$cwd = getcwd();
$cwdToApp = Path::cwdToApp();
self::chdir('/', Path::absoluteApp());
self::chdir('/');
}
// Teile "Directory/File.Extension" auf
......@@ -415,7 +410,7 @@ class HelperFile {
}
if ($cwd != '') {
self::chdir($cwd, $cwdToApp);
self::chdir($cwd);
}
}
......
......@@ -49,10 +49,10 @@ class Logger {
return;
}
$pathFileNameRelToCwd = self::makePathAbsolute($pathFileNameRelToCwd);
$absolutePathFileName = self::makePathAbsolute($pathFileNameRelToCwd);
try {
$handle = fopen($pathFileNameRelToCwd, $mode);
$handle = fopen($absolutePathFileName, $mode);
} catch (\Exception $e) {
$dummy = 1;
}
......@@ -64,21 +64,21 @@ class Logger {
if ($recursion) {
throw new \UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error: cannot open file',
ERROR_MESSAGE_TO_DEVELOPER => "Error - cannot open. File: " . $pathFileNameRelToCwd .
ERROR_MESSAGE_TO_DEVELOPER => "Error - cannot open. File: " . $absolutePathFileName .
" ( CWD: " . getcwd() . ") - " . HelperFile::errorGetLastAsString()]),
ERROR_IO_OPEN);
}
// If open fails, maybe the directory does not exist. Create it:
HelperFile::mkDirParent($pathFileNameRelToCwd);
self::logMessage($msg, $pathFileNameRelToCwd, $mode, true);
HelperFile::mkDirParent($absolutePathFileName);
self::logMessage($msg, $absolutePathFileName, $mode, true);
return;
}
if (fwrite($handle, $msg . PHP_EOL) === false) {
throw new \UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Error: cannot write file',
ERROR_MESSAGE_TO_DEVELOPER => "Error - cannot open. File: " . $pathFileNameRelToCwd .
ERROR_MESSAGE_TO_DEVELOPER => "Error - cannot open. File: " . $absolutePathFileName .
" ( CWD: " . getcwd() . ") - " . HelperFile::errorGetLastAsString()]),
ERROR_IO_WRITE);
}
......@@ -166,7 +166,7 @@ class Logger {
foreach ([FORM_LOG_FILE_ALL, FORM_LOG_FILE_SESSION] as $filename) {
if (!empty($form[$filename])) {
Logger::logMessage($line, Path::cwdToApp($form[$filename]));
Logger::logMessage($line, Path::absoluteApp($form[$filename]));
}
}
}
......
......@@ -7,17 +7,16 @@ namespace IMATHUZH\Qfq\Core\Helper;
* Glossar:
* - App: directory in which the index.php file is located. All urls should be relative to this.
* - Ext: directory in which the QFQ extension is loacted. e.g. the folder Classes is in there.
* - CWD: current working directory
* - API: api folder of qfq extension
*
* Naming convention of path constants/functions/variables:
* 1) name a path by its origin and its destination separated by 'to'. E.g. APP_TO_SYSTEM_LOG, $appToProject.
* 2) if the destination is a file, append "File". E.g. APP_TO_SYSTEM_QFQ_LOG_FILE.
* 3) if a path has to be variable, create a setter and getter. E.g. self::setCwdToApp(), self::cwdToApp(), private static $cwdToApp.
* 4) a path getter appends the given arguments to the requested path using self::join(..., func_get_args()). E.g. see cwdToApp().
* 5) additional path getters may be defined which combine other getters. E.g. see cwdToApi().
* 6) avoid manually defining new paths relative to cwd. Define path relative to App then combine it with cwdToApp()
* 7) avoid defining redundant paths in constants. E.g. create cwdToApi() by combining cwdToExt() and extToApi() instead of defining CWD_TO_API.
* 3) if a path has to be variable, create a setter and getter. E.g. self::setAbsoluteApp(), self::absoluteApp(), private static $absoluteApp.
* 4) a path getter appends the given arguments to the requested path using self::join(..., func_get_args()). E.g. see absoluteApp().
* 5) additional path getters may be defined which combine other getters. E.g. see absoluteProject().
* 6) avoid manually defining new absolute paths. Define paths relative to App then create a getter which joins it with absoluteApp()
* 7) avoid defining redundant paths in constants. E.g. create appToApi() by combining appToExt() and extToApi() instead of defining APP_TO_API.
*/
use IMATHUZH\Qfq\Core\Exception\Thrower;
......@@ -26,8 +25,8 @@ use IMATHUZH\Qfq\Core\Store\Config;
class Path
{
// App
// This should be manually overwritten (using Path::setCwdToApp()) if the CWD is not the one containing the typo3 index.php.
private static $cwdToApp = null;
// This is manually set in self::setMainPaths()
private static $absoluteApp = null;
// Extension
const APP_TO_EXT = 'typo3conf/ext/qfq';
......@@ -85,16 +84,18 @@ class Path
/**
* Manually set the paths which are not constant nor can be inferred by other paths.
* This function must be called at the beginning of every entry point, to tell the Path class, where things are
* relative to the CWD.
* This function must be called at the beginning of every entry point, to tell the Path class, where things are.
*
* @param string $cwdToApp
* @param string|null $absoluteApp
* @throws \CodeException
* @throws \UserFormException
*/
public static function setMainPaths(string $cwdToApp)
public static function setMainPaths(string $absoluteApp = null)
{
self::setCwdToApp($cwdToApp);
if (is_null($absoluteApp)) {
$absoluteApp = self::findAbsoluteApp();
}
self::setAbsoluteApp($absoluteApp);
// Only executed on first call:
self::findAppToProject();
......@@ -108,7 +109,8 @@ class Path
*/
public static function absoluteApp(...$pathPartsToAppend): string
{
return self::realpath(self::cwdToApp(), $pathPartsToAppend);
self::enforcePathIsSet(self::$absoluteApp);
return self::join(self::$absoluteApp, $pathPartsToAppend);
}
/**
......@@ -118,7 +120,7 @@ class Path
*/
public static function absoluteExt(...$pathPartsToAppend): string
{
return self::realpath(self::cwdToExt(), $pathPartsToAppend);
return self::absoluteApp(self::appToExt(), $pathPartsToAppend);
}
/**
......@@ -171,17 +173,6 @@ class Path
return self::$overloadAbsoluteMailLogFile;
}
/**
* @param array $pathPartsToAppend
* @return string
* @throws \UserFormException
*/
public static function cwdToApp(...$pathPartsToAppend): string
{
self::enforcePathIsSet(self::$cwdToApp);
return self::join(self::$cwdToApp, $pathPartsToAppend);
}
/**
* @param array $pathPartsToAppend
* @return string
......@@ -198,9 +189,9 @@ class Path
* @return string
* @throws \UserFormException
*/
public static function cwdToProject(...$pathPartsToAppend): string
public static function absoluteProject(...$pathPartsToAppend): string
{
return self::cwdToApp(self::appToProject($pathPartsToAppend));
return self::absoluteApp(self::appToProject($pathPartsToAppend));
}
/**
......@@ -208,9 +199,9 @@ class Path
* @return string
* @throws \UserFormException
*/
public static function cwdToConf(...$pathPartsToAppend): string
public static function absoluteConf(...$pathPartsToAppend): string
{
return self::cwdToProject(self::PROJECT_TO_CONF, $pathPartsToAppend);
return self::absoluteProject(self::PROJECT_TO_CONF, $pathPartsToAppend);
}
/**
......@@ -223,16 +214,6 @@ class Path
return self::join(self::APP_TO_EXT, $pathPartsToAppend);
}
/**
* @param array $pathPartsToAppend
* @return string
* @throws \UserFormException
*/
public static function cwdToExt(...$pathPartsToAppend): string
{
return self::cwdToApp(self::APP_TO_EXT, $pathPartsToAppend);
}
/**
* @param array $pathPartsToAppend
* @return string
......@@ -375,9 +356,9 @@ class Path
/**
* @param string $newPath
*/
private static function setCwdToApp(string $newPath)
private static function setAbsoluteApp(string $newPath)
{
self::$cwdToApp = $newPath;
self::$absoluteApp = $newPath;
}
/**
......@@ -442,20 +423,20 @@ class Path
}
// does qfq.project.path.php exist? => read path
$cwdToProjectPathFile = self::cwdToApp(PROJECT_PATH_PHP_FILE);
if (HelperFile::isReadableException($cwdToProjectPathFile)) {
self::setAppToProject(HelperFile::include($cwdToProjectPathFile));
$absoluteProjectPathFile = self::absoluteApp(PROJECT_PATH_PHP_FILE);
if (HelperFile::isReadableException($absoluteProjectPathFile)) {
self::setAppToProject(HelperFile::include($absoluteProjectPathFile));
// does the deprecated config.qfq.php exist? => fileadmin/protected/qfqProject & migrate to qfq.json
} elseif (HelperFile::isReadableException(self::cwdToApp(self::APP_TO_TYPO3_CONF, CONFIG_QFQ_PHP))) {
HelperFile::createPathRecursive(self::cwdToApp(self::APP_TO_PROJECT_IN_PROTECTED));
} elseif (HelperFile::isReadableException(self::absoluteApp(self::APP_TO_TYPO3_CONF, CONFIG_QFQ_PHP))) {
HelperFile::createPathRecursive(self::absoluteApp(self::APP_TO_PROJECT_IN_PROTECTED));
self::setAppToProject(self::APP_TO_PROJECT_IN_PROTECTED);