diff --git a/Module.php b/Module.php index 9fc2270..08607f7 100644 --- a/Module.php +++ b/Module.php @@ -60,6 +60,17 @@ class Module extends AbstractModule protected function preInstall(): void { + $services = $this->getServiceLocator(); + $translate = $services->get('ControllerPluginManager')->get('translate'); + + if (!method_exists($this, 'checkModuleActiveVersion') || !$this->checkModuleActiveVersion('Common', '3.4.52')) { + $message = new \Omeka\Stdlib\Message( + $translate('The module %1$s should be upgraded to version %2$s or later.'), // @translate + 'Common', '3.4.52' + ); + throw new \Omeka\Module\Exception\ModuleCannotInstallException((string) $message); + } + $this->installDir(); } diff --git a/config/module.ini b/config/module.ini index ab44018..a8f46c6 100644 --- a/config/module.ini +++ b/config/module.ini @@ -9,6 +9,6 @@ author_link = "https://gitlab.com/Daniel-KM" module_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-EasyAdmin" support_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-EasyAdmin/-/issues" configurable = false -version = "3.4.15" -omeka_version_constraint = "^3.1.0 || ^4.0.0" +version = "3.4.16" +omeka_version_constraint = "^4.0.0" dependencies = "Common" diff --git a/data/scripts/upgrade.php b/data/scripts/upgrade.php index d08fc3c..81853ce 100644 --- a/data/scripts/upgrade.php +++ b/data/scripts/upgrade.php @@ -22,6 +22,7 @@ $url = $services->get('ViewHelperManager')->get('url'); $api = $plugins->get('api'); $settings = $services->get('Omeka\Settings'); +$translate = $plugins->get('translate'); $connection = $services->get('Omeka\Connection'); $messenger = $plugins->get('messenger'); $entityManager = $services->get('Omeka\EntityManager'); @@ -228,3 +229,14 @@ ); $messenger->addSuccess($message); } + + +if (version_compare($oldVersion, '3.4.16', '<')) { + if (!method_exists($this, 'checkModuleActiveVersion') || !$this->checkModuleActiveVersion('Common', '3.4.52')) { + $message = new Message( + $translate('The module %1$s should be upgraded to version %2$s or later.'), // @translate + 'Common', '3.4.52' + ); + throw new \Omeka\Module\Exception\ModuleCannotInstallException((string) $message); + } +}