Skip to content

Commit 5d0df4e

Browse files
committed
Refactor to use is_installed helper function
1 parent 877a0ee commit 5d0df4e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

server/lib/classes/cron.d/100-monitor_raid.inc.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,14 @@ public function onRunJob() {
275275
/*
276276
* LSI MegaRaid
277277
*/
278-
system('which megacli', $retval);
279-
system('which megacli64', $retval64);
280-
if($retval === 0 || $retval64 === 0) {
281-
$binary=@($retval === 0)?'megacli':'megacli64';
278+
$binary = FALSE;
279+
if ($app->system->is_installed('megacli')) {
280+
$binary = 'megacli';
281+
}
282+
if ($app->system->is_installed('megacli64')) {
283+
$binary = 'megacli64';
284+
}
285+
if($binary) {
282286
$state = 'ok';
283287
$data['output'] = shell_exec($binary.' -LDInfo -Lall -aAll -NoLog');
284288
if (strpos($data['output'], 'Optimal') !== false) {

0 commit comments

Comments
 (0)