forked from Alex/Pterodactyl-Panel
backups: properly query backups
This commit is contained in:
parent
c46131e7ad
commit
07617bcd27
@ -25,8 +25,10 @@ class BackupRepository extends EloquentRepository
|
||||
return $this->getBuilder()
|
||||
->withTrashed()
|
||||
->where('server_id', $server)
|
||||
->whereNull('completed_at')
|
||||
->orWhere('is_successful', '=', true)
|
||||
->where(function ($query) {
|
||||
$query->whereNull('completed_at')
|
||||
->orWhere('is_successful', '=', true);
|
||||
})
|
||||
->where('created_at', '>=', Carbon::now()->subSeconds($seconds)->toDateTimeString())
|
||||
->get()
|
||||
->toBase();
|
||||
|
@ -134,7 +134,10 @@ class InitiateBackupService
|
||||
|
||||
// Check if the server has reached or exceeded its backup limit.
|
||||
// completed_at == null will cover any ongoing backups, while is_successful == true will cover any completed backups.
|
||||
$successful = $server->backups()->whereNull('completed_at')->orWhere('is_successful', true);
|
||||
$successful = $server->backups()->where(function ($query) {
|
||||
$query->whereNull('completed_at')
|
||||
->orWhere('is_successful', true);
|
||||
});
|
||||
if (!$server->backup_limit || $successful->count() >= $server->backup_limit) {
|
||||
// Do not allow the user to continue if this server is already at its limit and can't override.
|
||||
if (!$override || $server->backup_limit <= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user