Skip to content

Commit b975180

Browse files
authored
Merge pull request #5400 from BookStackApp/laravel11
Laravel 11 Upgrade
2 parents ee88832 + dbda82e commit b975180

20 files changed

+1032
-1231
lines changed

.github/workflows/test-migrations.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
strategy:
1818
matrix:
19-
php: ['8.1', '8.2', '8.3', '8.4']
19+
php: ['8.2', '8.3', '8.4']
2020
steps:
2121
- uses: actions/checkout@v4
2222

.github/workflows/test-php.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ on:
1313
jobs:
1414
build:
1515
if: ${{ github.ref != 'refs/heads/l10n_development' }}
16-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1717
strategy:
1818
matrix:
19-
php: ['8.1', '8.2', '8.3', '8.4']
19+
php: ['8.2', '8.3', '8.4']
2020
steps:
2121
- uses: actions/checkout@v4
2222

app/Access/ExternalBaseUserProvider.php

+13-36
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@
88

99
class ExternalBaseUserProvider implements UserProvider
1010
{
11-
/**
12-
* The user model.
13-
*
14-
* @var string
15-
*/
16-
protected $model;
17-
18-
/**
19-
* LdapUserProvider constructor.
20-
*/
21-
public function __construct(string $model)
22-
{
23-
$this->model = $model;
11+
public function __construct(
12+
protected string $model
13+
) {
2414
}
2515

2616
/**
2717
* Create a new instance of the model.
28-
*
29-
* @return Model
3018
*/
31-
public function createModel()
19+
public function createModel(): Model
3220
{
3321
$class = '\\' . ltrim($this->model, '\\');
3422

@@ -37,25 +25,18 @@ public function createModel()
3725

3826
/**
3927
* Retrieve a user by their unique identifier.
40-
*
41-
* @param mixed $identifier
42-
*
43-
* @return Authenticatable|null
4428
*/
45-
public function retrieveById($identifier)
29+
public function retrieveById(mixed $identifier): ?Authenticatable
4630
{
4731
return $this->createModel()->newQuery()->find($identifier);
4832
}
4933

5034
/**
5135
* Retrieve a user by their unique identifier and "remember me" token.
5236
*
53-
* @param mixed $identifier
5437
* @param string $token
55-
*
56-
* @return Authenticatable|null
5738
*/
58-
public function retrieveByToken($identifier, $token)
39+
public function retrieveByToken(mixed $identifier, $token): null
5940
{
6041
return null;
6142
}
@@ -75,12 +56,8 @@ public function updateRememberToken(Authenticatable $user, $token)
7556

7657
/**
7758
* Retrieve a user by the given credentials.
78-
*
79-
* @param array $credentials
80-
*
81-
* @return Authenticatable|null
8259
*/
83-
public function retrieveByCredentials(array $credentials)
60+
public function retrieveByCredentials(array $credentials): ?Authenticatable
8461
{
8562
// Search current user base by looking up a uid
8663
$model = $this->createModel();
@@ -92,15 +69,15 @@ public function retrieveByCredentials(array $credentials)
9269

9370
/**
9471
* Validate a user against the given credentials.
95-
*
96-
* @param Authenticatable $user
97-
* @param array $credentials
98-
*
99-
* @return bool
10072
*/
101-
public function validateCredentials(Authenticatable $user, array $credentials)
73+
public function validateCredentials(Authenticatable $user, array $credentials): bool
10274
{
10375
// Should be done in the guard.
10476
return false;
10577
}
78+
79+
public function rehashPasswordIfRequired(Authenticatable $user, #[\SensitiveParameter] array $credentials, bool $force = false)
80+
{
81+
// No action to perform, any passwords are external in the auth system
82+
}
10683
}

app/Activity/Models/Comment.php

-17
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class Comment extends Model implements Loggable
2626
use HasCreatorAndUpdater;
2727

2828
protected $fillable = ['parent_id'];
29-
protected $appends = ['created', 'updated'];
3029

3130
/**
3231
* Get the entity that this comment belongs to.
@@ -54,22 +53,6 @@ public function isUpdated(): bool
5453
return $this->updated_at->timestamp > $this->created_at->timestamp;
5554
}
5655

57-
/**
58-
* Get created date as a relative diff.
59-
*/
60-
public function getCreatedAttribute(): string
61-
{
62-
return $this->created_at->diffForHumans();
63-
}
64-
65-
/**
66-
* Get updated date as a relative diff.
67-
*/
68-
public function getUpdatedAttribute(): string
69-
{
70-
return $this->updated_at->diffForHumans();
71-
}
72-
7356
public function logDescriptor(): string
7457
{
7558
return "Comment #{$this->local_id} (ID: {$this->id}) for {$this->entity_type} (ID: {$this->entity_id})";

app/App/Providers/EventServiceProvider.php

+8
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,12 @@ public function shouldDiscoverEvents(): bool
4242
{
4343
return false;
4444
}
45+
46+
/**
47+
* Overrides the registration of Laravel's default email verification system
48+
*/
49+
protected function configureEmailVerification(): void
50+
{
51+
//
52+
}
4553
}

app/Config/broadcasting.php

-37
This file was deleted.

app/Config/cache.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
// Available caches stores
3636
'stores' => [
3737

38-
'apc' => [
39-
'driver' => 'apc',
40-
],
41-
4238
'array' => [
4339
'driver' => 'array',
4440
'serialize' => false,
@@ -49,6 +45,7 @@
4945
'table' => 'cache',
5046
'connection' => null,
5147
'lock_connection' => null,
48+
'lock_table' => null,
5249
],
5350

5451
'file' => [

app/Config/filesystems.php

+3
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,22 @@
3333
'driver' => 'local',
3434
'root' => public_path(),
3535
'visibility' => 'public',
36+
'serve' => false,
3637
'throw' => true,
3738
],
3839

3940
'local_secure_attachments' => [
4041
'driver' => 'local',
4142
'root' => storage_path('uploads/files/'),
43+
'serve' => false,
4244
'throw' => true,
4345
],
4446

4547
'local_secure_images' => [
4648
'driver' => 'local',
4749
'root' => storage_path('uploads/images/'),
4850
'visibility' => 'public',
51+
'serve' => false,
4952
'throw' => true,
5053
],
5154

app/Config/mail.php

+1-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
'password' => env('MAIL_PASSWORD'),
3939
'verify_peer' => env('MAIL_VERIFY_SSL', true),
4040
'timeout' => null,
41-
'local_domain' => env('MAIL_EHLO_DOMAIN'),
41+
'local_domain' => null,
4242
'tls_required' => ($mailEncryption === 'tls' || $mailEncryption === 'ssl'),
4343
],
4444

@@ -64,12 +64,4 @@
6464
],
6565
],
6666
],
67-
68-
// Email markdown configuration
69-
'markdown' => [
70-
'theme' => 'default',
71-
'paths' => [
72-
resource_path('views/vendor/mail'),
73-
],
74-
],
7567
];

app/Config/queue.php

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
'database' => [
2525
'driver' => 'database',
26+
'connection' => null,
2627
'table' => 'jobs',
2728
'queue' => 'default',
2829
'retry_after' => 90,

app/Uploads/FileStorage.php

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use BookStack\Exceptions\FileUploadException;
66
use Exception;
77
use Illuminate\Contracts\Filesystem\Filesystem as Storage;
8-
use Illuminate\Filesystem\FilesystemAdapter;
98
use Illuminate\Filesystem\FilesystemManager;
109
use Illuminate\Support\Facades\Log;
1110
use Illuminate\Support\Str;

composer.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "MIT",
99
"type": "project",
1010
"require": {
11-
"php": "^8.1.0",
11+
"php": "^8.2.0",
1212
"ext-curl": "*",
1313
"ext-dom": "*",
1414
"ext-fileinfo": "*",
@@ -18,12 +18,11 @@
1818
"ext-xml": "*",
1919
"ext-zip": "*",
2020
"bacon/bacon-qr-code": "^3.0",
21-
"doctrine/dbal": "^3.5",
2221
"dompdf/dompdf": "^3.0",
2322
"guzzlehttp/guzzle": "^7.4",
2423
"intervention/image": "^3.5",
2524
"knplabs/knp-snappy": "^1.5",
26-
"laravel/framework": "^10.48.23",
25+
"laravel/framework": "^v11.37",
2726
"laravel/socialite": "^5.10",
2827
"laravel/tinker": "^2.8",
2928
"league/commonmark": "^2.3",
@@ -40,17 +39,17 @@
4039
"socialiteproviders/okta": "^4.2",
4140
"socialiteproviders/twitch": "^5.3",
4241
"ssddanbrown/htmldiff": "^1.0.2",
43-
"ssddanbrown/symfony-mailer": "6.4.x-dev"
42+
"ssddanbrown/symfony-mailer": "7.2.x-dev"
4443
},
4544
"require-dev": {
4645
"fakerphp/faker": "^1.21",
4746
"itsgoingd/clockwork": "^5.1",
4847
"mockery/mockery": "^1.5",
49-
"nunomaduro/collision": "^7.0",
50-
"larastan/larastan": "^2.7",
51-
"phpunit/phpunit": "^10.0",
48+
"nunomaduro/collision": "^8.1",
49+
"larastan/larastan": "^v3.0",
50+
"phpunit/phpunit": "^11.5",
5251
"squizlabs/php_codesniffer": "^3.7",
53-
"ssddanbrown/asserthtml": "^3.0"
52+
"ssddanbrown/asserthtml": "^3.1"
5453
},
5554
"autoload": {
5655
"psr-4": {
@@ -104,7 +103,7 @@
104103
"preferred-install": "dist",
105104
"sort-packages": true,
106105
"platform": {
107-
"php": "8.1.0"
106+
"php": "8.2.0"
108107
}
109108
},
110109
"extra": {

0 commit comments

Comments
 (0)