cvs: pecl /phar TODO phar_object.c
| From: | Greg Beaver | Date: | Fri, 02 May 2008 04:44:38 +0000 |
| Subject: | cvs: pecl /phar TODO phar_object.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10681@lists.php.net to get a copy of this message | ||
cellog Fri May 2 04:44:38 2008 UTC
Modified files:
/pecl/phar TODO phar_object.c
Log:
update TODO, re-order methods to be alphabetical, tweak extractTo to set permissions and handle
NULL for files
# this also matches the docs I just committed :)
http://cvs.php.net/viewvc.cgi/pecl/phar/TODO?r1=1.65&r2=1.66&diff_format=u
Index: pecl/phar/TODO
diff -u pecl/phar/TODO:1.65 pecl/phar/TODO:1.66
--- pecl/phar/TODO:1.65 Wed Mar 26 03:55:36 2008
+++ pecl/phar/TODO Fri May 2 04:44:38 2008
@@ -66,7 +66,7 @@
X implement webPhar() rewrite as a callback that returns FALSE to deny
access, or a string representing a file within the archive to access. If
unknown, the callback should return the original request uri [Greg]
- * rework filename detection so that alias is always checked first
+ X rework filename detection so that alias is always checked first [Greg]
X make aliases containing '/' or '\' invalid [Greg]
X implement manual mounting of external phar archives to locations inside a
phar path, $phar->mount('/path/to/external.phar', 'internal/path');
http://cvs.php.net/viewvc.cgi/pecl/phar/phar_object.c?r1=1.252&r2=1.253&diff_format=u
Index: pecl/phar/phar_object.c
diff -u pecl/phar/phar_object.c:1.252 pecl/phar/phar_object.c:1.253
--- pecl/phar/phar_object.c:1.252 Wed Apr 30 23:44:29 2008
+++ pecl/phar/phar_object.c Fri May 2 04:44:38 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar_object.c,v 1.252 2008/04/30 23:44:29 cellog Exp $ */
+/* $Id: phar_object.c,v 1.253 2008/05/02 04:44:38 cellog Exp $ */
#include "phar_internal.h"
#include "func_interceptors.h"
@@ -3527,10 +3527,18 @@
fullpath[dest_len] = '\0';
}
if (FAILURE == php_stream_stat_path(fullpath, &ssb)) {
- if (!php_stream_mkdir(fullpath, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
- spprintf(error, 4096, "Cannot extract \"%s\", could not create directory
\"%s\"", entry->filename, fullpath);
- efree(fullpath);
- return FAILURE;
+ if (entry->is_dir) {
+ if (!php_stream_mkdir(fullpath, entry->flags & PHAR_ENT_PERM_MASK,
PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
+ spprintf(error, 4096, "Cannot extract \"%s\", could not create directory
\"%s\"", entry->filename, fullpath);
+ efree(fullpath);
+ return FAILURE;
+ }
+ } else {
+ if (!php_stream_mkdir(fullpath, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
+ spprintf(error, 4096, "Cannot extract \"%s\", could not create directory
\"%s\"", entry->filename, fullpath);
+ efree(fullpath);
+ return FAILURE;
+ }
}
}
if (slash) {
@@ -3575,8 +3583,13 @@
php_stream_close(fp);
return FAILURE;
}
- efree(fullpath);
php_stream_close(fp);
+ if (-1 == VCWD_CHMOD(fullpath, entry->flags & PHAR_ENT_PERM_MASK)) {
+ spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", setting file
permissions failed", entry->filename, fullpath);
+ efree(fullpath);
+ return FAILURE;
+ }
+ efree(fullpath);
return SUCCESS;
}
@@ -3628,6 +3641,8 @@
if (zval_files) {
switch (Z_TYPE_P(zval_files)) {
+ case IS_NULL:
+ goto all_files;
case IS_STRING:
filename = Z_STRVAL_P(zval_files);
filename_len = Z_STRLEN_P(zval_files);
@@ -3679,6 +3694,8 @@
}
} else {
phar_archive_data *phar = phar_obj->arc.archive;
+
+all_files:
/* Extract all files */
if (!zend_hash_num_elements(&(phar->manifest))) {
RETURN_TRUE;
@@ -4480,18 +4497,18 @@
PHP_ME(PharFileInfo, __construct, arginfo_entry___construct, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, __destruct, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, chmod, arginfo_entry_chmod, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, compress, arginfo_phar_comp, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, decompress, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, delMetadata, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getContent, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, getCompressedSize, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, getCRC32, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getContent, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, getMetadata, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, getPharFlags, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, hasMetadata, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, isCompressed, arginfo_phar_compo, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, isCRCChecked, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, compress, arginfo_phar_comp, ZEND_ACC_PUBLIC)
PHP_ME(PharFileInfo, setMetadata, arginfo_phar_setMetadata, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, decompress, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
#endif /* HAVE_SPL */