/**
  * Create archive from files
  *
  */
 function FromFiles($type)
 {
     $path = $this->ArchivePath($type);
     $path = $this->ArchivePath($type);
     try {
         $archive = new \gp\tool\Archive($path);
         $archive->Add($this->dir);
     } catch (Exception $e) {
         self::AssertTrue(false, 'FromFiles(' . $type . ') Failed with message: ' . $e->getMessage());
         return;
     }
     $archive->Compress();
     self::AssertFileExists($path);
     return new \gp\tool\Archive($path);
     //return a readable archive
 }
Exemple #2
0
 /**
  * Create a tar archive of the folders in $add_dirs
  *
  */
 public function Create_Tar($which_exported, $add_dirs)
 {
     global $dataDir, $langmessage;
     $compression =& $_POST['compression'];
     if (!$this->NewFile($which_exported, $compression)) {
         return false;
     }
     // buildFromDirectory with regular expression
     $tar_object = new \gp\tool\Archive($this->archive_path);
     foreach ($add_dirs as $dir) {
         $localname = '/gpexport' . substr($dir, strlen($dataDir));
         $tar_object->Add($dir, $localname);
     }
     //add ini file
     $this->Export_Ini($tar_object, $which_exported);
     $tar_object->compress();
     return true;
 }
Exemple #3
0
 /**
  * Create a tar archive of the folders in $add_dirs
  *
  */
 public function Create_Tar($which_exported, $add_dirs)
 {
     global $dataDir, $langmessage;
     $compression =& $_POST['compression'];
     if (!$this->NewFile($which_exported, $compression)) {
         return false;
     }
     try {
         $tar_object = new \gp\tool\Archive($this->archive_path);
         foreach ($add_dirs as $dir) {
             $localname = '/gpexport' . substr($dir, strlen($dataDir));
             $tar_object->Add($dir, $localname);
         }
         //add ini file
         $this->Export_Ini($tar_object, $which_exported);
         $tar_object->compress();
     } catch (\Exception $e) {
         message($langmessage['OOPS'] . ' (Archive couldn\'t be created)');
         return false;
     }
     return true;
 }