mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Rename AutoUpdater -> UpdateChecker
This commit is contained in:
parent
17c7e25346
commit
d488c25a1a
@ -87,7 +87,7 @@ use pocketmine\snooze\SleeperNotifier;
|
|||||||
use pocketmine\stats\SendUsageTask;
|
use pocketmine\stats\SendUsageTask;
|
||||||
use pocketmine\timings\Timings;
|
use pocketmine\timings\Timings;
|
||||||
use pocketmine\timings\TimingsHandler;
|
use pocketmine\timings\TimingsHandler;
|
||||||
use pocketmine\updater\AutoUpdater;
|
use pocketmine\updater\UpdateChecker;
|
||||||
use pocketmine\utils\AssumptionFailedError;
|
use pocketmine\utils\AssumptionFailedError;
|
||||||
use pocketmine\utils\Config;
|
use pocketmine\utils\Config;
|
||||||
use pocketmine\utils\Filesystem;
|
use pocketmine\utils\Filesystem;
|
||||||
@ -183,7 +183,7 @@ class Server{
|
|||||||
|
|
||||||
private float $profilingTickRate = 20;
|
private float $profilingTickRate = 20;
|
||||||
|
|
||||||
private AutoUpdater $updater;
|
private UpdateChecker $updater;
|
||||||
|
|
||||||
private AsyncPool $asyncPool;
|
private AsyncPool $asyncPool;
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ class Server{
|
|||||||
return $this->logger;
|
return $this->logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdater() : AutoUpdater{
|
public function getUpdater() : UpdateChecker{
|
||||||
return $this->updater;
|
return $this->updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -951,7 +951,7 @@ class Server{
|
|||||||
$this->worldManager->setAutoSave($this->configGroup->getConfigBool("auto-save", $this->worldManager->getAutoSave()));
|
$this->worldManager->setAutoSave($this->configGroup->getConfigBool("auto-save", $this->worldManager->getAutoSave()));
|
||||||
$this->worldManager->setAutoSaveInterval($this->configGroup->getPropertyInt("ticks-per.autosave", 6000));
|
$this->worldManager->setAutoSaveInterval($this->configGroup->getPropertyInt("ticks-per.autosave", 6000));
|
||||||
|
|
||||||
$this->updater = new AutoUpdater($this, $this->configGroup->getPropertyString("auto-updater.host", "update.pmmp.io"));
|
$this->updater = new UpdateChecker($this, $this->configGroup->getPropertyString("auto-updater.host", "update.pmmp.io"));
|
||||||
|
|
||||||
$this->queryInfo = new QueryInfo($this);
|
$this->queryInfo = new QueryInfo($this);
|
||||||
|
|
||||||
|
@ -23,21 +23,21 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\event\server;
|
namespace pocketmine\event\server;
|
||||||
|
|
||||||
use pocketmine\updater\AutoUpdater;
|
use pocketmine\updater\UpdateChecker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the AutoUpdater receives notification of an available PocketMine-MP update.
|
* Called when the AutoUpdater receives notification of an available PocketMine-MP update.
|
||||||
* Plugins may use this event to perform actions when an update notification is received.
|
* Plugins may use this event to perform actions when an update notification is received.
|
||||||
*/
|
*/
|
||||||
class UpdateNotifyEvent extends ServerEvent{
|
class UpdateNotifyEvent extends ServerEvent{
|
||||||
/** @var AutoUpdater */
|
/** @var UpdateChecker */
|
||||||
private $updater;
|
private $updater;
|
||||||
|
|
||||||
public function __construct(AutoUpdater $updater){
|
public function __construct(UpdateChecker $updater){
|
||||||
$this->updater = $updater;
|
$this->updater = $updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdater() : AutoUpdater{
|
public function getUpdater() : UpdateChecker{
|
||||||
return $this->updater;
|
return $this->updater;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class UpdateCheckTask extends AsyncTask{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
private $error = "Unknown error";
|
private $error = "Unknown error";
|
||||||
|
|
||||||
public function __construct(AutoUpdater $updater, string $endpoint, string $channel){
|
public function __construct(UpdateChecker $updater, string $endpoint, string $channel){
|
||||||
$this->storeLocal(self::TLS_KEY_UPDATER, $updater);
|
$this->storeLocal(self::TLS_KEY_UPDATER, $updater);
|
||||||
$this->endpoint = $endpoint;
|
$this->endpoint = $endpoint;
|
||||||
$this->channel = $channel;
|
$this->channel = $channel;
|
||||||
@ -74,7 +74,7 @@ class UpdateCheckTask extends AsyncTask{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onCompletion() : void{
|
public function onCompletion() : void{
|
||||||
/** @var AutoUpdater $updater */
|
/** @var UpdateChecker $updater */
|
||||||
$updater = $this->fetchLocal(self::TLS_KEY_UPDATER);
|
$updater = $this->fetchLocal(self::TLS_KEY_UPDATER);
|
||||||
if($this->hasResult()){
|
if($this->hasResult()){
|
||||||
/** @var UpdateInfo $response */
|
/** @var UpdateInfo $response */
|
||||||
|
@ -34,7 +34,7 @@ use function strlen;
|
|||||||
use function strtolower;
|
use function strtolower;
|
||||||
use function ucfirst;
|
use function ucfirst;
|
||||||
|
|
||||||
class AutoUpdater{
|
class UpdateChecker{
|
||||||
|
|
||||||
/** @var Server */
|
/** @var Server */
|
||||||
protected $server;
|
protected $server;
|
||||||
@ -50,7 +50,7 @@ class AutoUpdater{
|
|||||||
|
|
||||||
public function __construct(Server $server, string $endpoint){
|
public function __construct(Server $server, string $endpoint){
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->logger = new \PrefixedLogger($server->getLogger(), "Auto Updater");
|
$this->logger = new \PrefixedLogger($server->getLogger(), "Update Checker");
|
||||||
$this->endpoint = "http://$endpoint/api/";
|
$this->endpoint = "http://$endpoint/api/";
|
||||||
|
|
||||||
if($server->getConfigGroup()->getPropertyBool("auto-updater.enabled", true)){
|
if($server->getConfigGroup()->getPropertyBool("auto-updater.enabled", true)){
|
||||||
@ -121,7 +121,7 @@ class AutoUpdater{
|
|||||||
* @param string[] $lines
|
* @param string[] $lines
|
||||||
*/
|
*/
|
||||||
protected function printConsoleMessage(array $lines, string $logLevel = \LogLevel::INFO) : void{
|
protected function printConsoleMessage(array $lines, string $logLevel = \LogLevel::INFO) : void{
|
||||||
$title = $this->server->getName() . ' Auto Updater';
|
$title = $this->server->getName() . ' Update Checker';
|
||||||
$this->logger->log($logLevel, sprintf('----- %s -----', $title));
|
$this->logger->log($logLevel, sprintf('----- %s -----', $title));
|
||||||
foreach($lines as $line){
|
foreach($lines as $line){
|
||||||
$this->logger->log($logLevel, $line);
|
$this->logger->log($logLevel, $line);
|
@ -248,22 +248,22 @@ parameters:
|
|||||||
-
|
-
|
||||||
message: "#^Cannot access property \\$date on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
message: "#^Cannot access property \\$date on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/updater/AutoUpdater.php
|
path: ../../../src/updater/UpdateChecker.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot access property \\$details_url on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
message: "#^Cannot access property \\$details_url on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/updater/AutoUpdater.php
|
path: ../../../src/updater/UpdateChecker.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot access property \\$download_url on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
message: "#^Cannot access property \\$download_url on pocketmine\\\\updater\\\\UpdateInfo\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/updater/AutoUpdater.php
|
path: ../../../src/updater/UpdateChecker.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot call method getFullVersion\\(\\) on pocketmine\\\\utils\\\\VersionString\\|null\\.$#"
|
message: "#^Cannot call method getFullVersion\\(\\) on pocketmine\\\\utils\\\\VersionString\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/updater/AutoUpdater.php
|
path: ../../../src/updater/UpdateChecker.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method pocketmine\\\\utils\\\\Config\\:\\:fixYAMLIndexes\\(\\) should return string but returns string\\|null\\.$#"
|
message: "#^Method pocketmine\\\\utils\\\\Config\\:\\:fixYAMLIndexes\\(\\) should return string but returns string\\|null\\.$#"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user