From f66ab8dae2f3d0418759f81a3a64dc9517a62449 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:31 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- application/forms/ApplyMigrationsForm.php | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 application/forms/ApplyMigrationsForm.php (limited to 'application/forms/ApplyMigrationsForm.php') diff --git a/application/forms/ApplyMigrationsForm.php b/application/forms/ApplyMigrationsForm.php new file mode 100644 index 0000000..4f1e62b --- /dev/null +++ b/application/forms/ApplyMigrationsForm.php @@ -0,0 +1,54 @@ +migrations->hasSchema()) { + $count = $this->migrations->countPendingMigrations(); + if ($count === 1) { + $this->setSubmitLabel( + $this->translate('Apply a pending schema migration') + ); + } else { + $this->setSubmitLabel( + sprintf( + $this->translate('Apply %d pending schema migrations'), + $count + ) + ); + } + } else { + $this->setSubmitLabel($this->translate('Create schema')); + } + } + + public function onSuccess() + { + try { + $this->setSuccessMessage($this->translate( + 'Pending database schema migrations have successfully been applied' + )); + + $this->migrations->applyPendingMigrations(); + parent::onSuccess(); + } catch (Exception $e) { + $this->addError($e->getMessage()); + } + } + + public function setMigrations(Migrations $migrations) + { + $this->migrations = $migrations; + return $this; + } +} -- cgit v1.2.3