check whether ManiaControl.sh exists before trying to restart

This commit is contained in:
Steffen Schröder 2014-06-29 17:27:01 +02:00
parent 3151ed2bc6
commit c1cc6449c5

View File

@ -251,7 +251,12 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
$this->log("Can't restart ManiaControl because the function 'exec' is disabled!");
return;
}
$command = 'sh ' . escapeshellarg(ManiaControlDir . 'ManiaControl.sh') . ' > /dev/null &';
$fileName = ManiaControlDir . 'ManiaControl.sh';
if (!is_readable($fileName)) {
$this->log("Can't restart ManiaControl because the file 'ManiaControl.sh' doesn't exist or isn't readable!");
return;
}
$command = 'sh ' . escapeshellarg($fileName) . ' > /dev/null &';
exec($command);
} else {
// Windows