Fix sub-domains activation/deactivation

This commit is contained in:
Nina 2022-06-01 15:58:40 -04:00 committed by Camille Lafitte
parent 63b19754b5
commit 4832594a1e
1 changed files with 17 additions and 0 deletions

View File

@ -584,6 +584,7 @@ class m_dom {
$db->query("update sub_domaines set enable= ? where id = ? ;", array($status, intval($sub_id))); $db->query("update sub_domaines set enable= ? where id = ? ;", array($status, intval($sub_id)));
$this->set_dns_action($jh['domain'], 'UPDATE'); $this->set_dns_action($jh['domain'], 'UPDATE');
$this->set_web_action($sub_id, 'UPDATE');
return true; return true;
} }
@ -1998,6 +1999,13 @@ class m_dom {
if ($subdom["web_action"]=="DELETE") { if ($subdom["web_action"]=="DELETE") {
$db->query("DELETE FROM sub_domaines WHERE id=?;",array($id)); $db->query("DELETE FROM sub_domaines WHERE id=?;",array($id));
} else { } else {
// Set sub-domain status
if (strtoupper($subdom["enable"])=="DISABLE") {
$db->query("UPDATE sub_domaines SET enable='DISABLED' WHERE id=?;",array($id));
}
else if (strtoupper($subdom["enable"])=="ENABLE") {
$db->query("UPDATE sub_domaines SET enable='ENABLED' WHERE id=?;",array($id));
}
// we keep the highest result returned by hooks... // we keep the highest result returned by hooks...
rsort($ret,SORT_NUMERIC); $returncode=$ret[0]; rsort($ret,SORT_NUMERIC); $returncode=$ret[0];
$db->query("UPDATE sub_domaines SET web_result=?, web_action='OK' WHERE id=?;",array($returncode,$id)); $db->query("UPDATE sub_domaines SET web_result=?, web_action='OK' WHERE id=?;",array($returncode,$id));
@ -2019,6 +2027,15 @@ class m_dom {
return true; return true;
} }
/**
* @param string $web_action
*/
function set_web_action($sub_id, $dns_action) {
global $db;
$db->query("UPDATE sub_domaines SET web_action= ? WHERE id= ?; ", array($dns_action, $sub_id));
return true;
}
/** /**
* List if there are problems on the domain. * List if there are problems on the domain.