Exemplo n.º 1
0
 /**
  * Exporter of repositories
  * 
  * Adds repositoryfile elements to the xml, which pass off to individual
  * repository Importers.
  * 
  * @return <##>
  * @access public
  * @since 10/17/05
  */
 function exportRepositories()
 {
     $rm = Services::getService("Repository");
     $children = $rm->getRepositories();
     while ($children->hasNext()) {
         $child = $children->next();
         $childId = $child->getId();
         fwrite($this->_xml, "\t<repositoryfile>" . $childId->getIdString() . "/metadata.xml</repositoryfile>\n");
         $exporter = XMLRepositoryExporter::withDir($this->_tmpDir);
         $exporter->export($childId);
         // ????
         unset($exporter);
     }
 }
Exemplo n.º 2
0
 /**
  * Save our results. Tearing down and unsetting the Wizard is handled by
  * in {@link runWizard()} and does not need to be implemented here.
  * 
  * @param string $cacheName
  * @return boolean TRUE if save was successful and tear-down/cleanup of the
  *		Wizard should ensue.
  * @access public
  * @since 4/28/05
  */
 function saveWizard($cacheName)
 {
     $harmoni = Harmoni::Instance();
     $idManager = Services::getService("Id");
     $wizard = $this->getWizard($cacheName);
     $properties = $wizard->getAllValues();
     $repositoryId = $idManager->getId(RequestContext::value('collection_id'));
     $exporter = XMLRepositoryExporter::withCompression($properties['compression']);
     $dir = $exporter->export($repositoryId);
     $this->_archiveFile = $exporter->compressWithStatus();
     $this->_archiveFileKey = str_replace('.', '', basename($this->_archiveFile, $properties['compression']));
     // 		printpre($this->_archiveFile);
     // For security, only files listed in the following array will be allowed
     // to be downloaded.
     if (!isset($_SESSION['EXPORTED_FILES'])) {
         $_SESSION['EXPORTED_FILES'] = array();
     }
     $_SESSION['EXPORTED_FILES'][$this->_archiveFileKey] = array('file' => $this->_archiveFile, 'name' => basename($properties['filepath'] . $properties['compression']), 'mime' => 'application/x-gzip');
     return TRUE;
 }