Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit 063824a

Browse files
committed
make kernel safe in Mode Simple
1 parent 04cbeb2 commit 063824a

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

config/laravelfly-app-config.example.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,22 @@
3939

4040

4141
/**
42-
* Which properties of base services need to backup. Only for Mode Simple
42+
* Which properties of kernel and base services need to backup. Only for Mode Simple
4343
*
4444
* See: Illuminate\Foundation\Application::registerBaseServiceProviders
4545
*/
4646
'BaseServices' => [
4747

48+
\Illuminate\Contracts\Http\Kernel::class => [
49+
/** depends
50+
* Uncomment it if it's not always same across multiple request. They may be changed by Route::middleware
51+
* No need worry about same middlewares are added multiple times,
52+
* because there's a check in Illuminate\Foundation\Http::pushMiddleware or prependMiddleware:
53+
* if (array_search($middleware, $this->middleware) === false)
54+
*/
55+
// 'middleware',
56+
],
57+
4858
/* Illuminate\Events\EventServiceProvider::class : */
4959
'events' => [
5060
'listeners', 'wildcards', 'queueResolver',
@@ -67,12 +77,13 @@
6777
* //'currentRequest',
6878
*/
6979

80+
/* Illuminate\Routing\RouteCollection */
7081
'obj.routes' => [
7182
/** depends
7283
*
73-
* Uncomment them if some of your routes are created during any request.
74-
* Besides, because values of these four properties are associate arrays,
75-
* if names of routes created during request are sometime different , please uncomment them ,
84+
* Uncomment them if routes created during requests are different.
85+
* Most cases, Service Providers add same routes, like DebugBar(Barryvdh\Debugbar\ServiceProvider),
86+
* so it's not needed to comment them because they are of associate array.
7687
*/
7788
// 'routes' , 'allRoutes' , 'nameList' , 'actionList' ,
7889
],

doc/tinker.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ tinker use examples.
5757
```php
5858
// visit private members
5959
sudo app()->booted
60+
sudo app('router')->routes->actionList
61+
// Mode Map
6062
sudo $view= app()::$corDict[1]['instances']['view']
6163

6264
// use Model or Controller without writing namespace, thanks to ClassAliasAutoloader
@@ -81,11 +83,14 @@ xdebug_call_class()
8183
$__file
8284

8385
// check server pid and pidfile
84-
LaravelFly\Fly::getServer()
86+
Fly::getServer()
87+
//same as LaravelFly\Fly::getServer()
8588

8689
// which class aliases are defined in tinker
8790
sudo app('tinker')->loader->classes
8891

92+
sudo $middle = Fly::getServer()->kernel->middleware
93+
8994
// run shell commands
9095
`pwd && ls `
9196

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Another nginx conf [use_swoole_or_fpm_depending_on_clients](config/use_swoole_or
8282
## Todo Abut Avoiding Data Pollution
8383

8484
- [x] Application.
85+
- [x] Kernel.
8586
- [x] Base Services: Dispatcher/app('event'), Router/app('router') and UrlGenerator/app('url').
8687
- [x] Other Service Providers. configurable in config/laravel.php
8788
- [x] Facade.

src/LaravelFly/Server/HttpServer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ public function onMapRequest(\swoole_http_request $request, \swoole_http_respons
9292
$this->app->initForRequestCorontine($cid);
9393

9494
// why use clone for kernel, because
95-
// there's a \App\Http\Kernel which is controlled by users and
95+
// there's a \App\Http\Kernel which is controlled by users so that it's hard to add `use Dict`
96+
// and
9697
// todo
9798
// there's no objects using a ref to kernel
99+
//
100+
// need to update application container?
98101
$requestKernel = clone $this->kernel;
99102

100103
$laravel_response = $requestKernel->handle($laravel_request);

0 commit comments

Comments
 (0)