Browse Source

Updated to give warnings about tuque.

pull/125/head
jonathangreen 13 years ago
parent
commit
9ab4df2199
  1. 3
      admin/islandora.admin.inc
  2. 27
      includes/tuque.inc
  3. 7
      islandora.module
  4. 13
      islandora_basic_collection/islandora_basic_collection.install
  5. 13
      islandora_basic_image/islandora_basic_image.install

3
admin/islandora.admin.inc

@ -11,8 +11,7 @@ function islandora_repository_admin($form, &$form_state) {
module_load_include('inc', 'islandora', 'includes/utilities');
if (!IslandoraTuque::exists()) {
$message = t('This module requires the !url. Please install sites all libraries folder before continuing.', array('!url' => l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque')));
drupal_set_message(check_plain($message));
IslandoraTuque::getError();
return;
}

27
includes/tuque.inc

@ -1,15 +1,15 @@
<?php
//do this until we expost these in a module or library
require_once 'sites/all/libraries/tuque/Datastream.php';
require_once 'sites/all/libraries/tuque/FedoraApi.php';
require_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
require_once 'sites/all/libraries/tuque/Object.php';
require_once 'sites/all/libraries/tuque/RepositoryConnection.php';
require_once 'sites/all/libraries/tuque/Cache.php';
require_once 'sites/all/libraries/tuque/RepositoryException.php';
require_once 'sites/all/libraries/tuque/Repository.php';
require_once 'sites/all/libraries/tuque/FedoraRelationships.php';
@include_once 'sites/all/libraries/tuque/Datastream.php';
@include_once 'sites/all/libraries/tuque/FedoraApi.php';
@include_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
@include_once 'sites/all/libraries/tuque/Object.php';
@include_once 'sites/all/libraries/tuque/RepositoryConnection.php';
@include_once 'sites/all/libraries/tuque/Cache.php';
@include_once 'sites/all/libraries/tuque/RepositoryException.php';
@include_once 'sites/all/libraries/tuque/Repository.php';
@include_once 'sites/all/libraries/tuque/FedoraRelationships.php';
class IslandoraTuque {
@ -58,15 +58,24 @@ class IslandoraTuque {
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
}
if(self::exists()) {
$this->connection = new RepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection);
$this->cache = new SimpleCache();
$this->repository = new FedoraRepository($this->api, $this->cache);
}
}
static function exists() {
return class_exists('RepositoryConnection');
}
static function getError() {
$islandora_doc_link = l(t('Islandora documentation'), 'https://wiki.duraspace.org/display/ISLANDORA/Islandora');
$tuque_link = l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque');
$message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array( '!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link));
drupal_set_message($message, 'error', FALSE);
}
}

7
islandora.module

@ -434,13 +434,18 @@ function islandora_object_load($object_id) {
$islandora_tuque = new IslandoraTuque();
}
if(IslandoraTuque::exists()) {
try {
$fedora_object = $islandora_tuque->repository->getObject($object_id);
} catch (Exception $e) {
return NULL;
}
return $fedora_object;
}
else {
IslandoraTuque::getError();
return NULL;
}
}
function islandora_ingest_access_callback($object, $perm) {

13
islandora_basic_collection/islandora_basic_collection.install

@ -1,5 +1,18 @@
<?php
function islandora_basic_collection_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/**
* @file
* islandora_basic_collection.install

13
islandora_basic_image/islandora_basic_image.install

@ -5,6 +5,19 @@
* islandora-basic-image.install
*/
function islandora_basic_image_requirements($phase) {
if($phase == 'install') {
module_load_include('inc', 'islandora', 'includes/tuque');
if(!IslandoraTuque::exists()) {
return array(array(
'title' => 'Tuque',
'description' => 'The Islandora Collection solution pack requires the Tuque library.',
'severity' => REQUIREMENT_ERROR,
));
}
}
}
/**
* Implements hook_install
*/

Loading…
Cancel
Save