Skip to content

Commit 29dabb3

Browse files
committed
Merge branch '4.x' into develop
2 parents f4f0b9a + df57006 commit 29dabb3

File tree

33 files changed

+162
-194
lines changed

33 files changed

+162
-194
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- 2.x
77
- 3.x
8+
- 4.x
89
- develop
910
pull_request:
1011

@@ -14,7 +15,7 @@ jobs:
1415
strategy:
1516
max-parallel: 6
1617
matrix:
17-
phpVersions: ['8.0', '8.1', '8.2', '8.3']
18+
phpVersions: ['8.2', '8.3', '8.4']
1819
fail-fast: false
1920
name: PHP ${{ matrix.phpVersions }}
2021
steps:

src/Assetic/Factory/AssetFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AssetFactory
5151
*/
5252
public function __construct($root, $debug = false)
5353
{
54-
$this->root = rtrim($root, '/');
54+
$this->root = $root ? rtrim($root, '/') : '';
5555
$this->debug = $debug;
5656
$this->output = 'assetic/*';
5757
}

src/Database/DatabaseServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace October\Rain\Database;
22

3+
use October\Rain\Database\Updater;
34
use October\Rain\Database\Schema\Blueprint;
45
use October\Rain\Database\Connectors\ConnectionFactory;
56
use Illuminate\Database\DatabaseServiceProvider as DatabaseServiceProviderBase;
@@ -76,6 +77,10 @@ protected function registerConnectionServices()
7677
$this->app->singleton('db.dongle', function ($app) {
7778
return new Dongle($this->getDefaultDatabaseDriver(), $app['db']);
7879
});
80+
81+
$this->app->singleton('db.updater', function ($app) {
82+
return new Updater;
83+
});
7984
}
8085

8186
/**

src/Database/MigrationServiceProvider.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Flash/FlashServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public function register()
2222
*/
2323
public function provides()
2424
{
25-
return ['flash'];
25+
return ['flash', FlashBag::class];
2626
}
2727
}

src/Foundation/Application.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,10 @@ public function registerConfiguredProviders()
328328
public function registerCoreContainerAliases()
329329
{
330330
$aliases = [
331+
// These are introduced externally, for example, RainLab.User plugin
332+
// 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class],
333+
// 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class],
331334
'app' => [\October\Rain\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class],
332-
'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class],
333-
'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class],
334335
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
335336
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
336337
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class, \Psr\SimpleCache\CacheInterface::class],
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php namespace October\Rain\Foundation\Bootstrap;
2+
3+
use Config;
4+
use Illuminate\Foundation\Bootstrap\HandleExceptions as HandleExceptionsBase;
5+
6+
/**
7+
* HandleExceptions is a registration point for handling exceptions
8+
*/
9+
class HandleExceptions extends HandleExceptionsBase
10+
{
11+
/**
12+
* shouldIgnoreDeprecationErrors determine if deprecation errors should be ignored.
13+
*
14+
* The logic here used by Laravel is unsatisfactory since the MessageLogged event
15+
* won't distinguish between exceptions and deprecations or the log driver used,
16+
* so a custom configuration key is included as part of the core system.
17+
*
18+
* @return bool
19+
*/
20+
protected function shouldIgnoreDeprecationErrors()
21+
{
22+
if (Config::get('system.log_deprecations', false) === false) {
23+
return true;
24+
}
25+
26+
return parent::shouldIgnoreDeprecationErrors();
27+
}
28+
}

src/Foundation/Configuration/ApplicationBuilder.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,34 @@ public function withExceptions(?callable $using = null)
5050

5151
return $this;
5252
}
53+
54+
/**
55+
* withMiddleware is a modifier to the parent logic to remove unwanted default middleware
56+
*/
57+
public function withMiddleware(?callable $callback = null)
58+
{
59+
$nested = function($middleware) use ($callback) {
60+
$middleware
61+
->remove([
62+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
63+
\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance::class,
64+
])
65+
->append([
66+
\October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
67+
])
68+
->removeFromGroup('web', [
69+
\Illuminate\Cookie\Middleware\EncryptCookies::class,
70+
\Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
71+
])
72+
->appendToGroup('web', [
73+
\October\Rain\Foundation\Http\Middleware\EncryptCookies::class,
74+
]);
75+
76+
if ($callback !== null) {
77+
$callback($middleware);
78+
}
79+
};
80+
81+
return parent::withMiddleware($nested);
82+
}
5383
}

