summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2021-05-06 16:02:43 +0100
committerGreg Roach <fisharebest@gmail.com>2021-05-06 16:02:43 +0100
commit785274b8f4460085b440e020f349e7d085ed4abb (patch)
tree257b764fc6f01b4eba3689582497b03f168d03b0 /index.php
parent00c45d2300a5375d4779bf9dbe157d4ef56b9443 (diff)
downloadwebtrees-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.php26
1 files changed, 7 insertions, 19 deletions
diff --git a/index.php b/index.php
index e63958716f..2c897de22b 100644
--- a/index.php
+++ b/index.php
@@ -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();
+}