improved checkupdate command
This commit is contained in:
parent
411dae55b4
commit
d6a34bdeea
|
@ -8,6 +8,7 @@ use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
|
use ManiaControl\Plugins\Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager checking for ManiaControl Core and Plugin Updates
|
* Manager checking for ManiaControl Core and Plugin Updates
|
||||||
|
@ -168,15 +169,17 @@ class UpdateManager implements CallbackListener, CommandListener {
|
||||||
// Special nightly channel updating
|
// Special nightly channel updating
|
||||||
$updateData = $this->checkCoreUpdate(true);
|
$updateData = $this->checkCoreUpdate(true);
|
||||||
$buildDate = $this->getNightlyBuildDate();
|
$buildDate = $this->getNightlyBuildDate();
|
||||||
|
$releaseTime = strtotime($updateData->release_date);
|
||||||
if ($buildDate) {
|
if ($buildDate) {
|
||||||
$buildTime = strtotime($buildDate);
|
$buildTime = strtotime($buildDate);
|
||||||
$releaseTime = strtotime($updateData->release_date);
|
|
||||||
if ($buildTime >= $releaseTime) {
|
if ($buildTime >= $releaseTime) {
|
||||||
$this->maniaControl->chat->sendInformation('No new Build available!', $player->login);
|
$this->maniaControl->chat->sendInformation('No new Build available, current build: ' . date("Y-m-d", $buildTime) . '!', $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->maniaControl->chat->sendSuccess('New Nightly Build (' . date("Y-m-d", $releaseTime) . ') available, current build: ' . date("Y-m-d", $buildTime) . '!', $player->login);
|
||||||
|
} else {
|
||||||
|
$this->maniaControl->chat->sendSuccess('New Nightly Build (' . date("Y-m-d", $releaseTime) . ') available!', $player->login);
|
||||||
}
|
}
|
||||||
$this->maniaControl->chat->sendSuccess('New Nightly Build available!', $player->login);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +240,7 @@ class UpdateManager implements CallbackListener, CommandListener {
|
||||||
if (is_object($pluginClass)) {
|
if (is_object($pluginClass)) {
|
||||||
$pluginClass = get_class($pluginClass);
|
$pluginClass = get_class($pluginClass);
|
||||||
}
|
}
|
||||||
|
/** @var Plugin $pluginClass */
|
||||||
$pluginId = $pluginClass::getId();
|
$pluginId = $pluginClass::getId();
|
||||||
$url = self::URL_WEBSERVICE . 'plugins?id=' . $pluginId;
|
$url = self::URL_WEBSERVICE . 'plugins?id=' . $pluginId;
|
||||||
$dataJson = file_get_contents($url);
|
$dataJson = file_get_contents($url);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user