コード例 #1
0
 /**
  * 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
 }
コード例 #2
0
ファイル: admin_port.php プロジェクト: jozefkrz/gpEasy-CMS
 /**
  * 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;
 }
コード例 #3
0
ファイル: Port.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * 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;
 }