}
}
+ static function cli_arg_typ_compalg($arg, $cfg)
+ {
+ $arg = self::cli_arg_typ_select($arg, $cfg);
+ switch($arg)
+ {
+ case 'auto':
+ if (extension_loaded('zlib'))
+ {
+ $arg = 'gz';
+ }
+ else if (extension_loaded('bz2'))
+ {
+ $arg = 'bz2';
+ }
+ else
+ {
+ $arg = '0';
+ }
+ break;
+ }
+ return $arg;
+ }
+
static function cli_cmd_inf_pack()
{
return "Pack files into a PHAR archive.";
{
return array(
'a' => array('typ'=>'alias', 'val'=>'newphar', 'required'=>1, 'inf'=>'<alias> Provide an alias name for the phar file.'),
- 'c' => array('typ'=>'select', 'val'=>NULL, 'inf'=>'<algo> Compression algorithmus.', 'select'=>array('gz'=>'GZip compression','gzip'=>'GZip compression','bzip2'=>'BZip2 compression','bz'=>'BZip2 compression','bz2'=>'BZip2 compression','0'=>'No compression','none'=>'No compression')),
+ 'c' => array('typ'=>'compalg', 'val'=>NULL, 'inf'=>'<algo> Compression algorithmus.', 'select'=>array('gz'=>'GZip compression','gzip'=>'GZip compression','bzip2'=>'BZip2 compression','bz'=>'BZip2 compression','bz2'=>'BZip2 compression','0'=>'No compression','none'=>'No compression','auto'=>'Automatically select compression algorithm')),
'f' => array('typ'=>'pharnew', 'val'=>NULL, 'required'=>1, 'inf'=>'<file> Specifies the phar file to work on.'),
'h' => array('typ'=>'select', 'val'=>NULL, 'inf'=>'<method> Selects the hash algorithmn.', 'select'=>array('md5'=>'MD5','sha1'=>'SHA1','sha256'=>'SHA256','sha512'=>'SHA512')),
'i' => array('typ'=>'regex', 'val'=>NULL, 'inf'=>'<regex> Specifies a regular expression for input files.'),
static function cli_arg_typ_compalg($arg, $cfg)
{
- $arg = cli_cmd_typ_select($arg, $cfg);
+ $arg = self::cli_arg_typ_select($arg, $cfg);
switch($arg)
{
case 'auto':
$arg = '0';
}
break;
- case 'bz2':
}
return $arg;
}
if (!$hash)
{
- $infos['Hash'] = 'NONE';
+ $infos['Hash-type'] = 'NONE';
}
else
{
- $infos['Hash Type'] = $hash['hash_type'];
+ $infos['Hash-type'] = $hash['hash_type'];
$infos['Hash'] = $hash['hash'];
}
$ccount = 0;
$ucount = 0;
$mcount = 0;
+ $compalg = array('GZ'=>0, 'BZ2'=>0);
foreach(new RecursiveIteratorIterator($phar) as $ent)
{
if ($ent->isCompressed())
{
$ccount++;
+ $csize += $ent->getCompressedSize();
+ if ($ent->isCompressedGZ())
+ {
+ $compalg['GZ']++;
+ }
+ else if ($ent->isCompressedBZIP2())
+ {
+ $compalg['BZ2']++;
+ }
}
else
{
$ucount++;
+ $csize += $ent->getSize();
}
+ $usize += $ent->getSize();
if ($ent->hasMetadata())
{
$mcount++;
}
$infos['Entries'] = $count;
- $infos['Compressed'] = $ccount;
- $infos['Uncompressed'] = $ucount;
+ $infos['Uncompressed-files'] = $ucount;
+ $infos['Compressed-files'] = $ccount;
+ $infos['Compressed-gz'] = $compalg['GZ'];
+ $infos['Compressed-bz2'] = $compalg['BZ2'];
+ $infos['Uncompressed-size'] = $usize;
+ $infos['Compressed-size'] = $csize;
$infos['Metadata'] = $mcount;
$l = 0;