From 796bc49118d38110b8ba5fdafdf177183521732e Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 26 Jul 2023 16:12:29 +0200 Subject: [PATCH] Adjust constant name & support exports in migration list view --- application/controllers/StatusController.php | 6 ++++-- library/Icinga/Application/Hook/MigrationHook.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/application/controllers/StatusController.php b/application/controllers/StatusController.php index 3db0ab1a0c..c5c32e0e3b 100644 --- a/application/controllers/StatusController.php +++ b/application/controllers/StatusController.php @@ -82,7 +82,10 @@ public function migrationListAction() $this->setupFilterControl($migrations, [ 'name' => $this->translate('Name'), 'state' => $this->translate('State'), - ], ['name']); + ], ['name'], ['format']); + + $this->getTabs()->extend(new OutputFormat(['csv'])); + $this->handleFormatRequest($migrations); $this->addControl(HtmlString::create((string) $this->view->paginator)); $this->addControl(HtmlElement::create('div', ['class' => 'sort-controls-container'], [ @@ -95,7 +98,6 @@ public function migrationListAction() $this->initTabs(); $this->getTabs()->activate('migrations'); - $this->getTabs()->disableLegacyExtensions(); $this->setAutorefreshInterval(30); $this->addContent(new Migrations($migrations, function (Form $form) { diff --git a/library/Icinga/Application/Hook/MigrationHook.php b/library/Icinga/Application/Hook/MigrationHook.php index fa44a6ff1c..112ad4216f 100644 --- a/library/Icinga/Application/Hook/MigrationHook.php +++ b/library/Icinga/Application/Hook/MigrationHook.php @@ -67,7 +67,7 @@ abstract class MigrationHook implements Countable public const ALL_MODULES = 'all_modules'; /** @var string Used as the initial migration version when the schema version table doesn't exist yet */ - protected const INITIAL_MIGRATE_VERSION = '0.0.0'; + protected const VERSION_BEFORE_AUTO_MIGRATE_SUPPORT = '0.0.0'; /** @var Migration[] All pending DB/PHP code migrations of this hook */ protected $migrations = []; @@ -141,7 +141,7 @@ public function getVersion(): string } else { if (! $this->migrationStorage->has(static::MIGRATE_PHP_FILE)) { // Create the cache file with some dummy/lower version. - $this->migrationStorage->create(static::MIGRATE_PHP_FILE, static::INITIAL_MIGRATE_VERSION); + $this->migrationStorage->create(static::MIGRATE_PHP_FILE, static::VERSION_BEFORE_AUTO_MIGRATE_SUPPORT); } $version = $this->migrationStorage->read(static::MIGRATE_PHP_FILE); @@ -378,7 +378,7 @@ final protected function createSchemaVersionTable(): self } $conn->exec($query); - $conn->insert('schema_version', ['version' => static::INITIAL_MIGRATE_VERSION, 'timestamp' => $timestamp]); + $conn->insert('schema_version', ['version' => static::VERSION_BEFORE_AUTO_MIGRATE_SUPPORT, 'timestamp' => $timestamp]); return $this; }