diff --git a/install/install.php b/install/install.php index 3aedfefa856c1c0ea05ae325f312130d2c3be834..90cdf62160f458f686e96f980c60992c61cf4dec 100644 --- a/install/install.php +++ b/install/install.php @@ -713,6 +713,8 @@ if($install_mode == 'standard') { } //* << $install_mode / 'Standard' or Genius +$inst->create_mount_script(); + //* Create md5 filelist $md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index a59945584445821653b611f6eb1d8468413c06fd..d4772aea2ffe77762cf8c7abb67e5553e84c77dd 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2442,6 +2442,32 @@ Email Address []: } + public function create_mount_script(){ + global $app, $conf; + $mount_script = '/usr/local/ispconfig/server/scripts/backup_dir_mount.sh'; + $mount_command = ''; + + if(is_file($mount_script)) return; + if(is_file('/etc/rc.local')){ + $rc_local = file('/etc/rc.local'); + if(is_array($rc_local) && !empty($rc_local)){ + foreach($rc_local as $line){ + $line = trim($line); + if(substr($line, 0, 1) == '#') continue; + if(strpos($line, 'sshfs') !== false && strpos($line, '/var/backup') !== false){ + $mount_command = "#!/bin/sh\n\n"; + $mount_command .= $line."\n\n"; + file_put_contents($mount_script, $mount_command); + chmod($mount_script, 0755); + chown($mount_script, 'root'); + chgrp($mount_script, 'root'); + break; + } + } + } + } + } + // This function is called at the end of the update process and contains code to clean up parts of old ISPCONfig releases public function cleanup_ispconfig() { global $app,$conf; diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 4cb2222d72e275362cc9fab6bef1a8766b93af22..4259222c86629ea8068f4b9a2ecd10315be52815 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -16,7 +16,7 @@ firewall=bastille loglevel=2 admin_notify_events=1 backup_dir=/var/backup -backup_dir_is_mount=n +backup_dir_is_mount=y backup_mode=rootgz backup_delete=y monit_url= diff --git a/install/update.php b/install/update.php index aa42c24b0073a53ce52c0efe8d06e406404e1bc5..e0a6bd2287851b70ec48456863c8de1e587ce51d 100644 --- a/install/update.php +++ b/install/update.php @@ -516,6 +516,8 @@ if($reconfigure_services_answer == 'yes') { //* Set default servers setDefaultServers(); +$inst->create_mount_script(); + //* Create md5 filelist $md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php index ad76e4effce5297006eb3facf637a5f66d2c342b..bd1a969d57457fee98709adf390ea4ab12b0e00f 100644 --- a/interface/lib/classes/tools_monitor.inc.php +++ b/interface/lib/classes/tools_monitor.inc.php @@ -488,7 +488,7 @@ class tools_monitor { $data = unserialize($record['data']); if ($data == '') { $html .= '

'. - 'fail2ban is not installed at this server.
' . + 'fail2ban is not installed on this server.
' . 'See more (for debian) here...'. '

'; } @@ -522,8 +522,7 @@ class tools_monitor { $data = unserialize($record['data']); if ($data == '') { $html .= '

'. - 'MongoDB is not installed at this server.
' . - 'See more (for debian) here...'. + 'MongoDB is not installed on this server.
' . '

