Update the database when we generate the apache conf
This commit is contained in:
		
							parent
							
								
									c4bae3f8ef
								
							
						
					
					
						commit
						c318efda56
					
				| 
						 | 
				
			
			@ -1973,6 +1973,20 @@ function generate_apacheconf($p = null) {
 | 
			
		|||
    return $r;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function subdomain_modif_are_done($sub_domain_id, $action) {
 | 
			
		||||
    global $db;
 | 
			
		||||
    $sub_domain_id=intval($sub_domain_id);
 | 
			
		||||
    switch (strtolower($action)) {
 | 
			
		||||
      case "delete":
 | 
			
		||||
        $sql="DELETE FROM sub_domaines WHERE id =$sub_domain_id;"; 
 | 
			
		||||
        break;
 | 
			
		||||
      default:
 | 
			
		||||
        $sql="UPDATE sub_domaines SET web_action='OK' WHERE id='$sub_domain_id'; ";
 | 
			
		||||
    }
 | 
			
		||||
    $db->query($sql);
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* ----------------------------------------------------------------- */
 | 
			
		||||
  /** hook function called by AlternC-upnp to know which open 
 | 
			
		||||
   * tcp or udp ports this class requires or suggests
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,7 @@ FIXME :
 | 
			
		|||
*/
 | 
			
		||||
 | 
			
		||||
// Check if we can modify Apache conf
 | 
			
		||||
@touch(ALTERNC_VHOST_FILE);
 | 
			
		||||
if ( ! is_writable( ALTERNC_VHOST_FILE )) {
 | 
			
		||||
  die("Error: ".ALTERNC_VHOST_FILE." is not writable\n");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +67,9 @@ if (! file_put_contents(ALTERNC_VHOST_FILE, $conf2) ) {
 | 
			
		|||
  die("Error: writing content\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Update the database to inform that we did the job
 | 
			
		||||
array_walk_recursive($todo, 'm_dom::subdomain_modif_are_done');
 | 
			
		||||
 | 
			
		||||
// Hooks !
 | 
			
		||||
foreach (array('DELETE', 'CREATE', 'UPDATE', 'ENABLE', 'DISABLE') as $y) {
 | 
			
		||||
  if (!isset($todo[$y]) || empty($todo[$y])) continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue