mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Improvements for cache when running setup for the first time
This commit is contained in:
parent
52a982d634
commit
dcbfc6c170
@ -1 +1 @@
|
|||||||
5.5.55
|
5.5.56
|
@ -134,6 +134,9 @@ class CreateAccount extends Command
|
|||||||
(new CreateCompanyPaymentTerms($company, $user))->handle();
|
(new CreateCompanyPaymentTerms($company, $user))->handle();
|
||||||
(new CreateCompanyTaskStatuses($company, $user))->handle();
|
(new CreateCompanyTaskStatuses($company, $user))->handle();
|
||||||
(new VersionCheck())->handle();
|
(new VersionCheck())->handle();
|
||||||
|
|
||||||
|
$this->warmCache();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function warmCache()
|
private function warmCache()
|
||||||
@ -142,11 +145,6 @@ class CreateAccount extends Command
|
|||||||
$cached_tables = config('ninja.cached_tables');
|
$cached_tables = config('ninja.cached_tables');
|
||||||
|
|
||||||
foreach ($cached_tables as $name => $class) {
|
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') {
|
if ($name == 'payment_terms') {
|
||||||
$orderBy = 'num_days';
|
$orderBy = 'num_days';
|
||||||
} elseif ($name == 'fonts') {
|
} elseif ($name == 'fonts') {
|
||||||
@ -160,7 +158,7 @@ class CreateAccount extends Command
|
|||||||
if ($tableData->count()) {
|
if ($tableData->count()) {
|
||||||
Cache::forever($name, $tableData);
|
Cache::forever($name, $tableData);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,10 @@ use App\Exceptions\InternalPDFFailure;
|
|||||||
use App\Exceptions\PhantomPDFFailure;
|
use App\Exceptions\PhantomPDFFailure;
|
||||||
use App\Exceptions\StripeConnectFailure;
|
use App\Exceptions\StripeConnectFailure;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use Exception;
|
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||||
use Illuminate\Database\Eloquent\RelationNotFoundException;
|
use Illuminate\Database\Eloquent\RelationNotFoundException;
|
||||||
use Illuminate\Database\QueryException;
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -34,7 +32,6 @@ use Illuminate\Validation\ValidationException;
|
|||||||
use PDOException;
|
use PDOException;
|
||||||
use Sentry\Laravel\Integration;
|
use Sentry\Laravel\Integration;
|
||||||
use Sentry\State\Scope;
|
use Sentry\State\Scope;
|
||||||
use Swift_TransportException;
|
|
||||||
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||||
@ -50,7 +47,6 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
PDOException::class,
|
PDOException::class,
|
||||||
//Swift_TransportException::class,
|
|
||||||
MaxAttemptsExceededException::class,
|
MaxAttemptsExceededException::class,
|
||||||
CommandNotFoundException::class,
|
CommandNotFoundException::class,
|
||||||
ValidationException::class,
|
ValidationException::class,
|
||||||
@ -80,11 +76,10 @@ class Handler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
if (! Schema::hasTable('accounts')) {
|
if (! Schema::hasTable('accounts')) {
|
||||||
info('account table not found');
|
info('account table not found');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ninja::isHosted() && ! ($exception instanceof ValidationException)) {
|
if (Ninja::isHosted()) {
|
||||||
Integration::configureScope(function (Scope $scope): void {
|
Integration::configureScope(function (Scope $scope): void {
|
||||||
$name = 'hosted@invoiceninja.com';
|
$name = 'hosted@invoiceninja.com';
|
||||||
|
|
||||||
@ -105,7 +100,10 @@ class Handler extends ExceptionHandler
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($this->validException($exception)) {
|
||||||
Integration::captureUnhandledException($exception);
|
Integration::captureUnhandledException($exception);
|
||||||
|
}
|
||||||
|
|
||||||
} elseif (app()->bound('sentry') && $this->shouldReport($exception)) {
|
} elseif (app()->bound('sentry') && $this->shouldReport($exception)) {
|
||||||
Integration::configureScope(function (Scope $scope): void {
|
Integration::configureScope(function (Scope $scope): void {
|
||||||
if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
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);
|
return response()->json(['message' => $exception->getMessage()], 500);
|
||||||
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
|
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
|
||||||
return response()->json(['message'=>'Too many requests'], 429);
|
return response()->json(['message'=>'Too many requests'], 429);
|
||||||
} elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
// } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
||||||
return response()->json(['message'=>'Fatal error'], 500);
|
// return response()->json(['message'=>'Fatal error'], 500); //@deprecated
|
||||||
} elseif ($exception instanceof AuthorizationException) {
|
} elseif ($exception instanceof AuthorizationException) {
|
||||||
return response()->json(['message'=> $exception->getMessage()], 401);
|
return response()->json(['message'=> $exception->getMessage()], 401);
|
||||||
} elseif ($exception instanceof TokenMismatchException) {
|
} elseif ($exception instanceof TokenMismatchException) {
|
||||||
@ -208,13 +206,6 @@ class Handler extends ExceptionHandler
|
|||||||
return response()->json(['message' => $exception->getMessage()], 400);
|
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);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.5.55',
|
'app_version' => '5.5.56',
|
||||||
'app_tag' => '5.5.55',
|
'app_tag' => '5.5.56',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
Loading…
Reference in New Issue
Block a user