silverstripe /
silverstripe-framework
| 1 | <?php |
||
| 2 | |||
| 3 | // Init composer autoload |
||
| 4 | call_user_func(function () { |
||
| 5 | $candidates = [ |
||
| 6 | // module in vendor |
||
| 7 | __DIR__ . '/../../../../autoload.php', |
||
| 8 | // module itself is webroot (usually during CI installs) |
||
| 9 | __DIR__ . '/../../vendor/autoload.php', |
||
| 10 | // fallback |
||
| 11 | getcwd() . '/vendor/autoload.php', |
||
| 12 | ]; |
||
| 13 | foreach ($candidates as $candidate) { |
||
| 14 | if (file_exists($candidate)) { |
||
| 15 | require_once $candidate; |
||
| 16 | return; |
||
| 17 | } |
||
| 18 | } |
||
| 19 | die("Failed to include composer's autoloader, unable to continue"); |
||
|
0 ignored issues
–
show
|
|||
| 20 | }); |
||
| 21 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.