Commit d5f2d5f5 authored by Marius Cramer's avatar Marius Cramer

- ported some patches

parent 024e1329
......@@ -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);
......
......@@ -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;
......
......@@ -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=
......
......@@ -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);
......
......@@ -488,7 +488,7 @@ class tools_monitor {
$data = unserialize($record['data']);
if ($data == '') {
$html .= '<p>'.
'fail2ban is not installed at this server.<br />' .
'fail2ban is not installed on this server.<br />' .
'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
'</p>';
}
......@@ -522,8 +522,7 @@ class tools_monitor {
$data = unserialize($record['data']);
if ($data == '') {
$html .= '<p>'.
'MongoDB is not installed at this server.<br />' .
'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
'MongoDB is not installed on this server.<br />' .
'</p>';
}
else {
......
......@@ -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(
......
......@@ -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<tmpl_if name="use_combobox" value="y">, rerenderSelect2</tmpl_if>);
ISPConfig.loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId<tmpl_if name="use_combobox" value="y">, rerenderSelect2</tmpl_if>);
<tmpl_if name="use_combobox" value="y">
//$('#ip_address').add('#ipv6_address').select2();
</tmpl_if>
}
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) {
......
......@@ -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();
}
......
......@@ -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');
......
......@@ -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;
}
......
......@@ -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()
......
......@@ -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');
}
}
......
......@@ -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');
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment