Browse Source

Implementer emballer() pour le format tar

pull/4414/head
Cerdic 2 years ago
parent
commit
8935007710
  1. 21
      inc/archives.php
  2. 3
      inc/pcltar.php

21
inc/archives.php

@ -300,13 +300,13 @@ class SpipArchives
return false;
}
$racine = $this->trouver_racine($fichiers);
switch ($this->modeCompression) {
case 'zip':
include_spip('inc/pclzip');
$zip = new \PclZip($this->fichierArchive);
$racine = $this->trouver_racine($fichiers);
$v_list = $zip->create(
$fichiers,
PCLZIP_OPT_REMOVE_PATH,
@ -321,6 +321,23 @@ class SpipArchives
}
break;
case 'tar':
include_spip('inc/pcltar');
$ok = PclTarCreate($this->fichierArchive, $fichiers, $this->modeCompression, "", $racine);
if ($ok === 0){
$this->codeErreur = 1;
$this->messageErreur = "emballer() : Echec creation du ".$this->modeCompression. " " . PclErrorString() . ' pour paquet: ' . $this->fichierArchive;
return false;
}
}
// verifier que le fichier existe bien
if (!file_exists($this->fichierArchive)) {
$this->codeErreur = 3;
return false;
}
$this->codeErreur = 0;

3
inc/pcltar.php

@ -95,8 +95,9 @@ if (!defined("PCL_TAR")) {
// 1 on success, or an error code (see table at the beginning).
// --------------------------------------------------------------------------------
function PclTarCreate($p_tarname, $p_filelist = "", $p_mode = "", $p_add_dir = "", $p_remove_dir = "") {
$trace_file_list = (is_array($p_filelist) ? implode(' ', $p_filelist) : $p_filelist);
TrFctStart(__FILE__, __LINE__, "PclTarCreate",
"tar=$p_tarname, file='$p_filelist', mode=$p_mode, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
"tar=$p_tarname, file='$trace_file_list', mode=$p_mode, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
$v_result = 1;
// ----- Look for default mode

Loading…
Cancel
Save