mirror of
https://github.com/ShaYmez/ezservermonitor-web.git
synced 2026-06-01 21:45:03 -04:00
Some issues with Arch or old Ubuntu
This commit is contained in:
@@ -38,6 +38,31 @@ class Misc
|
||||
return $_SERVER['SERVER_ADDR'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a command that exists in the system among $cmds
|
||||
*/
|
||||
public static function whichCommand($cmds, $args = '', $returnWithArgs = true)
|
||||
{
|
||||
$return = '';
|
||||
|
||||
foreach ($cmds as $cmd)
|
||||
{
|
||||
if (trim(shell_exec($cmd.$args)) != '')
|
||||
{
|
||||
$return = $cmd;
|
||||
|
||||
if ($returnWithArgs)
|
||||
$return .= $args;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allows to pluralize a word based on a number
|
||||
* Ex : echo 'mot'.Misc::pluralize(5); ==> prints mots
|
||||
|
||||
Reference in New Issue
Block a user