diff --git a/VERSION.txt b/VERSION.txt index eea8514679..cae032632b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.55 \ No newline at end of file +5.5.56 \ No newline at end of file diff --git a/app/Console/Commands/CreateAccount.php b/app/Console/Commands/CreateAccount.php index c0eaed16bc..8e6140a74e 100644 --- a/app/Console/Commands/CreateAccount.php +++ b/app/Console/Commands/CreateAccount.php @@ -134,6 +134,9 @@ class CreateAccount extends Command (new CreateCompanyPaymentTerms($company, $user))->handle(); (new CreateCompanyTaskStatuses($company, $user))->handle(); (new VersionCheck())->handle(); + + $this->warmCache(); + } private function warmCache() @@ -142,25 +145,20 @@ class CreateAccount extends Command $cached_tables = config('ninja.cached_tables'); foreach ($cached_tables as $name => $class) { - if (! Cache::has($name)) { - // check that the table exists in case the migration is pending - if (! Schema::hasTable((new $class())->getTable())) { - continue; - } - if ($name == 'payment_terms') { - $orderBy = 'num_days'; - } elseif ($name == 'fonts') { - $orderBy = 'sort_order'; - } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) { - $orderBy = 'name'; - } else { - $orderBy = 'id'; - } - $tableData = $class::orderBy($orderBy)->get(); - if ($tableData->count()) { - Cache::forever($name, $tableData); - } + if ($name == 'payment_terms') { + $orderBy = 'num_days'; + } elseif ($name == 'fonts') { + $orderBy = 'sort_order'; + } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) { + $orderBy = 'name'; + } else { + $orderBy = 'id'; } + $tableData = $class::orderBy($orderBy)->get(); + if ($tableData->count()) { + Cache::forever($name, $tableData); + } + } } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 2dd5218762..3286ebb730 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -16,12 +16,10 @@ use App\Exceptions\InternalPDFFailure; use App\Exceptions\PhantomPDFFailure; use App\Exceptions\StripeConnectFailure; use App\Utils\Ninja; -use Exception; use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\AuthenticationException; use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException; use Illuminate\Database\Eloquent\RelationNotFoundException; -use Illuminate\Database\QueryException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Http\Exceptions\ThrottleRequestsException; use Illuminate\Http\Request; @@ -34,7 +32,6 @@ use Illuminate\Validation\ValidationException; use PDOException; use Sentry\Laravel\Integration; use Sentry\State\Scope; -use Swift_TransportException; use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\Debug\Exception\FatalThrowableError; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; @@ -50,7 +47,6 @@ class Handler extends ExceptionHandler */ protected $dontReport = [ PDOException::class, - //Swift_TransportException::class, MaxAttemptsExceededException::class, CommandNotFoundException::class, ValidationException::class, @@ -80,11 +76,10 @@ class Handler extends ExceptionHandler { if (! Schema::hasTable('accounts')) { info('account table not found'); - return; } - if (Ninja::isHosted() && ! ($exception instanceof ValidationException)) { + if (Ninja::isHosted()) { Integration::configureScope(function (Scope $scope): void { $name = 'hosted@invoiceninja.com'; @@ -105,7 +100,10 @@ class Handler extends ExceptionHandler ]); }); - Integration::captureUnhandledException($exception); + if ($this->validException($exception)) { + Integration::captureUnhandledException($exception); + } + } elseif (app()->bound('sentry') && $this->shouldReport($exception)) { Integration::configureScope(function (Scope $scope): void { if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) { @@ -180,8 +178,8 @@ class Handler extends ExceptionHandler return response()->json(['message' => $exception->getMessage()], 500); } elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) { return response()->json(['message'=>'Too many requests'], 429); - } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) { - return response()->json(['message'=>'Fatal error'], 500); + // } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) { + // return response()->json(['message'=>'Fatal error'], 500); //@deprecated } elseif ($exception instanceof AuthorizationException) { return response()->json(['message'=> $exception->getMessage()], 401); } elseif ($exception instanceof TokenMismatchException) { @@ -208,13 +206,6 @@ class Handler extends ExceptionHandler return response()->json(['message' => $exception->getMessage()], 400); } - - // elseif ($exception instanceof QueryException) { - // return response()->json(['message' => 'We had a problem executing this query. Please retry.'], 500); - // } - - - return parent::render($request, $exception); } diff --git a/config/ninja.php b/config/ninja.php index 0afd46c0f6..0b3a99c33a 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.5.55', - 'app_tag' => '5.5.55', + 'app_version' => '5.5.56', + 'app_tag' => '5.5.56', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),