Skip to content

Commit f139cde

Browse files
Laravel 8 shift squash & merge (BookStackApp#3029)
* Temporarily moved back config path * Apply Laravel coding style * Shift exception handler * Shift HTTP kernel and middleware * Shift service providers * Convert options array to fluent methods * Shift to class based routes * Shift console routes * Ignore temporary framework files * Shift to class based factories * Namespace seeders * Shift PSR-4 autoloading * Shift config files * Default config files * Shift Laravel dependencies * Shift return type of base TestCase methods * Shift cleanup * Applied stylci style changes * Reverted config files location * Applied manual changes to Laravel 8 shift Co-authored-by: Shift <shift@laravelshift.com>
1 parent f77236a commit f139cde

71 files changed

Lines changed: 1353 additions & 920 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎app/Actions/Comment.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use BookStack\Model;
66
use BookStack\Traits\HasCreatorAndUpdater;
7+
use Illuminate\Database\Eloquent\Factories\HasFactory;
78
use Illuminate\Database\Eloquent\Relations\MorphTo;
89

910
/**
@@ -15,6 +16,7 @@
1516
*/
1617
class Comment extends Model
1718
{
19+
use HasFactory;
1820
use HasCreatorAndUpdater;
1921

2022
protected $fillable = ['text', 'parent_id'];

‎app/Actions/Tag.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
namespace BookStack\Actions;
44

55
use BookStack\Model;
6+
use Illuminate\Database\Eloquent\Factories\HasFactory;
67
use Illuminate\Database\Eloquent\Relations\MorphTo;
78

89
class Tag extends Model
910
{
11+
use HasFactory;
12+
1013
protected $fillable = ['name', 'value', 'order'];
1114
protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
1215

‎app/Auth/Role.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use BookStack\Interfaces\Loggable;
88
use BookStack\Model;
99
use Illuminate\Database\Eloquent\Collection;
10+
use Illuminate\Database\Eloquent\Factories\HasFactory;
1011
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
1112
use Illuminate\Database\Eloquent\Relations\HasMany;
1213

@@ -23,6 +24,8 @@
2324
*/
2425
class Role extends Model implements Loggable
2526
{
27+
use HasFactory;
28+
2629
protected $fillable = ['display_name', 'description', 'external_auth_id'];
2730

2831
/**

‎app/Auth/User.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
1919
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
2020
use Illuminate\Database\Eloquent\Builder;
21+
use Illuminate\Database\Eloquent\Factories\HasFactory;
2122
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2223
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
2324
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -43,6 +44,7 @@
4344
*/
4445
class User extends Model implements AuthenticatableContract, CanResetPasswordContract, Loggable, Sluggable
4546
{
47+
use HasFactory;
4648
use Authenticatable;
4749
use CanResetPassword;
4850
use Notifiable;

‎app/Config/app.php‎

100755100644
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143

144144
// Class aliases, Registered on application start
145145
'aliases' => [
146-
147146
// Laravel
148147
'App' => Illuminate\Support\Facades\App::class,
149148
'Arr' => Illuminate\Support\Arr::class,
@@ -155,21 +154,23 @@
155154
'Config' => Illuminate\Support\Facades\Config::class,
156155
'Cookie' => Illuminate\Support\Facades\Cookie::class,
157156
'Crypt' => Illuminate\Support\Facades\Crypt::class,
157+
'Date' => Illuminate\Support\Facades\Date::class,
158158
'DB' => Illuminate\Support\Facades\DB::class,
159159
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
160160
'Event' => Illuminate\Support\Facades\Event::class,
161161
'File' => Illuminate\Support\Facades\File::class,
162+
'Gate' => Illuminate\Support\Facades\Gate::class,
162163
'Hash' => Illuminate\Support\Facades\Hash::class,
163-
'Input' => Illuminate\Support\Facades\Input::class,
164-
'Inspiring' => Illuminate\Foundation\Inspiring::class,
164+
'Http' => Illuminate\Support\Facades\Http::class,
165165
'Lang' => Illuminate\Support\Facades\Lang::class,
166166
'Log' => Illuminate\Support\Facades\Log::class,
167167
'Mail' => Illuminate\Support\Facades\Mail::class,
168168
'Notification' => Illuminate\Support\Facades\Notification::class,
169169
'Password' => Illuminate\Support\Facades\Password::class,
170170
'Queue' => Illuminate\Support\Facades\Queue::class,
171+
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
171172
'Redirect' => Illuminate\Support\Facades\Redirect::class,
172-
'Redis' => Illuminate\Support\Facades\Redis::class,
173+
// 'Redis' => Illuminate\Support\Facades\Redis::class,
173174
'Request' => Illuminate\Support\Facades\Request::class,
174175
'Response' => Illuminate\Support\Facades\Response::class,
175176
'Route' => Illuminate\Support\Facades\Route::class,
@@ -180,6 +181,8 @@
180181
'URL' => Illuminate\Support\Facades\URL::class,
181182
'Validator' => Illuminate\Support\Facades\Validator::class,
182183
'View' => Illuminate\Support\Facades\View::class,
184+
185+
// Laravel Packages
183186
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
184187

185188
// Third Party

‎app/Config/auth.php‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
return [
1212

13-
// Method of authentication to use
1413
// Options: standard, ldap, saml2, oidc
1514
'method' => env('AUTH_METHOD', 'standard'),
1615

@@ -45,7 +44,7 @@
4544
'provider' => 'external',
4645
],
4746
'api' => [
48-
'driver' => 'api-token',
47+
'driver' => 'api-token',
4948
],
5049
],
5150

@@ -58,10 +57,16 @@
5857
'driver' => 'eloquent',
5958
'model' => \BookStack\Auth\User::class,
6059
],
60+
6161
'external' => [
6262
'driver' => 'external-users',
6363
'model' => \BookStack\Auth\User::class,
6464
],
65+
66+
// 'users' => [
67+
// 'driver' => 'database',
68+
// 'table' => 'users',
69+
// ],
6570
],
6671

6772
// Resetting Passwords
@@ -78,4 +83,10 @@
7883
],
7984
],
8085

86+
// Password Confirmation Timeout
87+
// Here you may define the amount of seconds before a password confirmation
88+
// times out and the user is prompted to re-enter their password via the
89+
// confirmation screen. By default, the timeout lasts for three hours.
90+
'password_timeout' => 10800,
91+
8192
];

‎app/Config/broadcasting.php‎

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,79 @@
11
<?php
22

33
/**
4-
* Broadcasting configuration options.
4+
* Caching configuration options.
55
*
66
* Changes to these config files are not supported by BookStack and may break upon updates.
77
* Configuration should be altered via the `.env` file or environment variables.
88
* Do not edit this file unless you're happy to maintain any changes yourself.
99
*/
1010

11+
// MEMCACHED - Split out configuration into an array
12+
if (env('CACHE_DRIVER') === 'memcached') {
13+
$memcachedServerKeys = ['host', 'port', 'weight'];
14+
$memcachedServers = explode(',', trim(env('MEMCACHED_SERVERS', '127.0.0.1:11211:100'), ','));
15+
foreach ($memcachedServers as $index => $memcachedServer) {
16+
$memcachedServerDetails = explode(':', $memcachedServer);
17+
if (count($memcachedServerDetails) < 2) {
18+
$memcachedServerDetails[] = '11211';
19+
}
20+
if (count($memcachedServerDetails) < 3) {
21+
$memcachedServerDetails[] = '100';
22+
}
23+
$memcachedServers[$index] = array_combine($memcachedServerKeys, $memcachedServerDetails);
24+
}
25+
}
26+
1127
return [
1228

13-
// Default Broadcaster
14-
// This option controls the default broadcaster that will be used by the
15-
// framework when an event needs to be broadcast. This can be set to
16-
// any of the connections defined in the "connections" array below.
17-
'default' => env('BROADCAST_DRIVER', 'pusher'),
18-
19-
// Broadcast Connections
20-
// Here you may define all of the broadcast connections that will be used
21-
// to broadcast events to other systems or over websockets. Samples of
22-
// each available type of connection are provided inside this array.
23-
'connections' => [
24-
25-
'pusher' => [
26-
'driver' => 'pusher',
27-
'key' => env('PUSHER_APP_KEY'),
28-
'secret' => env('PUSHER_APP_SECRET'),
29-
'app_id' => env('PUSHER_APP_ID'),
30-
'options' => [
31-
'cluster' => env('PUSHER_APP_CLUSTER'),
32-
'useTLS' => true,
33-
],
29+
// Default cache store to use
30+
// Can be overridden at cache call-time
31+
'default' => env('CACHE_DRIVER', 'file'),
32+
33+
// Available caches stores
34+
'stores' => [
35+
36+
'apc' => [
37+
'driver' => 'apc',
3438
],
3539

36-
'redis' => [
37-
'driver' => 'redis',
38-
'connection' => 'default',
40+
'array' => [
41+
'driver' => 'array',
42+
'serialize' => false,
43+
],
44+
45+
'database' => [
46+
'driver' => 'database',
47+
'table' => 'cache',
48+
'connection' => null,
49+
'lock_connection' => null,
3950
],
4051

41-
'log' => [
42-
'driver' => 'log',
52+
'file' => [
53+
'driver' => 'file',
54+
'path' => storage_path('framework/cache'),
4355
],
4456

45-
'null' => [
46-
'driver' => 'null',
57+
'memcached' => [
58+
'driver' => 'memcached',
59+
'servers' => env('CACHE_DRIVER') === 'memcached' ? $memcachedServers : [],
60+
'options' => [],
61+
],
62+
63+
'redis' => [
64+
'driver' => 'redis',
65+
'connection' => 'default',
66+
'lock_connection' => 'default',
67+
],
68+
69+
'octane' => [
70+
'driver' => 'octane',
4771
],
4872

4973
],
5074

75+
// Cache key prefix
76+
// Used to prevent collisions in shared cache systems.
77+
'prefix' => env('CACHE_PREFIX', 'bookstack_cache'),
78+
5179
];

0 commit comments

Comments
 (0)