[fix] more bugs in update_domaines.php => not renaming vhosts_all.conf.new to vhosts_all.conf.new + ignoring deletion of DNS_ONLY sub_domaines entries

This commit is contained in:
Benjamin Sonntag 2018-07-17 17:11:15 +02:00
parent 1e4f2783d8
commit e705f377b9
2 changed files with 10 additions and 1 deletions

View File

@ -160,6 +160,7 @@ class m_apache {
}
closedir($d);
fclose($f);
rename($this->vhostroot."/vhosts_all.conf.new", $this->vhostroot."/vhosts_all.conf");
}
private function subconcat($f,$root) {

View File

@ -1943,14 +1943,22 @@ class m_dom {
$db->query("SELECT sd.*, dt.only_dns FROM domaines_type dt, sub_domaines sd WHERE dt.name=sd.type AND sd.web_action!='OK';");
$alldoms=array();
$ignore=array();
$delete=array();
while ($db->next_record()) {
// only_dns=1 => weird, we should not have web_action SET to something else than OK ... anyway, skip it
if ($db->Record["only_dns"]) {
$ignore[]=$db->Record["id"];
if ($db->Record["web_action"]=="DELETE") {
$delete[]=$db->Record["id"];
} else {
$ignore[]=$db->Record["id"];
}
} else {
$alldoms[$db->Record["id"]]=$db->Record;
}
}
foreach($delete as $id) {
$db->query("DELETE FROM sub_domaines WHERE id=?;",array($id));
}
foreach($ignore as $id) {
// @FIXME (unsure it's useful) maybe we could check that no file exist for this subdomain ?
$db->query("UPDATE sub_domaines SET web_action='OK' WHERE id=?;",array($id));