Skip to content

Commit 2bfef30

Browse files
committed
New FTP functions added to mkdir and change perms
1 parent 7540ef8 commit 2bfef30

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

lib/ftp-control.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,22 @@ function ftpWriteFile($ftpConn, $filepath, $contents, $ftpMode) {
4545
// Write our content and return true/false
4646
return ftp_fput($ftpConn, $filepath, $tempHandle, $ftpMode, 0);
4747
}
48+
49+
// Make a new dir over FTP
50+
function ftpMkDir($ftpConn, $perms, $dir) {
51+
// Create the new dir
52+
if (!ftp_mkdir($ftpConn, $dir)) {
53+
return false;
54+
} else {
55+
// Also then set perms (we must be able to do that if we created dir, so can always return true)
56+
ftpPerms($ftpConn, $perms, $dir);
57+
return true;
58+
}
59+
}
60+
61+
// Change dir/file perms over FTP
62+
function ftpPerms($ftpConn, $perms, $filePath) {
63+
// Return success status of perms change
64+
return ftp_chmod($ftpConn, $perms, $filePath);
65+
}
4866
?>

0 commit comments

Comments
 (0)