From 78b6c2ec05957c65db5be1709945f39c8629515e Mon Sep 17 00:00:00 2001 From: Joan Date: Thu, 23 Jan 2014 11:36:59 +0100 Subject: [PATCH] Improved permission detection when using ftp backend --- core/src/plugins/access.ftp/class.ftpAccessDriver.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/plugins/access.ftp/class.ftpAccessDriver.php b/core/src/plugins/access.ftp/class.ftpAccessDriver.php index c10feca1da..8e8b1010c9 100644 --- a/core/src/plugins/access.ftp/class.ftpAccessDriver.php +++ b/core/src/plugins/access.ftp/class.ftpAccessDriver.php @@ -220,9 +220,18 @@ public function isWriteable($path, $type="dir") if ($type == "dir" && ($dir == "" || $dir == "/" || $dir == "\\")) { // ROOT, WE ARE NOT SURE TO BE ABLE TO READ THE PARENT return true; } else { + if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") { + return is_writable($path); + } else { + if (extension_loaded("posix")) { + posix_access($path, POSIX_W_OK); + return posix_get_last_error(); + } else { + return is_writable($path); + } + } return is_writable($path); } - } public function deldir($location)