]> granicus.if.org Git - php/commitdiff
- add php_mkdir_ex, works like php_mkdir but allows to silent any error
authorPierre Joye <pajoye@php.net>
Fri, 13 Jan 2006 04:06:00 +0000 (04:06 +0000)
committerPierre Joye <pajoye@php.net>
Fri, 13 Jan 2006 04:06:00 +0000 (04:06 +0000)
  when no options are used

NEWS
ext/standard/file.c
ext/standard/file.h

diff --git a/NEWS b/NEWS
index 675143dad2d2c0af37221e75f5f24646e14fcbc5..61990c1d4afe0a02f3e88b0d0177cacc832536c0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, PHP 5.1.3
-
+- Added intern function php_mkdir_ex, works like php_mkdir but supports
+  the streams options (only REPORT_ERRORS is used) (Pierre)
 12 Jan 2006, PHP 5.1.2
 - Updated libsqlite in ext/sqlite to 2.8.17. (Ilia)
 - Updated libsqlite in ext/pdo_sqlite to 3.2.8. (Ilia)
index de8de43206fdc77a86f2e20ed610ad89fa81b936..cd8f666335ec0f8bd5a51830a9c53b63faa2a998 100644 (file)
@@ -1355,10 +1355,10 @@ PHPAPI PHP_FUNCTION(fseek)
 /* {{{ proto int mkdir(char *dir int mode)
 */
 
-PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
+PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC)
 {
        int ret;
-       
+
        if (PG(safe_mode) && (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
                return -1;
        }
@@ -1367,11 +1367,16 @@ PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
                return -1;
        }
 
-       if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0) {
+       if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0 && (options & REPORT_ERRORS)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
        }
 
-       return ret;     
+       return ret;
+}
+
+PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
+{
+           return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC);
 }
 /* }}} */
 
index e34ef4d708a20a79b0693e98f90eb2c523fbb994..099a6ddbccc3d7570405b928337ffa642cf48cea 100644 (file)
@@ -72,6 +72,7 @@ PHP_MINIT_FUNCTION(user_streams);
 PHPAPI int php_le_stream_context(void);
 PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
 PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
+PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC);
 PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC);
 
 #define META_DEF_BUFSIZE 8192