From b2caffa14bcebd82fb3a445abc8162756fca5cae Mon Sep 17 00:00:00 2001 From: Daniel Berthereau Date: Mon, 30 Oct 2023 00:00:00 +0000 Subject: [PATCH] Released version 3.4.15. --- config/module.ini | 2 +- data/scripts/upgrade.php | 30 +++++++++++++++++++ src/Service/ViewHelper/DefaultSiteFactory.php | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/config/module.ini b/config/module.ini index c2ba3e7..809b1db 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.14" +version = "3.4.15" omeka_version_constraint = "^3.1.0 || ^4.0.0" dependencies = "Log" diff --git a/data/scripts/upgrade.php b/data/scripts/upgrade.php index cbcb7dc..d08fc3c 100644 --- a/data/scripts/upgrade.php +++ b/data/scripts/upgrade.php @@ -26,6 +26,9 @@ $messenger = $plugins->get('messenger'); $entityManager = $services->get('Omeka\EntityManager'); +$config = $services->get('Config'); +$basePath = $config['file_store']['local']['base_path'] ?: (OMEKA_PATH . '/files'); + if (version_compare($oldVersion, '3.3.2', '<')) { $this->installDir(); } @@ -198,3 +201,30 @@ ); $messenger->addWarning($message); } + +if (version_compare($oldVersion, '3.4.14', '<')) { + $message = new Message( + 'New tasks were added to set the primary media of all items and to check resources.' // @translate + ); + $messenger->addWarning($message); +} + +if (version_compare($oldVersion, '3.4.15', '<')) { + if (!$this->checkDestinationDir($basePath . '/backup')) { + $message = new \Omeka\Stdlib\Message( + 'The directory "%s" is not writeable.', // @translate + $basePath + ); + throw new \Omeka\Module\Exception\ModuleCannotInstallException((string) $message); + } + + $message = new Message( + 'A new task allow to backup Omeka installation files (without directory /files).' // @translate + ); + $messenger->addSuccess($message); + + $message = new Message( + 'A new task allow to clear php caches (code and data), in particular after an update or direct modification of code.' // @translate + ); + $messenger->addSuccess($message); +} diff --git a/src/Service/ViewHelper/DefaultSiteFactory.php b/src/Service/ViewHelper/DefaultSiteFactory.php index 66560fa..47196c1 100644 --- a/src/Service/ViewHelper/DefaultSiteFactory.php +++ b/src/Service/ViewHelper/DefaultSiteFactory.php @@ -28,8 +28,10 @@ public function __invoke(ContainerInterface $services, $requestedName, array $op } // Fix issues after Omeka install without public site, so very rarely. if (empty($id)) { + // Search first public site first. $slugs = $api->search('sites', ['is_public' => true, 'limit' => 1], ['initialize' => false, 'returnScalar' => 'slug'])->getContent(); [$id, $slug] = $slugs ? [(int) key($slugs), reset($slugs)] : [null, null]; + // Else first site. if (empty($id)) { $slugs = $api->search('sites', ['limit' => 1], ['initialize' => false, 'returnScalar' => 'slug'])->getContent(); [$id, $slug] = $slugs ? [(int) key($slugs), reset($slugs)] : [null, null];