Skip to content

Commit cab08cc

Browse files
author
Marius Cramer
committed
- ported patches
1 parent 52e5158 commit cab08cc

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

server/conf/hhvm_monit.master

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
2+
start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart"
3+
stop program = "/etc/init.d/hhvm_{SYSTEM_USER} stop"

server/plugins-available/apache2_plugin.inc.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,11 @@ private function hhvm_update($data, $web_config) {
27992799
} else {
28002800
$content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master');
28012801
}
2802+
if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) {
2803+
$monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master');
2804+
} else {
2805+
$monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master');
2806+
}
28022807

28032808
if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) {
28042809

@@ -2836,11 +2841,21 @@ private function hhvm_update($data, $web_config) {
28362841
exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1');
28372842
exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1');
28382843
exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' start >/dev/null 2>&1');
2844+
2845+
$monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content);
2846+
file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content);
2847+
exec('/etc/init.d/monit restart >/dev/null 2>&1');
2848+
28392849
} elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') {
28402850
exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1');
28412851
exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1');
28422852
unlink('/etc/init.d/hhvm_' . $data['old']['system_user']);
28432853
if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini');
2854+
2855+
if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){
2856+
unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']);
2857+
exec('/etc/init.d/monit restart >/dev/null 2>&1');
2858+
}
28442859
}
28452860
}
28462861

server/plugins-available/nginx_plugin.inc.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,6 +2355,11 @@ private function hhvm_update($data, $web_config) {
23552355
} else {
23562356
$content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master');
23572357
}
2358+
if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) {
2359+
$monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master');
2360+
} else {
2361+
$monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master');
2362+
}
23582363

23592364
if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || $data['new']['custom_php_ini'] != $data['old']['custom_php_ini']) {
23602365

@@ -2392,11 +2397,21 @@ private function hhvm_update($data, $web_config) {
23922397
exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1');
23932398
exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1');
23942399
exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1');
2400+
2401+
$monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content);
2402+
file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content);
2403+
exec('/etc/init.d/monit restart >/dev/null 2>&1');
2404+
23952405
} elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') {
23962406
exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1');
23972407
exec('/usr/sbin/update-rc.d hhvm_' . $data['old']['system_user'] . ' remove >/dev/null 2>&1');
23982408
unlink('/etc/init.d/hhvm_' . $data['old']['system_user']);
23992409
if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini');
2410+
2411+
if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){
2412+
unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']);
2413+
exec('/etc/init.d/monit restart >/dev/null 2>&1');
2414+
}
24002415
}
24012416
}
24022417

0 commit comments

Comments
 (0)