Skip to content

Commit

Permalink
Framework: Performed Laravel 11 upgrade guide steps
Browse files Browse the repository at this point in the history
Performed a little code cleanups when observed along the way.
Tested not yet ran.
  • Loading branch information
ssddanbrown committed Jan 11, 2025
1 parent 5116d83 commit cf9ccfc
Show file tree
Hide file tree
Showing 12 changed files with 694 additions and 919 deletions.
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
}
}
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
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -39,14 +38,13 @@
"socialiteproviders/microsoft-azure": "^5.1",
"socialiteproviders/okta": "^4.2",
"socialiteproviders/twitch": "^5.3",
"ssddanbrown/htmldiff": "^1.0.2",
"ssddanbrown/symfony-mailer": "6.4.x-dev"
"ssddanbrown/htmldiff": "^1.0.2"
},
"require-dev": {
"fakerphp/faker": "^1.21",
"itsgoingd/clockwork": "^5.1",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^7.0",
"nunomaduro/collision": "^8.1",
"larastan/larastan": "^2.7",
"phpunit/phpunit": "^10.0",
"squizlabs/php_codesniffer": "^3.7",
Expand Down
Loading

0 comments on commit cf9ccfc

Please sign in to comment.