/**
  * Get a list of importable issues from the DuraSpace instance.
  * @return array(contentId => issueIdentification)
  */
 function getImportableIssues()
 {
     $dcc =& $this->getDuraCloudConnection();
     $duraStore = new DuraStore($dcc);
     $spaceId = $this->getDuraCloudSpace();
     $contents = $duraStore->getSpace($spaceId, $metadata, null, 'issue-');
     if (!$contents) {
         return $contents;
     }
     $returner = array();
     foreach ($contents as $contentId) {
         $content = $duraStore->getContent($spaceId, $contentId);
         if (!$content) {
             continue;
         }
         // Could not fetch content
         $descriptor =& $content->getDescriptor();
         if (!$descriptor) {
             continue;
         }
         // Could not get descriptor
         $metadata = $descriptor->getMetadata();
         if (!$metadata) {
             continue;
         }
         // Could not get metadata
         if (!isset($metadata['creator']) || $metadata['creator'] != $this->getName()) {
             continue;
         }
         // Not created by this plugin
         if (!isset($metadata['identification'])) {
             continue;
         }
         // Could not get identification
         $returner[$contentId] = $metadata;
         unset($metadata);
     }
     return $returner;
 }
Exemplo n.º 2
0
$exampleName = array_shift($argv);
$baseUrl = array_shift($argv);
$username = array_shift($argv);
$password = array_shift($argv);
$spaceId = array_shift($argv);
$storeId = array_shift($argv);
// Optional
$prefixId = array_shift($argv);
// Optional
$maxResults = array_shift($argv);
// Optional
$marker = array_shift($argv);
// Optional
// Try a connection.
$dcc = new DuraCloudConnection($baseUrl, $username, $password);
$ds = new DuraStore($dcc);
$contents = $ds->getSpace($spaceId, $metadata, $storeId, $prefixId, $maxResults, $marker);
if ($contents !== false) {
    echo "The list of contents is:\n";
    foreach ($contents as $item) {
        echo " - {$item}\n";
    }
    echo "\nMetadata:\n";
    foreach ($metadata as $key => $value) {
        echo " {$key}: {$value}\n";
    }
    echo "\n";
} else {
    echo "The list of space contents could not be fetched. Check your credentials and space ID.\n";
    exit(-3);
}