'; } else { diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 53c184f51e50819d6ca6116d8cd3d0fef29c8677..c3f940ea66ad9eac6d28b6f8b6409f29a8330f67 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -182,7 +182,7 @@ $form["tabs"]['server'] = array( 'backup_dir_is_mount' => array( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', - 'default' => 'n', + 'default' => 'y', 'value' => array(0 => 'n', 1 => 'y') ), 'backup_mode' => array( diff --git a/interface/web/sites/templates/web_vhost_domain_edit.htm b/interface/web/sites/templates/web_vhost_domain_edit.htm index e0a827621084fcb8f43d8b7bc5b877f24a73c1aa..fa537270546acf8700783f5d629615c586bf776c 100644 --- a/interface/web/sites/templates/web_vhost_domain_edit.htm +++ b/interface/web/sites/templates/web_vhost_domain_edit.htm @@ -333,9 +333,16 @@ } function reloadWebIP() { - ISPConfig.loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId); - ISPConfig.loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId); + ISPConfig.loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId, rerenderSelect2); + ISPConfig.loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId, rerenderSelect2); + + //$('#ip_address').add('#ipv6_address').select2(); + } + + function rerenderSelect2(elem) { + $('#'+elem).select2(); + } function reloadFastcgiPHPVersions(noFormChange) { jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi", client_group_id : clientGroupId}, function(data) { diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index af96fd8f7191379671edb86e12c62f83dab616f4..5997804c83fd2d8841948678b42981275b5c7024 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -719,6 +719,10 @@ class page_action extends tform_actions { if(is_array($tmp_client) && !empty($tmp_client) && trim($this->dataRecord['ssl_organisation']) == '' && trim($this->dataRecord['ssl_locality']) == '' && trim($this->dataRecord['ssl_state']) == '' && trim($this->dataRecord['ssl_organisation_unit']) == '') $app->tpl->setVar("show_helper_links", true); } + $sys_config = $app->getconf->get_global_config('misc'); + if($sys_config['use_combobox'] == 'y') { + $app->tpl->setVar('use_combobox', 'y'); + } parent::onShowEnd(); } diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js index 0416e4043b07c2e942acc021535039da8723bd55..b68af577edc9059c2d6bc420d66a37ac1c4914e6 100644 --- a/interface/web/themes/default/assets/javascripts/ispconfig.js +++ b/interface/web/themes/default/assets/javascripts/ispconfig.js @@ -464,7 +464,7 @@ var ISPConfig = { }); }, - loadOptionInto: function(elementid,pagename) { + loadOptionInto: function(elementid,pagename,callback) { var pageContentObject2 = $.ajax({ type: "GET", url: pagename, @@ -482,6 +482,9 @@ var ISPConfig = { foo2.value=elemente[i]; el.appendChild(foo2); } + if (typeof(callback) != 'undefined') { + callback(elementid,pagename); + } }, error: function() { ISPConfig.reportError('Ajax Request was not successful. 119'); diff --git a/interface/web/themes/default/assets/stylesheets/select2.css b/interface/web/themes/default/assets/stylesheets/select2.css index 2d07a0343b03a9e85705a6980c3f1516b287c67b..afa4e3fc037b9857a39d996365e3607900f76a84 100644 --- a/interface/web/themes/default/assets/stylesheets/select2.css +++ b/interface/web/themes/default/assets/stylesheets/select2.css @@ -442,7 +442,7 @@ disabled look for disabled choices in the results dropdown } .select2-results .select2-disabled { background: #f4f4f4; - display: list-item; + display: none; cursor: default; } diff --git a/server/conf/hhvm_starter.master b/server/conf/hhvm_starter.master index ee0bbec28607041c1a78fe40d15d3811e4bbee3c..a4cac46423891f58faff6d28e908ba1dfd88cb94 100644 --- a/server/conf/hhvm_starter.master +++ b/server/conf/hhvm_starter.master @@ -37,15 +37,29 @@ do_start() umask 017 sudo -u {SYSTEM_USER} touch /var/run/hhvm/hhvm_{SYSTEM_USER}.pid + + BASEINIFILE="" + if [[ -e "/etc/hhvm/php.ini" ]] ; then + BASEINIFILE="--config /etc/hhvm/php.ini" ; + fi + INIFILE="" if [[ -e "/var/www/conf/{SYSTEM_USER}/php.ini" ]] ; then - INIFILE="-vServer.IniFile=/var/www/conf/{SYSTEM_USER}/php.ini" ; + INIFILE="--config /var/www/conf/{SYSTEM_USER}/php.ini" ; elif [[ -e "/etc/php5/hhvm/php.ini" ]] ; then - INIFILE="-vServer.IniFile=/etc/php5/hhvm/php.ini" ; + INIFILE="--config /etc/php5/hhvm/php.ini" ; + elif [[ -e "/etc/php5/fpm/php.ini" ]] ; then + INIFILE="--config /etc/php5/fpm/php.ini" ; elif [[ -e "/etc/php5/cgi/php.ini" ]] ; then - INIFILE="-vServer.IniFile=/etc/php5/cgi/php.ini" ; + INIFILE="--config /etc/php5/cgi/php.ini" ; fi - /usr/bin/hhvm --mode daemon -vServer.Type=fastcgi --user {SYSTEM_USER} -vServer.FileSocket=/var/run/hhvm/hhvm.{SYSTEM_USER}.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc -vServer.FixPathInfo=false $INIFILE -vPidFile=/var/run/hhvm/hhvm_{SYSTEM_USER}.pid & echo $! > /var/run/hhvm/hhvm_{SYSTEM_USER}.pid + + CUSTOMINIFILE="" + if [[ -e "/etc/hhvm/{SYSTEM_USER}.ini" ]] ; then + CUSTOMINIFILE="--config /etc/hhvm/{SYSTEM_USER}.ini" ; + fi + + /usr/bin/hhvm --mode daemon -vServer.Type=fastcgi --user {SYSTEM_USER} -vServer.FileSocket=/var/run/hhvm/hhvm.{SYSTEM_USER}.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc -vServer.FixPathInfo=false $BASEINIFILE $INIFILE $CUSTOMINIFILE -vPidFile=/var/run/hhvm/hhvm_{SYSTEM_USER}.pid & echo $! > /var/run/hhvm/hhvm_{SYSTEM_USER}.pid } do_stop() diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 43b06f3dc5f2cdd9af53838de7651e5493c01930..34442c6657efda26f7f83916da31cc622f927cfe 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -2800,7 +2800,37 @@ class apache2_plugin { $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master'); } - if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm') { + if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) { + + // Custom php.ini settings + $custom_php_ini_settings = trim($data['new']['custom_php_ini']); + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); + if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ + $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); + if(is_array($required_php_snippets) && !empty($required_php_snippets)){ + foreach($required_php_snippets as $required_php_snippet){ + $required_php_snippet = intval($required_php_snippet); + if($required_php_snippet > 0){ + $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); + $php_snippet['snippet'] = trim($php_snippet['snippet']); + if($php_snippet['snippet'] != ''){ + $custom_php_ini_settings .= "\n".$php_snippet['snippet']; + } + } + } + } + } + } + if($custom_php_ini_settings != ''){ + // Make sure we only have Unix linebreaks + $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); + $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); + file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); + } else { + if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); + } + $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); @@ -2810,6 +2840,7 @@ class apache2_plugin { exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); + if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); } } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 4ff3c8c48e8156711e0f6e241e4ec91e9d8a5d97..8f8c62b234055958c29ae1524852949e9942e50e 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2356,16 +2356,47 @@ class nginx_plugin { $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master'); } - if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm') { + if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) { + + // Custom php.ini settings + $custom_php_ini_settings = trim($data['new']['custom_php_ini']); + if(intval($data['new']['directive_snippets_id']) > 0){ + $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); + if(isset($snippet['required_php_snippets']) && trim($snippet['required_php_snippets']) != ''){ + $required_php_snippets = explode(',', trim($snippet['required_php_snippets'])); + if(is_array($required_php_snippets) && !empty($required_php_snippets)){ + foreach($required_php_snippets as $required_php_snippet){ + $required_php_snippet = intval($required_php_snippet); + if($required_php_snippet > 0){ + $php_snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'php' AND active = 'y'", $required_php_snippet); + $php_snippet['snippet'] = trim($php_snippet['snippet']); + if($php_snippet['snippet'] != ''){ + $custom_php_ini_settings .= "\n".$php_snippet['snippet']; + } + } + } + } + } + } + if($custom_php_ini_settings != ''){ + // Make sure we only have Unix linebreaks + $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); + $custom_php_ini_settings = str_replace("\r", "\n", $custom_php_ini_settings); + file_put_contents('/etc/hhvm/'.$data['new']['system_user'].'.ini', $custom_php_ini_settings); + } else { + if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); + } + $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); - exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' start >/dev/null 2>&1'); + exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1'); unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); + if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); } }