src/Foundation/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel
1414
protected $bootstrappers = [
1515
\Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
1616
\October\Rain\Foundation\Bootstrap\LoadConfiguration::class,
17-
\Illuminate\Foundation\Bootstrap\HandleExceptions::class,
17+
\October\Rain\Foundation\Bootstrap\HandleExceptions::class,
1818
\Illuminate\Foundation\Bootstrap\RegisterFacades::class,
1919
\Illuminate\Foundation\Bootstrap\SetRequestForConsole::class,
2020
\October\Rain\Foundation\Bootstrap\RegisterOctober::class,

src/Foundation/Http/Kernel.php

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,67 +18,44 @@ class Kernel extends HttpKernel
1818
protected $bootstrappers = [
1919
\Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
2020
\October\Rain\Foundation\Bootstrap\LoadConfiguration::class,
21-
\Illuminate\Foundation\Bootstrap\HandleExceptions::class,
21+
\October\Rain\Foundation\Bootstrap\HandleExceptions::class,
2222
\Illuminate\Foundation\Bootstrap\RegisterFacades::class,
2323
\October\Rain\Foundation\Bootstrap\RegisterOctober::class,
2424
\October\Rain\Foundation\Bootstrap\RegisterProviders::class,
2525
\Illuminate\Foundation\Bootstrap\BootProviders::class,
2626
];
27+
2728
/**
28-
* The application's global HTTP middleware stack.
29-
*
30-
* @var array
29+
* @var array middleware is the application's global HTTP middleware stack.
3130
*/
32-
protected $middleware = [
33-
\October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
34-
];
31+
protected $middleware = [];
3532

3633
/**
37-
* The application's route middleware.
38-
*
39-
* @var array
34+
* @var array routeMiddleware is the application's route middleware.
4035
*/
41-
protected $routeMiddleware = [
42-
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
43-
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
44-
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
45-
'can' => \Illuminate\Auth\Middleware\Authorize::class,
46-
// 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
47-
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
48-
];
36+
protected $routeMiddleware = [];
4937

5038
/**
51-
* The application's route middleware groups.
52-
*
53-
* @var array
39+
* @var array middlewareGroups is the application's route middleware groups.
5440
*/
55-
protected $middlewareGroups = [
56-
'web' => [
57-
\October\Rain\Foundation\Http\Middleware\EncryptCookies::class,
58-
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
59-
\Illuminate\Session\Middleware\StartSession::class,
60-
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
61-
// \App\Http\Middleware\VerifyCsrfToken::class,
62-
\Illuminate\Routing\Middleware\SubstituteBindings::class,
63-
],
64-
'api' => [
65-
'throttle:60,1',
66-
'bindings',
67-
],
68-
];
41+
protected $middlewareGroups = [];
6942

7043
/**
71-
* The priority-sorted list of middleware.
44+
* @var array middlewarePriority is the priority-sorted list of middleware.
7245
*
7346
* Forces the listed middleware to always be in the given order.
74-
*
75-
* @var array
7647
*/
7748
protected $middlewarePriority = [
49+
\Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
50+
\October\Rain\Foundation\Http\Middleware\EncryptCookies::class,
51+
\Illuminate\Cookie\Middleware\EncryptCookies::class,
52+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
7853
\Illuminate\Session\Middleware\StartSession::class,
7954
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
80-
\Illuminate\Auth\Middleware\Authenticate::class,
81-
\Illuminate\Session\Middleware\AuthenticateSession::class,
55+
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
56+
\Illuminate\Routing\Middleware\ThrottleRequests::class,
57+
\Illuminate\Routing\Middleware\ThrottleRequestsWithRedis::class,
58+
\Illuminate\Contracts\Session\Middleware\AuthenticatesSessions::class,
8259
\Illuminate\Routing\Middleware\SubstituteBindings::class,
8360
\Illuminate\Auth\Middleware\Authorize::class,
8461
];

0 commit comments

Comments
 (0)