array('target' => '_blank'))); $requirements['islandora_xsltprocessor']['description'] = $t('The !xsllink is required. Check your installed PHP extensions and php.ini file.', array('!xsllink' => $link)); $requirements['islandora_xsltprocessor']['severity'] = REQUIREMENT_ERROR; } return $requirements; } /** * Implements hook_install(). * * @see islandora_islandora_required_objects() */ function islandora_install() { module_load_include('inc', 'islandora', 'includes/solution_packs'); islandora_install_solution_pack('islandora'); } /** * Implements hook_uninstall(). * * @see islandora_islandora_required_objects() */ function islandora_uninstall() { module_load_include('inc', 'islandora', 'includes/solution_packs'); islandora_install_solution_pack('islandora', 'uninstall'); // Add new variables to clean up. $variables = array( 'islandora_ds_replace_exclude_enforced', 'islandora_defer_derivatives_on_ingest', 'islandora_base_url', 'islandora_repository_pid', 'islandora_use_datastream_cache_headers', 'islandora_show_print_option', 'islandora_render_drupal_breadcrumbs', 'islandora_namespace_restriction_enforced', 'islandora_pids_allowed', 'islandora_risearch_use_itql_when_necessary', 'islandora_use_object_semaphores', 'islandora_semaphore_period', 'islandora_require_obj_upload', 'islandora_breadcrumbs_backends', 'islandora_render_context_ingeststep', 'islandora_deny_inactive_and_deleted', 'islandora_imageserver_settings', ); array_walk($variables, 'variable_del'); } /** * Implements hook_schema(). */ function islandora_schema() { $schema['islandora_authtokens'] = array( 'description' => 'The hub for all islandora authentication tokens', 'fields' => array( 'id' => array( 'description' => 'key', 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'token' => array( 'description' => 'a unique identifier for this token', 'type' => 'varchar', 'length' => 64, ), 'remaining_uses' => array( 'description' => 'How many uses until this should be removed', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'uid' => array( 'description' => 'the user id that requested this token', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'time' => array( 'description' => 'when this token was created', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'pid' => array( 'description' => 'the pid of the object this token unlocks', 'type' => 'varchar', 'length' => 128, 'not null' => TRUE, ), 'dsid' => array( 'description' => 'the datasteram id of the object this token unlocks', 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, ), ), 'unique keys' => array( 'id' => array('id'), ), 'primary key' => array('id'), ); return $schema; } /** * Implements hook_update_N(). * * Add the required table for handling authentication tokens. * This is the first instance that has this table. */ function islandora_update_7001(&$sandbox) { drupal_install_schema('islandora'); $t = get_t(); return $t("Islandora database updates complete"); } /** * Implements hook_update_N(). * * Removing old variable around changes to ingestDatastream signature. * These changes are complete and deprecation warnings are removed. */ function islandora_update_7002() { // Removing as the deprecation has been removed. variable_del('islandora_deprecation_return_false_when_datastream_exists'); } /** * Implements hook_update_N(). * * Try to auto-configure the image server settings in core based on * the Internet Archive Bookreader and/or Openseadragon settings. */ function islandora_update_7003() { module_load_include('inc', 'islandora', 'includes/imageserver'); if (islandora_imageserver_get_settings()['type'] != 'none') { return t('Settings have already been configured manually.'); } if (module_exists('islandora_openseadragon')) { $openseadragon_settings = array( 'type' => variable_get('islandora_openseadragon_tilesource', 'djatoka'), ); if ($openseadragon_settings['type'] == 'djatoka') { $openseadragon_settings['url'] = variable_get('islandora_openseadragon_djatoka_url', 'adore-djatoka/resolver'); } else { $openseadragon_settings['url'] = variable_get('islandora_openseadragon_iiif_url', 'iiif'); $openseadragon_settings['iiif_token_header'] = variable_get('islandora_openseadragon_iiif_token_header', FALSE); $openseadragon_settings['iiif_identifier'] = explode(":", variable_get('islandora_openseadragon_iiif_identifier', '[islandora_openseadragon:url_token]'))[1]; } } if (module_exists('islandora_internet_archive_bookreader')) { $iabv_settings = array( 'type' => variable_get('islandora_internet_archive_bookreader_pagesource', 'djatoka'), ); if ($iabv_settings['type'] == 'djatoka') { $iabv_settings['url'] = variable_get('islandora_paged_content_djatoka_url', 'http://localhost:8080/adore-djatoka'); } else { $iabv_settings['url'] = variable_get('islandora_internet_archive_bookreader_iiif_url', 'iiif'); $iabv_settings['iiif_token_header'] = variable_get('islandora_internet_archive_bookreader_iiif_token_header', FALSE); $iabv_settings['iiif_identifier'] = explode(":", variable_get('islandora_internet_archive_bookreader_iiif_identifier', '[islandora_iareader:url_token]'))[1]; } } if (isset($openseadragon_settings) && isset($iabv_settings)) { if (count(array_diff($openseadragon_settings, $iabv_settings)) == 0) { // Settings are the same, use for core imageserver variables. $new_settings = $openseadragon_settings; } else { // We could not migrate your settings to the new place. This stops the other // two modules from deleting your settings. throw new DrupalUpdateException('Islandora image server settings could NOT be configured automatically, please set them manually at Admin -> Islandora -> Image Server configuration and then run updates again.'); } } elseif (isset($openseadragon_settings)) { $new_settings = $openseadragon_settings; } elseif (isset($iabv_settings)) { $new_settings = $iabv_settings; } if (isset($new_settings)) { if (isset($new_settings['iiif_identifer']) && !empty($new_settings['iiif_identifer'])) { // This will only have the back half of the token, prepend islandora to it. $new_settings['iiif_identifer'] = "[islandora:" + $new_settings['iiif_identifer']; } if ($new_settings['type'] == 'djatoka' && !preg_match('~resolver$~', $new_settings['url'])) { // IABV javascript added resolver to URL, Openseadragon did not. $new_settings['url'] = rtrim($new_settings['url'], '/') . '/resolver'; } // We have migrated your settings to the new place. variable_set('islandora_imageserver_settings', $new_settings); return t("Islandora image server settings configured automatically."); } }