4
* This is a compatibility wrapper around the new Tar class
6
* Use of this library is strongly discouraged. Only basic extraction is wrapped,
7
* everything else will fail.
9
* @deprecated 2012-11-06
13
const COMPRESS_GZIP = 1;
14
const COMPRESS_BZIP = 2;
15
const COMPRESS_AUTO = 3;
16
const COMPRESS_NONE = 0;
17
const TARLIB_VERSION = '1.2';
18
const FULL_ARCHIVE = -1;
19
const ARCHIVE_DYNAMIC = 0;
20
const ARCHIVE_RENAMECOMP = 5;
21
const COMPRESS_DETECT = -1;
26
public $_result = true;
28
function __construct($file, $comptype = TarLib::COMPRESS_AUTO, $complevel = 9) {
29
if(!$file) $this->error('__construct', '$file');
33
case TarLib::COMPRESS_AUTO:
34
case TarLib::COMPRESS_DETECT:
35
$comptype = Tar::COMPRESS_AUTO;
37
case TarLib::COMPRESS_GZIP:
38
$comptype = Tar::COMPRESS_GZIP;
40
case TarLib::COMPRESS_BZIP:
41
$comptype = Tar::COMPRESS_BZIP;
44
$comptype = Tar::COMPRESS_NONE;
47
$this->complevel = $complevel;
50
$this->tar = new Tar();
51
$this->tar->open($file, $comptype);
52
} catch(Exception $e) {
53
$this->_result = false;
57
function Extract($p_what = TarLib::FULL_ARCHIVE, $p_to = '.', $p_remdir = '', $p_mode = 0755) {
58
if($p_what != TarLib::FULL_ARCHIVE) {
59
$this->error('Extract', 'Ep_what');
64
$this->tar->extract($p_to, $p_remdir);
65
} catch(Exception $e) {
71
function error($func, $param = '') {
72
$error = 'TarLib is deprecated and should no longer be used.';
75
$error .= "In this compatibility wrapper, the function '$func' does not accept your value for".
76
"the parameter '$param' anymore.";
78
$error .= "The function '$func' no longer exists in this compatibility wrapper.";
84
function __call($name, $arguments) {
b'\\ No newline at end of file'