Marius Cramer
2015-04-15 cab08cc8b0e89577efbdefb9cd614ed466375a1b
- ported patches
2 files modified
1 files added
33 ■■■■■ changed files
server/conf/hhvm_monit.master 3 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 15 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 15 ●●●●● patch | view | raw | blame | history
server/conf/hhvm_monit.master
New file
@@ -0,0 +1,3 @@
check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
   start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart"
   stop  program = "/etc/init.d/hhvm_{SYSTEM_USER} stop"
server/plugins-available/apache2_plugin.inc.php
@@ -2799,6 +2799,11 @@
        } else {
            $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master');
        }
        if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) {
            $monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master');
        } else {
            $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master');
        }
        
        if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) {
        
@@ -2836,11 +2841,21 @@
            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');
            $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content);
            file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content);
            exec('/etc/init.d/monit 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');
            if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){
                unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']);
                exec('/etc/init.d/monit restart >/dev/null 2>&1');
            }
        }
    }
server/plugins-available/nginx_plugin.inc.php
@@ -2355,6 +2355,11 @@
        } else {
            $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master');
        }
        if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) {
            $monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master');
        } else {
            $monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master');
        }
        
        if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) {
@@ -2392,11 +2397,21 @@
            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'] . ' restart >/dev/null 2>&1');
            $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content);
            file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content);
            exec('/etc/init.d/monit 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');
            if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){
                unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']);
                exec('/etc/init.d/monit restart >/dev/null 2>&1');
            }
        }
    }