Update packages and various code for laravel 9

This commit is contained in:
James Cole
2022-03-19 08:10:42 +01:00
parent 45d99aa456
commit 5ca0a9f75a
7 changed files with 750 additions and 261 deletions

View File

@@ -27,7 +27,6 @@ use Crypt;
use FireflyIII\Models\Attachment;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Log;
use Storage;
@@ -62,10 +61,9 @@ class ScanAttachments extends Command
/** @var Attachment $attachment */
foreach ($attachments as $attachment) {
$fileName = $attachment->fileName();
try {
$encryptedContent = $disk->get($fileName);
} catch (FileNotFoundException $e) {
$this->error(sprintf('Could not find data for attachment #%d: %s', $attachment->id, $e->getMessage()));
if (null === $encryptedContent) {
Log::error(sprintf('No content for attachment #%d under filename "%s"', $attachment->id, $fileName));
continue;
}
try {

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Log;
use Storage;
@@ -51,7 +50,6 @@ class VerifySecurityAlerts extends Command
* Execute the console command.
*
* @return int
* @throws FileNotFoundException
*/
public function handle(): int
{

View File

@@ -28,7 +28,6 @@ use FireflyIII\Models\Attachment;
use FireflyIII\Models\PiggyBank;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Encryption\EncryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
@@ -77,15 +76,10 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
public function getAttachmentContent(Attachment $attachment): string
{
$encryptedData = '';
try {
$encryptedData = $this->uploadDisk->get(sprintf('at-%d.data', $attachment->id));
} catch (FileNotFoundException $e) {
Log::error($e->getMessage());
}
$encryptedData = (string) $this->uploadDisk->get(sprintf('at-%d.data', $attachment->id));
try {
$unencryptedData = Crypt::decrypt($encryptedData); // verified
} catch (DecryptException | FileNotFoundException $e) {
} catch (DecryptException $e) {
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$unencryptedData = $encryptedData;
}

View File

@@ -31,7 +31,6 @@ use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note;
use FireflyIII\User;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
use Log;
@@ -101,12 +100,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
$unencryptedContent = '';
if ($disk->exists($file)) {
$encryptedContent = '';
try {
$encryptedContent = $disk->get($file);
} catch (FileNotFoundException $e) {
Log::error($e->getMessage());
}
$encryptedContent = (string) $disk->get($file);
try {
$unencryptedContent = Crypt::decrypt($encryptedContent); // verified

View File

@@ -97,12 +97,16 @@
"league/commonmark": "2.*",
"league/csv": "^9.7",
"league/fractal": "0.*",
"nunomaduro/collision": "^6.1",
"pragmarx/google2fa": "^8.0",
"predis/predis": "^1.1",
"psr/log": "<3",
"ramsey/uuid": "^4.2",
"rcrowe/twigbridge": "^0.14",
"spatie/data-transfer-object": "^3.7"
"spatie/data-transfer-object": "^3.7",
"spatie/laravel-ignition": "^1.0",
"symfony/http-client": "^6.0",
"symfony/mailgun-mailer": "^6.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",

937
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,21 +33,7 @@ return [
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks