summaryrefslogtreecommitdiff
path: root/ext/ftp/php_ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ftp/php_ftp.c')
-rw-r--r--ext/ftp/php_ftp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 233d707972..061b2aac6c 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -48,6 +48,7 @@ function_entry php_ftp_functions[] = {
PHP_FE(ftp_pwd, NULL)
PHP_FE(ftp_cdup, NULL)
PHP_FE(ftp_chdir, NULL)
+ PHP_FE(ftp_exec, NULL)
PHP_FE(ftp_mkdir, NULL)
PHP_FE(ftp_rmdir, NULL)
PHP_FE(ftp_nlist, NULL)
@@ -272,6 +273,36 @@ PHP_FUNCTION(ftp_chdir)
/* change directories */
if (!ftp_chdir(ftp, arg2->value.str.val)) {
php_error(E_WARNING, "ftp_chdir: %s", ftp->inbuf);
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto int ftp_exec(int stream, string command)
+ Changes directories */
+PHP_FUNCTION(ftp_exec)
+{
+ pval *arg1, *arg2;
+ ftpbuf_t *ftp;
+
+ /* arg1 - ftp
+ * arg2 - command
+ */
+ if (ARG_COUNT(ht) != 2 ||
+ getParameters(ht, 2, &arg1, &arg2) == FAILURE)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(arg2);
+
+ FTPBUF(ftp, arg1);
+
+ /* change directories */
+ if (!ftp_exec(ftp, arg2->value.str.val)) {
+ php_error(E_WARNING, "ftp_exec: %s", ftp->inbuf);
RETURN_FALSE;
}