From: Marcus Boerger Date: Mon, 14 May 2007 17:10:01 +0000 (+0000) Subject: - Add ability to specify hashing X-Git-Tag: RELEASE_1_2_0~65 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bdb1ed5cd2cc69058187c7d0983bac07f12ff44;p=php - Add ability to specify hashing --- diff --git a/ext/phar/phar.php b/ext/phar/phar.php index 05ec12e59f..d5d8456889 100644 --- a/ext/phar/phar.php +++ b/ext/phar/phar.php @@ -431,12 +431,13 @@ class PharCommand extends CLICommand static function cli_cmd_arg_pack() { return array( - 'f' => array('typ'=>'pharnew', 'val'=>NULL, 'required'=>1, 'inf'=>' Specifies the phar file to work on.'), 'a' => array('typ'=>'alias', 'val'=>'newphar', 'required'=>1, 'inf'=>' Provide an alias name for the phar file.'), - 's' => array('typ'=>'file', 'val'=>NULL, 'inf'=>' Select the stub file (excluded from list of input files/dirs).'), + 'c' => array('typ'=>'select', 'val'=>NULL, 'inf'=>' 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')), + 'f' => array('typ'=>'pharnew', 'val'=>NULL, 'required'=>1, 'inf'=>' Specifies the phar file to work on.'), + 'h' => array('typ'=>'select', 'val'=>NULL, 'inf'=>' Selects the hash algorithmn.', 'select'=>array('md5'=>'MD5','sha1'=>'SHA1','sha256'=>'SHA256','sha512'=>'SHA512')), 'i' => array('typ'=>'regex', 'val'=>NULL, 'inf'=>' Specifies a regular expression for input files.'), + 's' => array('typ'=>'file', 'val'=>NULL, 'inf'=>' Select the stub file (excluded from list of input files/dirs).'), 'x' => array('typ'=>'regex', 'val'=>NULL, 'inf'=>' Regular expression for input files to exclude.'), - 'c' => array('typ'=>'select', 'val'=>NULL, 'inf'=>' 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')), '' => array('typ'=>'any', 'val'=>NULL, 'required'=>1, 'inf'=>' Any number of input files and directories.'), ); } @@ -454,10 +455,11 @@ class PharCommand extends CLICommand exit(1); } - $archive = $this->args['f']['val']; $alias = $this->args['a']['val']; - $stub = $this->args['s']['val']; + $archive = $this->args['f']['val']; + $hash = $this->args['h']['val']; $regex = $this->args['i']['val']; + $stub = $this->args['s']['val']; $invregex= $this->args['x']['val']; $input = $this->args['']['val']; @@ -483,8 +485,6 @@ class PharCommand extends CLICommand } } - $phar->stopBuffering(); - switch($this->args['c']['val']) { case 'gz': @@ -498,6 +498,13 @@ class PharCommand extends CLICommand default: break; } + + if ($hash) + { + $phar->setSignatureAlgorithm($hash); + } + + $phar->stopBuffering(); exit(0); }