Disabled //restart , restored backwards compatibility for the backend on restart
This commit is contained in:
parent
c04f39a056
commit
9dc455774f
@ -15,6 +15,8 @@ interface CommunicationMethods {
|
|||||||
* - message
|
* - message
|
||||||
*/
|
*/
|
||||||
const REBOOT_MANIA_CONTROL = "ManiaControl.Reboot";
|
const REBOOT_MANIA_CONTROL = "ManiaControl.Reboot";
|
||||||
|
/** @deprecated */
|
||||||
|
const RESTART_MANIA_CONTROL = "ManiaControl.Restart";
|
||||||
|
|
||||||
/** Update the ManiaControl Core */
|
/** Update the ManiaControl Core */
|
||||||
const UPDATE_MANIA_CONTROL_CORE = "UpdateManager.CoreUpdate";
|
const UPDATE_MANIA_CONTROL_CORE = "UpdateManager.CoreUpdate";
|
||||||
|
@ -228,6 +228,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
|
|||||||
// Commands
|
// Commands
|
||||||
$this->getCommandManager()->registerCommandListener('version', $this, 'commandVersion', false, 'Shows ManiaControl version.');
|
$this->getCommandManager()->registerCommandListener('version', $this, 'commandVersion', false, 'Shows ManiaControl version.');
|
||||||
$this->getCommandManager()->registerCommandListener('reboot', $this, 'commandReboot', true, 'Reboots ManiaControl.');
|
$this->getCommandManager()->registerCommandListener('reboot', $this, 'commandReboot', true, 'Reboots ManiaControl.');
|
||||||
|
$this->getCommandManager()->registerCommandListener('restart', $this, 'commandRestart', true, 'Restarts ManiaControl.');
|
||||||
$this->getCommandManager()->registerCommandListener('shutdown', $this, 'commandShutdown', true, 'Shuts ManiaControl down.');
|
$this->getCommandManager()->registerCommandListener('shutdown', $this, 'commandShutdown', true, 'Shuts ManiaControl down.');
|
||||||
|
|
||||||
// Check connection every 30 seconds
|
// Check connection every 30 seconds
|
||||||
@ -549,6 +550,30 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
|
|||||||
$this->reboot("ManiaControl Reboot requested by '{$player->login}'!");
|
$this->reboot("ManiaControl Reboot requested by '{$player->login}'!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Restart AdminCommand
|
||||||
|
*
|
||||||
|
* @param array $chatCallback
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
public function commandRestart(array $chatCallback, Player $player) {
|
||||||
|
if (!$this->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_REBOOT)) {
|
||||||
|
$this->getAuthenticationManager()->sendNotAllowed($player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->getChat->sendError('The command //restart got disabled, reboot ManiaControl with //reboot instead', $player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* Restart ManiaControl
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
*/
|
||||||
|
public function restart($message = null) {
|
||||||
|
$this->reboot($message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reboot ManiaControl
|
* Reboot ManiaControl
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
|
|
||||||
// Admin commands
|
// Admin commands
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true, 'Skips to the next map.');
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true, 'Skips to the next map.');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('restartmap', 'resmap', 'restart', 'res'), $this, 'command_RestartMap', true, 'Restarts the current map.');
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true, 'Restarts the current map.');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true, 'Replays the current map (after the end of the map).');
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true, 'Replays the current map (after the end of the map).');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true, 'Adds map from ManiaExchange.');
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true, 'Adds map from ManiaExchange.');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('removemap', 'removethis'), $this, 'command_RemoveMap', true, 'Removes the current map.');
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('removemap', 'removethis'), $this, 'command_RemoveMap', true, 'Removes the current map.');
|
||||||
|
@ -134,13 +134,13 @@ class SystemUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart ManiaControl immediately
|
* Reboot ManiaControl immediately
|
||||||
*/
|
*/
|
||||||
public static function restart() {
|
public static function reboot() {
|
||||||
if (SystemUtil::isUnix()) {
|
if (SystemUtil::isUnix()) {
|
||||||
self::restartUnix();
|
self::rebootUnix();
|
||||||
} else {
|
} else {
|
||||||
self::restartWindows();
|
self::rebootWindows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,9 +156,9 @@ class SystemUtil {
|
|||||||
/**
|
/**
|
||||||
* Perform restart on Unix
|
* Perform restart on Unix
|
||||||
*/
|
*/
|
||||||
private static function restartUnix() {
|
private static function rebootUnix() {
|
||||||
if (!SystemUtil::checkFunctionAvailability('exec')) {
|
if (!SystemUtil::checkFunctionAvailability('exec')) {
|
||||||
Logger::log("Can't restart ManiaControl because the function 'exec' is disabled!");
|
Logger::log("Can't reboot ManiaControl because the function 'exec' is disabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$fileName = null;
|
$fileName = null;
|
||||||
@ -169,7 +169,7 @@ class SystemUtil {
|
|||||||
}
|
}
|
||||||
$filePath = MANIACONTROL_PATH . $fileName;
|
$filePath = MANIACONTROL_PATH . $fileName;
|
||||||
if (!is_readable($filePath)) {
|
if (!is_readable($filePath)) {
|
||||||
Logger::log("Can't restart ManiaControl because the file '{$fileName}' doesn't exist or isn't readable!");
|
Logger::log("Can't reboot ManiaControl because the file '{$fileName}' doesn't exist or isn't readable!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$command = 'sh ' . escapeshellarg($filePath) . ' > /dev/null &';
|
$command = 'sh ' . escapeshellarg($filePath) . ' > /dev/null &';
|
||||||
@ -197,11 +197,11 @@ class SystemUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform restart on Windows
|
* Perform reboot on Windows
|
||||||
*/
|
*/
|
||||||
private static function restartWindows() {
|
private static function rebootWindows() {
|
||||||
if (!SystemUtil::checkFunctionAvailability('system')) {
|
if (!SystemUtil::checkFunctionAvailability('system')) {
|
||||||
Logger::log("Can't restart ManiaControl because the function 'system' is disabled!");
|
Logger::log("Can't reboot ManiaControl because the function 'system' is disabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$fileName = null;
|
$fileName = null;
|
||||||
@ -212,7 +212,7 @@ class SystemUtil {
|
|||||||
}
|
}
|
||||||
$filePath = MANIACONTROL_PATH . $fileName;
|
$filePath = MANIACONTROL_PATH . $fileName;
|
||||||
if (!is_readable($filePath)) {
|
if (!is_readable($filePath)) {
|
||||||
Logger::log("Can't restart ManiaControl because the file '{$fileName}' doesn't exist or isn't readable!");
|
Logger::log("Can't reboot ManiaControl because the file '{$fileName}' doesn't exist or isn't readable!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$command = escapeshellarg($filePath);
|
$command = escapeshellarg($filePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user