Skip to content

Commit

Permalink
Released version 3.4.55.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Berthereau authored and Daniel Berthereau committed Jun 3, 2024
1 parent f8d9a8e commit 632bd2d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/module.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ author_link = "https://gitlab.com/Daniel-KM"
module_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-BulkImport"
support_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-BulkImport/-/issues"
configurable = true
version = "3.4.54"
version = "3.4.55"
omeka_version_constraint = "^4.0.0"
dependencies = "Common, Log"
27 changes: 26 additions & 1 deletion data/scripts/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BulkImport;

use Common\Stdlib\PsrMessage;
use Omeka\Module\Exception\ModuleCannotInstallException;
use Omeka\Stdlib\Message;

Expand Down Expand Up @@ -32,7 +33,7 @@
'To upgrade from version %1$s to version %2$s, you must upgrade to version %3$s first.', // @translate
$oldVersion, $newVersion, '3.4.47'
);
throw new ModuleCannotInstallException((string) $message); // @translate
throw new ModuleCannotInstallException((string) $message);
}

if (!method_exists($this, 'checkModuleActiveVersion') || !$this->checkModuleActiveVersion('Common', '3.4.58')) {
Expand Down Expand Up @@ -413,4 +414,28 @@
$messenger->addWarning($message);
}

if (version_compare($oldVersion, '3.4.55', '<')) {
$message = new PsrMessage(
'The feature to extract metadata from media that was moved in another module in version 3.4.53 is reintegrated. You should set the option in main settings to use it.' // @translate
);
$messenger->addSuccess($message);

/** @see \Common\ManageModuleAndResources::checkStringsInFiles() */
$manageModuleAndResources = $this->getManageModuleAndResources();

$checks = [
'[mapping]',
];
$result = $manageModuleAndResources->checkStringsInFiles($checks, 'data/mapping/json/file.*') ?? [];
if ($result) {
$message = new PsrMessage(
'To keep the feature to extract metadata from media working, you should replace "[mapping]" by "[maps]" in the customized files "data/mapping/file.xxx". Matching files: {json}', // @translate
['json' => json_encode($result, 448)]
);
$messenger->addError($message);
$logger = $services->get('Omeka\Logger');
$logger->warn($message->getMessage(), $message->getContext());
}
}

// TODO Remove bulkimport_allow_empty_files and bulkimport_local_path in some version to keep config for EasyAdmin.
35 changes: 20 additions & 15 deletions data/scripts/upgrade_vocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,39 @@

namespace BulkImport;

use Common\Stdlib\PsrMessage;
use Omeka\Module\Exception\ModuleCannotInstallException;
use Omeka\Stdlib\Message;

/**
* @var Module $this
* @var \Laminas\ServiceManager\ServiceLocatorInterface $services
* @var bool $skipMessage
*/
$services = $this->getServiceLocator();

if (!method_exists($this, 'getInstallResources')) {
throw new ModuleCannotInstallException((string) new Message(
'This module requires module %s version %s or greater.', // @translate
'Generic',
'3.4.43'
));
if (!method_exists($this, 'getManageModuleAndResources')) {
$plugins = $services->get('ControllerPluginManager');
$translate = $plugins->get('translate');
$message = new \Omeka\Stdlib\Message(
$translate('This module requires module %1$s version %2$s or greater.'), // @translate
'Common', '3.4.58'
);
throw new ModuleCannotInstallException((string) $message);
}

$installResources = $this->getInstallResources();
$manageModuleAndResources = $this->getManageModuleAndResources();

$module = __NAMESPACE__;
$filepath = dirname(__DIR__, 2) . '/data/vocabularies/curation.json';
$data = file_get_contents($filepath);
$data = json_decode($data, true);
$installResources->createOrUpdateVocabulary($data, $module);
$manageModuleAndResources->createOrUpdateVocabulary($data, $module);

$messenger = $services->get('ControllerPluginManager')->get('messenger');
$message = new Message(
'The vocabulary "%s" was updated successfully.', // @translate
pathinfo($filepath, PATHINFO_FILENAME)
);
$messenger->addSuccess($message);
if (!empty($skipMessage)) {
$messenger = $services->get('ControllerPluginManager')->get('messenger');
$message = new PsrMessage(
'The vocabulary "{vocabulary}" was updated successfully.', // @translate
['vocabulary' => pathinfo($filepath, PATHINFO_FILENAME)]
);
$messenger->addSuccess($message);
}

0 comments on commit 632bd2d

Please sign in to comment.