mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 16:13:54 +00:00
Update configuration and fix some files.
This commit is contained in:
@@ -43,6 +43,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use function Safe\mb_regex_encoding;
|
||||
use function Safe\json_encode;
|
||||
|
||||
/**
|
||||
* This command was inspired by https://github.com/elliot-gh. It will check all amount fields
|
||||
* and their values and correct them to the correct number of decimal places. This fixes issues where
|
||||
@@ -130,7 +133,7 @@ class ForcesDecimalSize extends Command
|
||||
// if sqlite, add function?
|
||||
if ('sqlite' === (string) config('database.default')) {
|
||||
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) {
|
||||
\Safe\mb_regex_encoding('UTF-8');
|
||||
mb_regex_encoding('UTF-8');
|
||||
$pattern = trim($pattern, '"');
|
||||
|
||||
return (false !== mb_ereg($pattern, (string) $value)) ? 1 : 0;
|
||||
@@ -234,7 +237,7 @@ class ForcesDecimalSize extends Command
|
||||
/** @var Builder $query */
|
||||
$query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
;
|
||||
$query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
@@ -338,7 +341,7 @@ class ForcesDecimalSize extends Command
|
||||
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
@@ -394,7 +397,7 @@ class ForcesDecimalSize extends Command
|
||||
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
@@ -448,7 +451,7 @@ class ForcesDecimalSize extends Command
|
||||
$query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Console\Commands\System;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\System\GeneratesInstallationId;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -111,8 +112,8 @@ class OutputsInstructions extends Command
|
||||
*/
|
||||
private function showLogo(): void
|
||||
{
|
||||
$today = date('m-d');
|
||||
$month = date('m');
|
||||
$today = Carbon::now()->format('m-d');
|
||||
$month = Carbon::now()->format('m');
|
||||
// variation in colors and effects just because I can!
|
||||
// default is Ukraine flag:
|
||||
$colors = ['blue', 'blue', 'blue', 'yellow', 'yellow', 'yellow', 'default', 'default'];
|
||||
|
@@ -31,6 +31,11 @@ use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use function Safe\tempnam;
|
||||
use function Safe\file_put_contents;
|
||||
use function Safe\md5_file;
|
||||
use function Safe\mime_content_type;
|
||||
|
||||
class ScansAttachments extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
@@ -63,15 +68,15 @@ class ScansAttachments extends Command
|
||||
app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||
$decryptedContent = $encryptedContent;
|
||||
}
|
||||
$tempFileName = \Safe\tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||
if (false === $tempFileName) {
|
||||
app('log')->error(sprintf('Could not create temporary file for attachment #%d', $attachment->id));
|
||||
|
||||
exit(1);
|
||||
}
|
||||
\Safe\file_put_contents($tempFileName, $decryptedContent);
|
||||
$attachment->md5 = (string) \Safe\md5_file($tempFileName);
|
||||
$attachment->mime = (string) \Safe\mime_content_type($tempFileName);
|
||||
file_put_contents($tempFileName, $decryptedContent);
|
||||
$attachment->md5 = (string) md5_file($tempFileName);
|
||||
$attachment->mime = (string) mime_content_type($tempFileName);
|
||||
$attachment->save();
|
||||
$this->friendlyInfo(sprintf('Fixed attachment #%d', $attachment->id));
|
||||
}
|
||||
|
@@ -30,6 +30,8 @@ use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Flysystem\FilesystemException;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
class VerifySecurityAlerts extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
@@ -57,7 +59,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
$content = $disk->get('alerts.json');
|
||||
$json = \Safe\json_decode($content, true, 10);
|
||||
$json = json_decode((string) $content, true, 10);
|
||||
|
||||
/** @var array $array */
|
||||
foreach ($json as $array) {
|
||||
|
Reference in New Issue
Block a user