| | |
| | | $ini_array = ini_to_array(stripslashes($tmp['config'])); |
| | | $current_db_version = (isset($tmp['dbversion']))?intval($tmp['dbversion']):0; |
| | | |
| | | if(count($ini_array) == 0) die('Unable to read server configuration from database.'); |
| | | if(!is_array($ini_array) or count($ini_array) == 0) die('Unable to read server configuration from database.'); |
| | | |
| | | $conf['services']['mail'] = ($tmp['mail_server'] == 1)?true:false; |
| | | $conf['services']['web'] = ($tmp['web_server'] == 1)?true:false; |
| | |
| | | |
| | | |
| | | //** Update server ini |
| | | $tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM server WHERE server_id = ".$conf['server_id']); |
| | | $tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM ".$conf["mysql"]["database"].".server WHERE server_id = ".$conf['server_id']); |
| | | $old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config'])); |
| | | unset($tmp_server_rec); |
| | | $tpl_ini_array = ini_to_array(rf('tpl/server.ini.master')); |
| | |
| | | $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; |
| | | $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; |
| | | |
| | | $tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir']; |
| | | $tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir']; |
| | | $tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user']; |
| | | $tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group']; |
| | | $tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket']; |
| | | $tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script']; |
| | | $tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path']; |
| | | $tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir']; |
| | | $tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port']; |
| | | $tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir']; |
| | | |
| | | if ($conf['nginx']['installed'] == true) { |
| | | $tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir']; |
| | | $tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir']; |
| | | $tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user']; |
| | | $tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group']; |
| | | $tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket']; |
| | | $tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script']; |
| | | $tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path']; |
| | | $tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir']; |
| | | $tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port']; |
| | | $tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir']; |
| | | $tpl_ini_array['web']['server_type'] = 'nginx'; |
| | | $tpl_ini_array['global']['webserver'] = 'nginx'; |
| | | } |
| | |
| | | } |
| | | |
| | | $new_ini = array_to_ini($tpl_ini_array); |
| | | $inst->db->query("UPDATE server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id']); |
| | | $sql = "UPDATE ".$conf["mysql"]["database"].".server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id']; |
| | | $inst->db->query($sql); |
| | | unset($old_ini_array); |
| | | unset($tpl_ini_array); |
| | | unset($new_ini); |
| | | |
| | | |
| | | //** Update system ini |
| | | $tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM sys_ini WHERE sysini_id = 1"); |
| | | $tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM ".$conf["mysql"]["database"].".sys_ini WHERE sysini_id = 1"); |
| | | $old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config'])); |
| | | unset($tmp_server_rec); |
| | | $tpl_ini_array = ini_to_array(rf('tpl/system.ini.master')); |
| | |
| | | } |
| | | |
| | | $new_ini = array_to_ini($tpl_ini_array); |
| | | $tmp = $inst->db->queryOneRecord('SELECT count(sysini_id) as number FROM sys_ini WHERE 1'); |
| | | $tmp = $inst->db->queryOneRecord('SELECT count(sysini_id) as number FROM '.$conf["mysql"]["database"].'.sys_ini WHERE 1'); |
| | | if($tmp['number'] == 0) { |
| | | $inst->db->query("INSERT INTO sys_ini (sysini_id, config) VALUES (1,'".mysql_real_escape_string($new_ini)."')"); |
| | | $inst->db->query("INSERT INTO ".$conf["mysql"]["database"].".sys_ini (sysini_id, config) VALUES (1,'".mysql_real_escape_string($new_ini)."')"); |
| | | } else { |
| | | $inst->db->query("UPDATE sys_ini SET config = '".mysql_real_escape_string($new_ini)."' WHERE sysini_id = 1"); |
| | | $inst->db->query("UPDATE ".$conf["mysql"]["database"].".sys_ini SET config = '".mysql_real_escape_string($new_ini)."' WHERE sysini_id = 1"); |
| | | } |
| | | unset($old_ini_array); |
| | | unset($tpl_ini_array); |