Skip to content

Commit e0a1bd6

Browse files
committed
Changes per Copilot review
1 parent ca0abd7 commit e0a1bd6

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

poller_servcheck.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
pcntl_signal(SIGUSR1, 'sig_handler');
4242
}
4343

44-
// let PHP run just as long as it has to
45-
ini_set('max_execution_time', '270');
46-
4744
$dir = __DIR__;
4845
chdir($dir);
4946

@@ -140,7 +137,7 @@
140137
AND taskname = ?', [$taskname]);
141138

142139
if (cacti_sizeof($processes)) {
143-
foreach ($process as $p) {
140+
foreach ($processes as $p) {
144141
posix_kill($p['pid'], SIGINT);
145142

146143
db_execute_prepared('DELETE FROM processes
@@ -174,10 +171,11 @@
174171
$params[] = $test_id;
175172
}
176173

177-
$tests = db_fetch_assoc_prepared('SELECT *
174+
$tests = db_fetch_assoc_prepared("SELECT *
178175
FROM plugin_servcheck_test
179-
WHERE enabled = "on"',
180-
$sql_where, $params);
176+
WHERE enabled = 'on',
177+
$sql_where",
178+
$params);
181179

182180
$max_processes = read_config_option('servcheck_processes');
183181

@@ -235,7 +233,7 @@
235233
FROM processes
236234
WHERE tasktype = ?
237235
AND taskname = ?',
238-
['servcheck', 'child']);
236+
['servcheck', $taskname]);
239237

240238
if ($running == 0) {
241239
break;
@@ -320,7 +318,7 @@ function sig_handler($signo) {
320318
AND taskname = ?',
321319
[$taskname]);
322320

323-
cacti_log('Signaling ' . cacti_sizeof($processes), false, 'SERVHECK');
321+
cacti_log('Signaling ' . cacti_sizeof($processes), false, 'SERVCHECK');
324322

325323
if (cacti_sizeof($processes)) {
326324
foreach ($processes as $p) {

servcheck_process.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,14 +807,14 @@ function plugin_servcheck_send_email($to, $subject, $message) {
807807
* @return void
808808
*/
809809
function sig_handler($signo) {
810-
global $force, $poller_id, $task_id, $taskname;
810+
global $force, $poller_id, $test_id, $taskname;
811811

812812
switch ($signo) {
813813
case SIGTERM:
814814
case SIGINT:
815-
cacti_log("WARNING: MacTrack Poller 'master' is shutting down by signal!", false, 'MACTRACK');
815+
cacti_log("WARNING: Service Check Poller 'master' is shutting down by signal!", false, 'SERVCHECK');
816816

817-
unregister_process('servcheck', "child_:$poller_id", $test_id, getmypid());
817+
unregister_process('servcheck', "child:$poller_id", $test_id, getmypid());
818818

819819
exit(1);
820820
default:

0 commit comments

Comments
 (0)