From d8b404d7b5372c4ed70ec9ab8e000cd0f41feb32 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Tue, 12 Jun 2012 14:28:20 -0300 Subject: [PATCH] Added tuque wrapper for use in 6.x development --- api/tuque.inc | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 api/tuque.inc diff --git a/api/tuque.inc b/api/tuque.inc new file mode 100644 index 00000000..74dfa730 --- /dev/null +++ b/api/tuque.inc @@ -0,0 +1,93 @@ +uid == 0){ + $user_string = 'anonymous'; + $pass_string = 'anonymous'; + } else { + $user_string = $user->name; + $pass_string = $user->pass; + } + + if (!isset($url)) { + $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); + } +} +