Skip to content

Commit 92ada02

Browse files
committed
Fixed: FS#797 - FTP User - changing sites does not work
1 parent 3721d3e commit 92ada02

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

interface/web/sites/ftp_user_edit.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@ function onBeforeUpdate() {
165165
function onAfterUpdate() {
166166
global $app, $conf;
167167

168+
//* When the site of the FTP user has been changed
169+
if($this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) {
170+
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
171+
$server_id = $web["server_id"];
172+
$dir = $web["document_root"];
173+
$uid = $web["system_user"];
174+
$gid = $web["system_group"];
175+
176+
// The FTP user shall be owned by the same group then the website
177+
$sys_groupid = $web['sys_groupid'];
178+
179+
$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid', sys_groupid = '$sys_groupid' WHERE ftp_user_id = ".$this->id;
180+
$app->db->query($sql);
181+
}
168182

169183
}
170184

0 commit comments

Comments
 (0)