]> granicus.if.org Git - php/commitdiff
add class constants Phar::COMPRESSED, Phar::GZ, and Phar::BZ2 for eventual compressio...
authorGreg Beaver <cellog@php.net>
Thu, 18 Jan 2007 00:13:18 +0000 (00:13 +0000)
committerGreg Beaver <cellog@php.net>
Thu, 18 Jan 2007 00:13:18 +0000 (00:13 +0000)
ext/phar/phar.c

index c617cfc719044c7d5a002cba43ac212199372341..ca13aaf54a03a269cb76d011f9bcde2f063f62ec 100644 (file)
@@ -1224,7 +1224,7 @@ PHP_METHOD(Phar, mapPhar)
        RETURN_BOOL(phar_open_compiled_file(alias, alias_len TSRMLS_CC) == SUCCESS);
 } /* }}} */
 
-/* {{{ proto mixed Phar::loadPhar(string url [, string alias])
+/* {{{ proto mixed Phar::loadPhar(string filename [, string alias])
  * Loads any phar archive with an alias */
 PHP_METHOD(Phar, loadPhar)
 {
@@ -3059,6 +3059,8 @@ static void php_phar_init_globals_module(zend_phar_globals *phar_globals)
        phar_globals->readonly = 1;
 }
 /* }}} */
+#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \
+       zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
 
 PHP_MINIT_FUNCTION(phar) /* {{{ */
 {
@@ -3072,6 +3074,10 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */
 
        zend_class_implements(phar_ce_archive TSRMLS_CC, 2, spl_ce_Countable, zend_ce_arrayaccess);
 
+       REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK)
+       REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ)
+       REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2)
+
        INIT_CLASS_ENTRY(ce, "PharFileInfo", php_entry_methods);
        phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo, NULL  TSRMLS_CC);