-
Notifications
You must be signed in to change notification settings - Fork 6
/
elasticorn.php
executable file
·36 lines (32 loc) · 1.04 KB
/
elasticorn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env php
<?php
declare(strict_types=1);
$phar = false;
$basePath = __DIR__;
if (method_exists(Phar::class, 'running')) {
$pharPath = Phar::running(false);
if (!empty($pharPath)) {
$phar = true;
$basePath = dirname($pharPath);
}
}
// Determine the autoload.php file this prevent path errors
// in case of global composer installation and package requirement
$autoloadFile = 'vendor/autoload.php';
foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
if (file_exists($file)) {
$autoloadFile = $file;
break;
}
}
// Determine the bootstrap.php file this prevent path errors
// in case of global composer installation and package requirement
$bootstrapFile = 'bootstrap.php';
foreach ([__DIR__ . '/../../bootstrap.php', __DIR__ . '/../bootstrap.php', __DIR__ . '/bootstrap.php'] as $file) {
if (file_exists($file)) {
$bootstrapFile = $file;
break;
}
}
require_once $autoloadFile;
require_once $bootstrapFile;