From 2bfef30c039af3ec5c1a19d6de42578575c05ed7 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 18 Aug 2015 07:03:45 +0100 Subject: [PATCH] New FTP functions added to mkdir and change perms --- lib/ftp-control.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/ftp-control.php b/lib/ftp-control.php index f4d116a..268c69b 100644 --- a/lib/ftp-control.php +++ b/lib/ftp-control.php @@ -45,4 +45,22 @@ function ftpWriteFile($ftpConn, $filepath, $contents, $ftpMode) { // Write our content and return true/false return ftp_fput($ftpConn, $filepath, $tempHandle, $ftpMode, 0); } + +// Make a new dir over FTP +function ftpMkDir($ftpConn, $perms, $dir) { + // Create the new dir + if (!ftp_mkdir($ftpConn, $dir)) { + return false; + } else { + // Also then set perms (we must be able to do that if we created dir, so can always return true) + ftpPerms($ftpConn, $perms, $dir); + return true; + } +} + +// Change dir/file perms over FTP +function ftpPerms($ftpConn, $perms, $filePath) { + // Return success status of perms change + return ftp_chmod($ftpConn, $perms, $filePath); +} ?> \ No newline at end of file