-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Prokl\JediLight\Application\Application; | ||
|
||
@set_time_limit(0); | ||
|
||
$_SERVER['DOCUMENT_ROOT'] = __DIR__. DIRECTORY_SEPARATOR . '..'; | ||
$GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT']; | ||
/** @var array $autoloadPaths Пути, где искать autoload.php композера. */ | ||
$autoloadPaths = ['/../vendor/autoload.php', | ||
'/../../current/vendor/autoload.php', | ||
'/../../../vendor/autoload.php' | ||
|
||
$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'; | ||
]; | ||
$autoloadPath = ''; | ||
|
||
foreach ($autoloadPaths as $path) { | ||
if (file_exists($autoloadPath = realpath(__DIR__) . $path)) { | ||
$autoloadPath = realpath(__DIR__) . $path; | ||
break; | ||
} | ||
} | ||
|
||
if (!$autoloadPath) { | ||
die('Cannot find composer autoload.php file.' . PHP_EOL); | ||
} | ||
|
||
/** @noinspection PhpIncludeInspection */ | ||
require_once $autoloadPath; | ||
|
||
// Считаю, что в данном случае DOCUMENT_ROOT находится на одном уровне с папкой vendor | ||
$_SERVER['DOCUMENT_ROOT'] = $GLOBALS['DOCUMENT_ROOT'] = dirname($autoloadPath) . '/..'; | ||
|
||
$jediApplication = new Application(); | ||
$jediApplication->setDocumentRoot($_SERVER['DOCUMENT_ROOT']); | ||
|
||
$jediApplication->run(); | ||
|
||
$jediApplication->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters