Skip to content

Commit

Permalink
Merge pull request #5400 from BookStackApp/laravel11
Browse files Browse the repository at this point in the history
Laravel 11 Upgrade
  • Loading branch information
ssddanbrown authored Jan 13, 2025
2 parents ee88832 + dbda82e commit b975180
Show file tree
Hide file tree
Showing 20 changed files with 1,032 additions and 1,231 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.2', '8.3', '8.4']
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
jobs:
build:
if: ${{ github.ref != 'refs/heads/l10n_development' }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
php: ['8.2', '8.3', '8.4']
steps:
- uses: actions/checkout@v4

Expand Down
49 changes: 13 additions & 36 deletions app/Access/ExternalBaseUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,15 @@

class ExternalBaseUserProvider implements UserProvider
{
/**
* The user model.
*
* @var string
*/
protected $model;

/**
* LdapUserProvider constructor.
*/
public function __construct(string $model)
{
$this->model = $model;
public function __construct(
protected string $model
) {
}

/**
* Create a new instance of the model.
*
* @return Model
*/
public function createModel()
public function createModel(): Model
{
$class = '\\' . ltrim($this->model, '\\');

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

/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
*
* @return Authenticatable|null
*/
public function retrieveById($identifier)
public function retrieveById(mixed $identifier): ?Authenticatable
{
return $this->createModel()->newQuery()->find($identifier);
}

/**
* Retrieve a user by their unique identifier and "remember me" token.
*
* @param mixed $identifier
* @param string $token
*
* @return Authenticatable|null
*/
public function retrieveByToken($identifier, $token)
public function retrieveByToken(mixed $identifier, $token): null
{
return null;
}
Expand All @@ -75,12 +56,8 @@ public function updateRememberToken(Authenticatable $user, $token)

/**
* Retrieve a user by the given credentials.
*
* @param array $credentials
*
* @return Authenticatable|null
*/
public function retrieveByCredentials(array $credentials)
public function retrieveByCredentials(array $credentials): ?Authenticatable
{
// Search current user base by looking up a uid
$model = $this->createModel();
Expand All @@ -92,15 +69,15 @@ public function retrieveByCredentials(array $credentials)

/**
* Validate a user against the given credentials.
*
* @param Authenticatable $user
* @param array $credentials
*
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
public function validateCredentials(Authenticatable $user, array $credentials): bool
{
// Should be done in the guard.
return false;
}

public function rehashPasswordIfRequired(Authenticatable $user, #[\SensitiveParameter] array $credentials, bool $force = false)
{
// No action to perform, any passwords are external in the auth system
}
}
17 changes: 0 additions & 17 deletions app/Activity/Models/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Comment extends Model implements Loggable
use HasCreatorAndUpdater;

protected $fillable = ['parent_id'];
protected $appends = ['created', 'updated'];

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

/**
* Get created date as a relative diff.
*/
public function getCreatedAttribute(): string
{
return $this->created_at->diffForHumans();
}

/**
* Get updated date as a relative diff.
*/
public function getUpdatedAttribute(): string
{
return $this->updated_at->diffForHumans();
}

public function logDescriptor(): string
{
return "Comment #{$this->local_id} (ID: {$this->id}) for {$this->entity_type} (ID: {$this->entity_id})";
Expand Down
8 changes: 8 additions & 0 deletions app/App/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ public function shouldDiscoverEvents(): bool
{
return false;
}

/**
* Overrides the registration of Laravel's default email verification system
*/
protected function configureEmailVerification(): void
{
//
}
}
37 changes: 0 additions & 37 deletions app/Config/broadcasting.php

This file was deleted.

5 changes: 1 addition & 4 deletions app/Config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
// Available caches stores
'stores' => [

'apc' => [
'driver' => 'apc',
],

'array' => [
'driver' => 'array',
'serialize' => false,
Expand All @@ -49,6 +45,7 @@
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
'lock_table' => null,
],

'file' => [
Expand Down
3 changes: 3 additions & 0 deletions app/Config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@
'driver' => 'local',
'root' => public_path(),
'visibility' => 'public',
'serve' => false,
'throw' => true,
],

'local_secure_attachments' => [
'driver' => 'local',
'root' => storage_path('uploads/files/'),
'serve' => false,
'throw' => true,
],

'local_secure_images' => [
'driver' => 'local',
'root' => storage_path('uploads/images/'),
'visibility' => 'public',
'serve' => false,
'throw' => true,
],

Expand Down
10 changes: 1 addition & 9 deletions app/Config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'password' => env('MAIL_PASSWORD'),
'verify_peer' => env('MAIL_VERIFY_SSL', true),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
'local_domain' => null,
'tls_required' => ($mailEncryption === 'tls' || $mailEncryption === 'ssl'),
],

Expand All @@ -64,12 +64,4 @@
],
],
],

// Email markdown configuration
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
1 change: 1 addition & 0 deletions app/Config/queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

'database' => [
'driver' => 'database',
'connection' => null,
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
Expand Down
1 change: 0 additions & 1 deletion app/Uploads/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use BookStack\Exceptions\FileUploadException;
use Exception;
use Illuminate\Contracts\Filesystem\Filesystem as Storage;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Filesystem\FilesystemManager;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1.0",
"php": "^8.2.0",
"ext-curl": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
Expand All @@ -18,12 +18,11 @@
"ext-xml": "*",
"ext-zip": "*",
"bacon/bacon-qr-code": "^3.0",
"doctrine/dbal": "^3.5",
"dompdf/dompdf": "^3.0",
"guzzlehttp/guzzle": "^7.4",
"intervention/image": "^3.5",
"knplabs/knp-snappy": "^1.5",
"laravel/framework": "^10.48.23",
"laravel/framework": "^v11.37",
"laravel/socialite": "^5.10",
"laravel/tinker": "^2.8",
"league/commonmark": "^2.3",
Expand All @@ -40,17 +39,17 @@
"socialiteproviders/okta": "^4.2",
"socialiteproviders/twitch": "^5.3",
"ssddanbrown/htmldiff": "^1.0.2",
"ssddanbrown/symfony-mailer": "6.4.x-dev"
"ssddanbrown/symfony-mailer": "7.2.x-dev"
},
"require-dev": {
"fakerphp/faker": "^1.21",
"itsgoingd/clockwork": "^5.1",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^7.0",
"larastan/larastan": "^2.7",
"phpunit/phpunit": "^10.0",
"nunomaduro/collision": "^8.1",
"larastan/larastan": "^v3.0",
"phpunit/phpunit": "^11.5",
"squizlabs/php_codesniffer": "^3.7",
"ssddanbrown/asserthtml": "^3.0"
"ssddanbrown/asserthtml": "^3.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -104,7 +103,7 @@
"preferred-install": "dist",
"sort-packages": true,
"platform": {
"php": "8.1.0"
"php": "8.2.0"
}
},
"extra": {
Expand Down
Loading

0 comments on commit b975180

Please sign in to comment.