Drupal modules for browsing and managing Fedora-based digital repositories.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

79 lines
1.9 KiB

<?php
/**
* @file
* Install/update hook implementations.
*/
use Drupal\islandora\Form\IslandoraSettingsForm;
/**
* Implements hook_schema().
*/
function islandora_schema() {
$schema = [];
$schema['islandora_version_count'] = [
'description' => 'Keeps track of the number of changes to an entity',
'fields' => [
'id' => [
'description' => 'Autoincrementing id for record',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'uuid' => [
'description' => 'UUID for an entity',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'unique' => TRUE,
],
'count' => [
'description' => 'Number of times an entity has been updated.',
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
],
],
'primary key' => ['id'],
'unique keys' => [
'uuid' => ['uuid'],
],
];
return $schema;
}
/**
* Delete the 'delete_media' action we used to provide, if it exists.
*
* Use the core 'media_delete_action' instead.
*/
function islandora_update_8001(&$sandbox) {
$action = \Drupal::service('entity_type.manager')->getStorage('action')->load('delete_media');
if ($action) {
$action->delete();
}
}
/**
* Add in default Gemini URI and Pseudo bundle setting values.
*/
function islandora_update_8002(&$sandbox) {
$config_factory = \Drupal::service('config.factory')->getEditable(IslandoraSettingsForm::CONFIG_NAME);
$changed = false;
$gemini_url = $config_factory->get(IslandoraSettingsForm::GEMINI_URL);
$pseudo_bundles = $config_factory->get(IslandoraSettingsForm::GEMINI_PSEUDO);
if (!isset($gemini_url)) {
$config_factory->set(IslandoraSettingsForm::GEMINI_URL, '');
$changed = true;
}
if (!isset($pseudo_bundles)) {
$config_factory->set(IslandoraSettingsForm::GEMINI_PSEUDO, []);
$changed = true;
}
if ($changed) {
$config_factory->save();
}
}