Extract ServerConfigGroup from Server

this API isn't very nice, but it's pretty much the same as the original, and at least this can be _kinda_ unit-tested...
This commit is contained in:
Dylan K. Taylor
2020-05-24 15:48:03 +01:00
parent b05fab3e3c
commit fe649d8d70
15 changed files with 258 additions and 204 deletions

View File

@ -57,7 +57,7 @@ class AutoUpdater{
$this->logger = new \PrefixedLogger($server->getLogger(), "Auto Updater");
$this->endpoint = "http://$endpoint/api/";
if((bool) $server->getProperty("auto-updater.enabled", true)){
if((bool) $server->getConfigGroup()->getProperty("auto-updater.enabled", true)){
$this->doCheck();
}
}
@ -77,7 +77,7 @@ class AutoUpdater{
$this->checkUpdate();
if($this->hasUpdate()){
(new UpdateNotifyEvent($this))->call();
if((bool) $this->server->getProperty("auto-updater.on-update.warn-console", true)){
if((bool) $this->server->getConfigGroup()->getProperty("auto-updater.on-update.warn-console", true)){
$this->showConsoleUpdate();
}
}else{
@ -187,7 +187,7 @@ class AutoUpdater{
* Returns the channel used for update checking (stable, beta, dev)
*/
public function getChannel() : string{
$channel = strtolower($this->server->getProperty("auto-updater.preferred-channel", "stable"));
$channel = strtolower($this->server->getConfigGroup()->getProperty("auto-updater.preferred-channel", "stable"));
if($channel !== "stable" and $channel !== "beta" and $channel !== "alpha" and $channel !== "development"){
$channel = "stable";
}