From: Marcus Boerger Date: Mon, 14 May 2007 18:31:18 +0000 (+0000) Subject: - Add Phar::getSupportedCompression() X-Git-Tag: RELEASE_1_2_0~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35299957c7ade4569b19f4246fd8def1c4e612e9;p=php - Add Phar::getSupportedCompression() --- diff --git a/ext/phar/TODO b/ext/phar/TODO index 930e2cad2b..abb93f3aa6 100644 --- a/ext/phar/TODO +++ b/ext/phar/TODO @@ -43,11 +43,12 @@ Version 1.1.0 Version 1.2.0 - * add PharFileInfo::hasMetadata(), PharFileInfo::delMetadata() [Marcus] - * fix Phar::CanWrite() [Marcus] - * add preliminary phar command (phar.php) [Marcus] - * add phar command (phar.phar) [Marcus] - * list all available signature methods + X add PharFileInfo::hasMetadata(), PharFileInfo::delMetadata() [Marcus] + X fix Phar::CanWrite() [Marcus] + X add preliminary phar command (phar.php) [Marcus] + X add phar command (phar.phar) [Marcus] + X list all available compression methods using Phar::getSupportedCompression() [Marcus] + * ability to have Phar object return file class as offsetGet() result * ability to store empty directories * [optional] Phar->rollback() to abort a write transaction diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index aea802a7b3..4d20643a7a 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -413,6 +413,22 @@ PHP_METHOD(Phar, getSupportedSignatures) } /* }}} */ +/* {{{ proto array Phar::getSupportedCompression() + * Return array of supported comparession algorithms + */ +PHP_METHOD(Phar, getSupportedCompression) +{ + array_init(return_value); + +#if !HAVE_ZLIB + add_next_index_stringl(return_value, "GZ", 2, 1); +#endif +#if !HAVE_BZ2 + add_next_index_stringl(return_value, "BZIP2", 5, 1); +#endif +} +/* }}} */ + /* {{{ proto array|false Phar::getSignature() * Return signature or false */ @@ -1314,6 +1330,7 @@ zend_function_entry php_archive_methods[] = { PHP_ME(Phar, mapPhar, arginfo_phar_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) PHP_ME(Phar, getExtractList, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) PHP_ME(Phar, getSupportedSignatures,NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) + PHP_ME(Phar, getSupportedCompression,NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) {NULL, NULL, NULL} };