Fixes #4517 -- Remove redundant backup result column.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-08-27 22:49:31 -05:00
parent 7710301819
commit 2c25b0bc9e
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
4 changed files with 30 additions and 22 deletions

View File

@ -77,7 +77,6 @@ class BackupsController extends AbstractLogViewerController
'backups' => $backups,
'is_enabled' => $settings->getBackupEnabled(),
'last_run' => $settings->getBackupLastRun(),
'last_result' => $settings->getBackupLastResult(),
'last_output' => $settings->getBackupLastOutput(),
'csrf' => $request->getCsrf()->generate($this->csrfNamespace),
]

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace App\Entity\Migration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20210828034409 extends AbstractMigration
{
public function getDescription(): string
{
return 'Remove redundant backup results column.';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE settings DROP backup_last_result');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE settings ADD backup_last_result LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_general_ci`');
}
}

View File

@ -626,26 +626,6 @@ class Settings implements Stringable
$this->setBackupLastRun(time());
}
/**
* @OA\Property(
* description="The result of the latest automated backup task.",
* example=""
* )
*/
#[ORM\Column(type: 'text', nullable: true)]
#[Attributes\AuditIgnore]
protected ?string $backup_last_result = null;
public function getBackupLastResult(): ?string
{
return $this->backup_last_result;
}
public function setBackupLastResult(?string $backupLastResult): void
{
$this->backup_last_result = $backupLastResult;
}
/**
* @OA\Property(
* description="The output of the latest automated backup task.",

View File

@ -45,8 +45,9 @@ class RunBackupTask extends AbstractTask
$message->storageLocationId
);
$result_output = 'Exited with code ' . $result_code . ":\n" . $result_output;
$settings = $this->settingsRepo->readSettings();
$settings->setBackupLastResult($result_code);
$settings->setBackupLastOutput($result_output);
$this->settingsRepo->writeSettings($settings);
}