Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
hhit
config-generator
Commits
a3bcde96
Commit
a3bcde96
authored
Feb 27, 2021
by
Hendrik Heneke
Browse files
Fixed autoloader and project lookup.
parent
9d7c8298
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
bin/cfgen
bin/cfgen
+5
-4
No files found.
bin/cfgen
View file @
a3bcde96
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment