Newer
Older
if($web_rec['allow_override'] == '') {
$sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id;
$app->db->query($sql);
}
//* Set php_open_basedir if empty or domain or client has been changed
if(empty($web_rec['php_open_basedir']) ||
(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
$php_open_basedir = $web_rec['php_open_basedir'];
$php_open_basedir = str_replace($this->oldDataRecord['domain'],$web_rec['domain'],$php_open_basedir);
$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
$app->db->query($sql);
}
if(empty($web_rec['php_open_basedir']) ||
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
$document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
$app->db->query($sql);
}
//* Change database backup options when web backup options have been changed
if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
//* Update all databases
$backup_interval = $this->dataRecord['backup_interval'];
$backup_copies = $this->dataRecord['backup_copies'];
$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
foreach($records as $rec) {
$app->db->datalogUpdate('web_database', "backup_interval = '$backup_interval', backup_copies = '$backup_copies'", 'database_id', $rec['database_id']);
}
unset($records);
unset($rec);
unset($backup_copies);
unset($backup_interval);
}
//* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
$records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
foreach($records as $rec) {
$app->db->datalogUpdate('web_domain', "ip_address = '".$web_rec['ip_address']."', ipv6_address = '".$web_rec['ipv6_address']."'", 'domain_id', $rec['domain_id']);
}
unset($records);
unset($rec);
}
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
}
function onAfterDelete() {
global $app, $conf;
// Delete the sub and alias domains
$child_domains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$this->id);
foreach($child_domains as $d) {
// Saving record to datalog when db_history enabled
if($app->tform->formDef["db_history"] == 'yes') {
$app->tform->datalogSave('DELETE',$d["domain_id"],$d,array());
}
$app->db->query("DELETE FROM web_domain WHERE domain_id = ".$d["domain_id"]." LIMIT 0,1");
}
unset($child_domains);
unset($d);
}
}
$page = new page_action;
$page->onLoad();