From 4dd3a2c9156e8b0cb70bda1f678030479b2ae4d9 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Thu, 6 Mar 2014 18:03:21 +0000 Subject: [PATCH] Ajout d'une alerte lors de certains cas problematiques sur la conf apache --- bureau/admin/dom_edit.php | 16 ++++++++++++---- bureau/class/m_dom.php | 29 ++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/bureau/admin/dom_edit.php b/bureau/admin/dom_edit.php index 7cd4f44a..e434ad4b 100644 --- a/bureau/admin/dom_edit.php +++ b/bureau/admin/dom_edit.php @@ -130,12 +130,22 @@ if (! empty($r['dns_result']) && $r['dns_result'] != '0') {

+domains_type_lst(); + +$problems = $dom->get_problems($domain); +if ( ! empty($problems) ) { + echo '

'; + foreach ($problems as $p) echo $p."
"; + echo "

"; +} + +?> domains_type_lst(); for($i=0;$i<$r["nsub"];$i++) { $disabled_class=in_array(strtoupper($r['sub'][$i]['enable']),array('DISABLED','DISABLE') )?'sub-disabled':''; @@ -155,9 +165,7 @@ $disabled_class=in_array(strtoupper($r['sub'][$i]['enable']),array('DISABLED','D - +
Record["type_desc"]; $r["sub"][$i]["only_dns"]=$db->Record["only_dns"]; $r["sub"][$i]["web_action"]=$db->Record["web_action"]; + $r["sub"][$i]["fqdn"]= ((!empty($r["sub"][$i]["name"]))?$r["sub"][$i]["name"].".": "").$r["name"] ; } $db->free(); return $r; @@ -1481,7 +1482,7 @@ class m_dom { } $db->query("UPDATE domaines SET gesdns='$dns', gesmx='$gesmx', zonettl='$ttl' WHERE domaine='$dom'"); - $db->query("UPDATE domaines set dns_action='UPDATE' where domaine='$dom';"); + $dom->set_dns_action($dom, 'UPDATE'); return true; } // edit_domain @@ -2052,6 +2053,32 @@ function generate_apacheconf($p = null) { ); } + // List if there is problems in the domains. + // Problems can appear when editing domains type properties + function get_problems($domain) { + $this->lock(); + $da = $this->get_domain_all($domain); + $this->unlock(); + + $errors = array(); + // Check if there is more than 1 apache conf + // by subdomain + $tmp = array(); + foreach ( $da['sub'] as $sub ) { + if ( ! $sub['only_dns'] ) { + if (!isset($tmp[$sub['fqdn']])) { + $tmp[$sub['fqdn']] = 0; + } + $tmp[$sub['fqdn']]++; + if ($tmp[$sub['fqdn']] >= 2 ) { + $errors[$sub['fqdn']]=sprintf(_("Problem on %s: there is more than 1 web configuration going to be generated for this sub-domain."), $sub['fqdn']); + } + } + } + // TODO: add a full compatibility check. + + return $errors; + } function default_domain_type() { // This function is only used to allow translation of default domain types: