cvs: pear /PHP_Archive Archive.php package.php package.xml /PHP_Archive/Archive Creator.php

From: Date: Tue, 06 Feb 2007 04:31:45 +0000
Subject: cvs: pear /PHP_Archive Archive.php package.php package.xml /PHP_Archive/Archive Creator.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44552@lists.php.net to get a copy of this message
cellog Tue Feb 6 04:31:45 2007 UTC Modified files: /pear/PHP_Archive Archive.php package.php package.xml /pear/PHP_Archive/Archive Creator.php Log: add ability to retrieve meta-data, prepare for release http://cvs.php.net/viewvc.cgi/pear/PHP_Archive/Archive.php?r1=1.37&r2=1.38&diff_format=u Index: pear/PHP_Archive/Archive.php diff -u pear/PHP_Archive/Archive.php:1.37 pear/PHP_Archive/Archive.php:1.38 --- pear/PHP_Archive/Archive.php:1.37 Tue Feb 6 04:11:56 2007 +++ pear/PHP_Archive/Archive.php Tue Feb 6 04:31:45 2007 @@ -19,7 +19,7 @@ * @author Davey Shafik <davey@synapticmedia.net> * @author Greg Beaver <cellog@php.net> * @link http://www.synapticmedia.net Synaptic Media - * @version $Id: Archive.php,v 1.37 2007/02/06 04:11:56 cellog Exp $ + * @version $Id: Archive.php,v 1.38 2007/02/06 04:31:45 cellog Exp $ * @package PHP_Archive * @category PHP */ @@ -230,7 +230,8 @@ throw new Exception('ERROR: PHP_Archive::mapPhar has already been called for alias "' . $alias . '" cannot re-alias to "' . $file . '"'); } - self::$_pharMapping[$alias] = array($file, $compressed, $dataoffset, $explicit); + self::$_pharMapping[$alias] = array($file, $compressed, $dataoffset, $explicit, + $info['metadata']); self::$_pharFiles[$file] = $alias; } @@ -776,5 +777,51 @@ { return '@API-VER@'; } + + /** + * Retrieve Phar-specific metadata for a Phar archive + * + * @param string $phar full path to Phar archive, or alias + * @return null|mixed The value that was serialized for the Phar + * archive's metadata + * @throws Exception + */ + public static function getPharMetadata($phar) + { + if (isset(self::$_pharFiles[$phar])) { + $phar = self::$_pharFiles[$phar]; + } + if (!isset(self::$_pharMapping[$phar])) { + throw new Exception('Unknown Phar archive: "' . $phar . '"'); + } + return self::$_pharMapping[$phar][4]; + } + + /** + * Retrieve File-specific metadata for a Phar archive file + * + * @param string $phar full path to Phar archive, or alias + * @param string $file relative path to file within Phar archive + * @return null|mixed The value that was serialized for the Phar + * archive's metadata + * @throws Exception + */ + public static function getFileMetadata($phar, $file) + { + if (!isset(self::$_pharFiles[$phar])) { + if (!isset(self::$_pharMapping[$phar])) { + throw new Exception('Unknown Phar archive: "' . $phar . '"'); + } + $phar = self::$_pharMapping[$phar][0]; + } + if (!isset(self::$_manifest[$phar])) { + throw new Exception('Unknown Phar: "' . $phar . '"'); + } + $file = self::processFile($file); + if (!isset(self::$_manifest[$phar][$file])) { + throw new Exception('Unknown file "' . $file . '" within Phar "'. $phar . '"'); + } + return self::$_manifest[$phar][$file][6]; + } } ?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/PHP_Archive/package.php?r1=1.23&r2=1.24&diff_format=u Index: pear/PHP_Archive/package.php diff -u pear/PHP_Archive/package.php:1.23 pear/PHP_Archive/package.php:1.24 --- pear/PHP_Archive/package.php:1.23 Tue Feb 6 03:34:22 2007 +++ pear/PHP_Archive/package.php Tue Feb 6 04:31:45 2007 @@ -7,7 +7,16 @@ $notes = ' Update to match phar extension -Final API for 1.0.0 is set'; +Final API for 1.0.0 is set + +Add support for: + + * Phar metadata - any serialized value + * file-specific metadata - any serialized value + * bzip2 compression of files + * SHA1/MD5 signature creation (Phar extension can use this, + PHP_Archive does not on open for performance reasons) + * file permissions (always set to 0555)'; $package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.xml', http://cvs.php.net/viewvc.cgi/pear/PHP_Archive/package.xml?r1=1.26&r2=1.27&diff_format=u Index: pear/PHP_Archive/package.xml diff -u pear/PHP_Archive/package.xml:1.26 pear/PHP_Archive/package.xml:1.27 --- pear/PHP_Archive/package.xml:1.26 Tue Feb 6 03:34:22 2007 +++ pear/PHP_Archive/package.xml Tue Feb 6 04:31:45 2007 @@ -17,7 +17,7 @@ <active>yes</active> </lead> <date>2007-02-05</date> - <time>12:40:40</time> + <time>22:26:44</time> <version> <release>0.10.0</release> <api>1.0.0</api> @@ -30,7 +30,16 @@ <notes> Update to match phar extension -Final API for 1.0.0 is set</notes> +Final API for 1.0.0 is set + +Add support for: + + * Phar metadata - any serialized value + * file-specific metadata - any serialized value + * bzip2 compression of files + * SHA1/MD5 signature creation (Phar extension can use this, + PHP_Archive does not on open for performance reasons) + * file permissions (always set to 0555)</notes> <contents> <dir baseinstalldir="PHP" name="/"> <dir name="Archive"> @@ -125,7 +134,16 @@ <notes> Update to match phar extension -Final API for 1.0.0 is set</notes> +Final API for 1.0.0 is set + +Add support for: + + * Phar metadata - any serialized value + * file-specific metadata - any serialized value + * bzip2 compression of files + * SHA1/MD5 signature creation (Phar extension can use this, + PHP_Archive does not on open for performance reasons) + * file permissions (always set to 0555)</notes> </release> <release> <version> http://cvs.php.net/viewvc.cgi/pear/PHP_Archive/Archive/Creator.php?r1=1.36&r2=1.37&diff_format=u Index: pear/PHP_Archive/Archive/Creator.php diff -u pear/PHP_Archive/Archive/Creator.php:1.36 pear/PHP_Archive/Archive/Creator.php:1.37 --- pear/PHP_Archive/Archive/Creator.php:1.36 Tue Feb 6 04:11:56 2007 +++ pear/PHP_Archive/Archive/Creator.php Tue Feb 6 04:31:45 2007 @@ -24,7 +24,7 @@ * @author Davey Shafik <davey@synapticmedia.net> * @author Greg Beaver <cellog@php.net> * @link http://www.synapticmedia.net Synaptic Media - * @version $Id: Creator.php,v 1.36 2007/02/06 04:11:56 cellog Exp $ + * @version $Id: Creator.php,v 1.37 2007/02/06 04:31:45 cellog Exp $ * @package PHP_Archive * @category PHP */ @@ -305,6 +305,7 @@ if ($this->compress) { $flags |= ($this->compress == 'gz') ? 0x00001000 : 0x00002000; } + $flags |= 0555; // file permissions $this->manifest[$save_path] = array( 'tempfile' => $this->temp_path . DIRECTORY_SEPARATOR . 'contents' .

« previous php.pear.cvs (#44552) next »