Commit a3bcde96 authored by Hendrik Heneke's avatar Hendrik Heneke
Browse files

Fixed autoloader and project lookup.

parent 9d7c8298
......@@ -14,24 +14,25 @@ if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
set_time_limit(0);
$candidates = [
dirname(__DIR__) . '/../../autoload.php' => dirname(__DIR__) . '/../../',
dirname(__DIR__) . '/../autoload.php' => dirname(__DIR__) . '/../',
dirname(__DIR__) . '/../../autoload.php' => dirname(__DIR__) . '/../../../',
dirname(__DIR__) . '/vendor/autoload.php' => dirname(__DIR__)
];
$autoloaderPath = null;
$pojectDir = null;
foreach ($candidates as $autoloaderPathCandidate => $projectDirCandidate) {
if (file_exists($autoloaderPathCandidate)) {
if (file_exists($autoloaderPathCandidate) && file_exists($projectDirCandidate . '/.env')) {
$autoloaderPath = $autoloaderPathCandidate;
$projectDir = $projectDirCandidate;
echo realpath($projectDir) ."\n";
break;
}
}
if (null === $autoloaderPath) {
throw new RuntimeException('Unable to locate autoload.php file.');
}
if (null === $projectDir) {
throw new RuntimeException('Unable to locate symfony project dir with .env file.');
}
require_once $autoloaderPath;
unset($candidates, $autoloaderPathCandidate, $projectDirCandidate);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment