diff options
| author | Greg Roach <fisharebest@gmail.com> | 2021-05-06 16:02:43 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2021-05-06 16:02:43 +0100 |
| commit | 785274b8f4460085b440e020f349e7d085ed4abb (patch) | |
| tree | 257b764fc6f01b4eba3689582497b03f168d03b0 /index.php | |
| parent | 00c45d2300a5375d4779bf9dbe157d4ef56b9443 (diff) | |
| download | webtrees-785274b8f4460085b440e020f349e7d085ed4abb.tar.gz webtrees-785274b8f4460085b440e020f349e7d085ed4abb.tar.bz2 webtrees-785274b8f4460085b440e020f349e7d085ed4abb.zip | |
Refactor bootstrap to prepare for console commands
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 26 |
1 files changed, 7 insertions, 19 deletions
@@ -19,10 +19,6 @@ declare(strict_types=1); namespace Fisharebest\Webtrees; -use Middleland\Dispatcher; -use Nyholm\Psr7Server\ServerRequestCreator; - -use function app; use function is_file; use function is_string; use function parse_url; @@ -39,19 +35,11 @@ if (PHP_SAPI === 'cli-server') { } } -// Create the application. -$application = new Webtrees(); -$application->bootstrap(); - -// Select a PSR message factory. -$application->selectMessageFactory(); - -// The application is defined by a stack of middleware and a PSR-11 container. -$middleware = $application->middleware(); -$container = app(); -$dispatcher = new Dispatcher($middleware, $container); +$webtrees = new Webtrees(); +$webtrees->bootstrap(); -// Build the request from the PHP super-globals. -$request = app(ServerRequestCreator::class)->fromGlobals(); - -$dispatcher->dispatch($request); +if (PHP_SAPI === 'cli') { + $webtrees->cliRequest(); +} else { + $webtrees->httpRequest(); +} |
