Skip to content

Commit 4c30b28

Browse files
authored
Merge pull request #990 from tarasfrompir/patch-1
Update cycle_states.php
2 parents 9e6d206 + 5b1c9b4 commit 4c30b28

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Diff for: scripts/cycle_states.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,19 @@
1919
$cycleVarName='ThisComputer.'.str_replace('.php', '', basename(__FILE__)).'Run';
2020

2121
$objects = getObjectsByClass('systemStates');
22-
$total = count($objects);
22+
if (is_array($objects) || $objects instanceof Countable) {
23+
$total = count($objects);
24+
echo $total . " objects by class systemStates." . "\n";
25+
} else {
26+
$total = 0;
27+
echo "No systemStates objects found....". "\n";
28+
exit;
29+
}
2330

2431
if ($_GET['once'])
2532
{
33+
34+
echo "Runing once.......";
2635
$last_run = getGlobal((str_replace('.php', '', basename(__FILE__))) . 'Run');
2736

2837
if ((time() - $last_run) > 5 * 60)
@@ -34,7 +43,8 @@
3443
}
3544
}
3645

37-
echo "OK";
46+
echo "OK" . "\n";
47+
exit;
3848
}
3949
else
4050
{
@@ -54,9 +64,8 @@
5464
}
5565
}
5666

57-
if (file_exists('./reboot') || IsSet($_GET['onetime']))
58-
{
59-
exit;
67+
if (isRebootRequired() || IsSet($_GET['onetime'])) {
68+
exit;
6069
}
6170

6271
sleep(1);

0 commit comments

Comments
 (0)