fixed missing 'shutdown' message
This commit is contained in:
parent
7a87fa5aa6
commit
bdd82192bb
@ -390,26 +390,6 @@ class ErrorHandler {
|
|||||||
* Handle PHP Process Shutdown
|
* Handle PHP Process Shutdown
|
||||||
*/
|
*/
|
||||||
public function handleShutdown() {
|
public function handleShutdown() {
|
||||||
// TODO: skip client-related actions on transport exception (e.g. server down)
|
|
||||||
|
|
||||||
if ($this->maniaControl->getCallbackManager()) {
|
|
||||||
// OnShutdown callback
|
|
||||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->maniaControl->getChat()) {
|
|
||||||
// Announce quit
|
|
||||||
$this->maniaControl->getChat()->sendInformation('ManiaControl shutting down.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->maniaControl->getClient()) {
|
|
||||||
try {
|
|
||||||
$this->maniaControl->getClient()->sendHideManialinkPage();
|
|
||||||
} catch (TransportException $e) {
|
|
||||||
$this->handleException($e, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the Shutdown was caused by a Fatal Error and report it
|
// Check if the Shutdown was caused by a Fatal Error and report it
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
if ($error && self::isFatalError($error['type'])) {
|
if ($error && self::isFatalError($error['type'])) {
|
||||||
|
@ -211,8 +211,27 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
* @param bool $errorPrefix
|
* @param bool $errorPrefix
|
||||||
*/
|
*/
|
||||||
public function quit($message = null, $errorPrefix = false) {
|
public function quit($message = null, $errorPrefix = false) {
|
||||||
|
if ($this->getCallbackManager()) {
|
||||||
|
// OnShutdown callback
|
||||||
|
$this->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getChat()) {
|
||||||
|
// Announce quit
|
||||||
|
$this->getChat()->sendInformation('ManiaControl shutting down.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getClient()) {
|
||||||
|
try {
|
||||||
|
$this->getClient()->sendHideManialinkPage();
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
$this->getErrorHandler()->handleException($e, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connection::delete($this->getClient());
|
Connection::delete($this->getClient());
|
||||||
$this->client = null;
|
$this->client = null;
|
||||||
|
|
||||||
SystemUtil::quit($message, $errorPrefix);
|
SystemUtil::quit($message, $errorPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,8 +470,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function commandShutdown(array $chat, Player $player) {
|
public function commandShutdown(array $chat, Player $player) {
|
||||||
if (!$this->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN)
|
if (!$this->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN)) {
|
||||||
) {
|
|
||||||
$this->getAuthenticationManager()->sendNotAllowed($player);
|
$this->getAuthenticationManager()->sendNotAllowed($player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user