|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Alchemy\Zippy\Adapter\GNUTar; |
|
4
|
|
|
|
|
5
|
|
|
use Alchemy\Zippy\Adapter\AbstractTarAdapter; |
|
6
|
|
|
use Alchemy\Zippy\Adapter\VersionProbe\GNUTarVersionProbe; |
|
7
|
|
|
use Alchemy\Zippy\Parser\ParserInterface; |
|
8
|
|
|
use Alchemy\Zippy\Resource\ResourceManager; |
|
9
|
|
|
use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* GNUTarAdapter allows you to create and extract files from archives using GNU tar |
|
13
|
|
|
* |
|
14
|
|
|
* @see http://www.gnu.org/software/tar/manual/tar.html |
|
15
|
|
|
*/ |
|
16
|
|
|
class TarGNUTarAdapter extends AbstractTarAdapter |
|
17
|
|
|
{ |
|
18
|
|
|
public function __construct(ParserInterface $parser, ResourceManager $manager, ProcessBuilderFactoryInterface $inflator, ProcessBuilderFactoryInterface $deflator) |
|
19
|
|
|
{ |
|
20
|
|
|
parent::__construct($parser, $manager, $inflator, $deflator); |
|
21
|
|
|
$this->probe = new GNUTarVersionProbe($inflator, $deflator); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @inheritdoc |
|
26
|
|
|
*/ |
|
27
|
|
|
protected function getLocalOptions() |
|
28
|
|
|
{ |
|
29
|
|
|
return array(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @inheritdoc |
|
34
|
|
|
*/ |
|
35
|
|
|
public static function getName() |
|
36
|
|
|
{ |
|
37
|
|
|
return 'gnu-tar'; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @inheritdoc |
|
42
|
|
|
*/ |
|
43
|
|
|
public static function getDefaultDeflatorBinaryName() |
|
44
|
|
|
{ |
|
45
|
|
|
return array('gnutar', 'tar'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @inheritdoc |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function getDefaultInflatorBinaryName() |
|
52
|
|
|
{ |
|
53
|
|
|
return array('gnutar', 'tar'); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* {@inheritdoc} |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function getListMembersOptions() |
|
60
|
|
|
{ |
|
61
|
|
|
return array('--utc'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* {@inheritdoc} |
|
66
|
|
|
*/ |
|
67
|
|
|
protected function getExtractOptions() |
|
68
|
|
|
{ |
|
69
|
|
|
return array('--overwrite'); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* {@inheritdoc} |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function getExtractMembersOptions() |
|
76
|
|
|
{ |
|
77
|
|
|
return array('--overwrite'); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|