From 7bccb3335146b1ece112dc3731a6b33cdf751066 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 4 Oct 2023 22:48:24 +0200 Subject: [PATCH] Revert "Remove custom and use original laravel files" This reverts commit 77baea70f5a31989d8472228fbfb86a548fa0e07. --- artisan | 82 ++++++++++++++++++------------------- bootstrap/app.php | 92 +++++++++++++++++++++--------------------- bootstrap/autoload.php | 15 +++++++ public/index.php | 58 +++++--------------------- server.php | 19 +++++++++ 5 files changed, 129 insertions(+), 137 deletions(-) create mode 100644 bootstrap/autoload.php create mode 100644 server.php diff --git a/artisan b/artisan index 0cf63cb67..1f46ff31a 100755 --- a/artisan +++ b/artisan @@ -1,53 +1,51 @@ #!/usr/bin/env php make(Illuminate\Contracts\Console\Kernel::class); - $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); +$status = $kernel->handle( + $input = new Symfony\Component\Console\Input\ArgvInput, + new Symfony\Component\Console\Output\ConsoleOutput +); - $status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput - ); +/* +|-------------------------------------------------------------------------- +| Shutdown The Application +|-------------------------------------------------------------------------- +| +| Once Artisan has finished running, we will fire off the shutdown events +| so that any final work may be done by the application before we shut +| down the process. This is the last thing to happen to the request. +| +*/ - /* - |-------------------------------------------------------------------------- - | Shutdown The Application - |-------------------------------------------------------------------------- - | - | Once Artisan has finished running, we will fire off the shutdown events - | so that any final work may be done by the application before we shut - | down the process. This is the last thing to happen to the request. - | - */ +$kernel->terminate($input, $status); - $kernel->terminate($input, $status); - - exit($status); +exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index c56e46699..037e17df0 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,55 +1,55 @@ singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class - ); +$app->singleton( + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class +); - $app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class - ); +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); - $app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class - ); +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); - /* - |-------------------------------------------------------------------------- - | Return The Application - |-------------------------------------------------------------------------- - | - | This script returns the application instance. The instance is given to - | the calling script so we can separate the building of the instances - | from the actual running of the application and sending responses. - | - */ +/* +|-------------------------------------------------------------------------- +| Return The Application +|-------------------------------------------------------------------------- +| +| This script returns the application instance. The instance is given to +| the calling script so we can separate the building of the instances +| from the actual running of the application and sending responses. +| +*/ - return $app; +return $app; diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php new file mode 100644 index 000000000..eec58a304 --- /dev/null +++ b/bootstrap/autoload.php @@ -0,0 +1,15 @@ +make(); + +$dotenv = Dotenv::create($repository, dirname(__DIR__, 1), null)->load(); + +$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); diff --git a/public/index.php b/public/index.php index 58500ccd5..8eb0733d7 100644 --- a/public/index.php +++ b/public/index.php @@ -1,55 +1,15 @@ make(Illuminate\Contracts\Http\Kernel::class); - /* - |-------------------------------------------------------------------------- - | Register The Auto Loader - |-------------------------------------------------------------------------- - | - | Composer provides a convenient, automatically generated class loader for - | this application. We just need to utilize it! We'll simply require it - | into the script here so we don't need to manually load our classes. - | - */ - - require __DIR__.'/../vendor/autoload.php'; - - /* - |-------------------------------------------------------------------------- - | Run The Application - |-------------------------------------------------------------------------- - | - | Once we have the application, we can handle the incoming request using - | the application's HTTP kernel. Then, we will send the response back - | to this client's browser, allowing them to enjoy our application. - | - */ - - $app = require_once __DIR__.'/../bootstrap/app.php'; - - $kernel = $app->make(Kernel::class); - - $response = $kernel->handle( - $request = Request::capture() - )->send(); - - $kernel->terminate($request, $response); +$response = $kernel->handle($request = Illuminate\Http\Request::capture()); +$response->send(); +$kernel->terminate($request, $response); diff --git a/server.php b/server.php new file mode 100644 index 000000000..20bc389f0 --- /dev/null +++ b/server.php @@ -0,0 +1,19 @@ + + */ +$uri = urldecode( + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) +); + +// This file allows us to emulate Apache's "mod_rewrite" functionality from the +// built-in PHP web server. This provides a convenient way to test a Laravel +// application without having installed a "real" web server software here. +if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { + return false; +} + +require_once __DIR__.'/public/index.php';