mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 13:14:40 +01:00
Fix self-updates
This commit is contained in:
parent
26aa11ab2c
commit
5042b4fccc
@ -72,7 +72,7 @@ final class DataCenter
|
||||
*
|
||||
* @var array<int, DataCenterConnection>
|
||||
*/
|
||||
public array $sockets = [];
|
||||
private array $sockets = [];
|
||||
/**
|
||||
* Current DC ID.
|
||||
*/
|
||||
@ -453,13 +453,6 @@ final class DataCenter
|
||||
}
|
||||
return $ctxs;
|
||||
}
|
||||
/**
|
||||
* Get main API.
|
||||
*/
|
||||
public function getAPI(): MTProto
|
||||
{
|
||||
return $this->API;
|
||||
}
|
||||
/**
|
||||
* Get contents of file.
|
||||
*
|
||||
@ -523,15 +516,6 @@ final class DataCenter
|
||||
{
|
||||
return isset($this->sockets[$dc]);
|
||||
}
|
||||
/**
|
||||
* Check if connected to datacenter using HTTP.
|
||||
*
|
||||
* @param int $datacenter DC ID
|
||||
*/
|
||||
public function isHttp(int $datacenter): bool
|
||||
{
|
||||
return $this->sockets[$datacenter]->isHttp();
|
||||
}
|
||||
/**
|
||||
* Check if connected to datacenter directly using IP address.
|
||||
*
|
||||
|
@ -7,7 +7,6 @@ namespace danog\MadelineProto;
|
||||
use Amp\Http\Client\HttpClientBuilder;
|
||||
use Amp\Http\Client\Request;
|
||||
use Amp\SignalException;
|
||||
use danog\Loop\PeriodicLoop;
|
||||
use ReflectionFiber;
|
||||
use Revolt\EventLoop;
|
||||
use Throwable;
|
||||
@ -41,11 +40,6 @@ final class GarbageCollector
|
||||
*/
|
||||
private static int $memoryConsumption = 0;
|
||||
|
||||
/**
|
||||
* Phar cleanup loop.
|
||||
*/
|
||||
private static PeriodicLoop $cleanupLoop;
|
||||
|
||||
public static function start(): void
|
||||
{
|
||||
if (self::$started) {
|
||||
@ -91,7 +85,9 @@ final class GarbageCollector
|
||||
$latest = $client->request($request);
|
||||
Magic::$version_latest = \trim($latest->getBody()->buffer());
|
||||
if (Magic::$version !== Magic::$version_latest) {
|
||||
Logger::log('!!!!!!!!!!!!! An update of MadelineProto is required, shutting down worker! !!!!!!!!!!!!!', Logger::FATAL_ERROR);
|
||||
$old = Magic::$version;
|
||||
$new = Magic::$version_latest;
|
||||
Logger::log("!!!!!!!!!!!!! An update of MadelineProto is required (old=$old, new=$new)! !!!!!!!!!!!!!", Logger::FATAL_ERROR);
|
||||
write(MADELINE_PHAR_VERSION, '');
|
||||
if (Magic::$isIpcWorker) {
|
||||
throw new SignalException('!!!!!!!!!!!!! An update of MadelineProto is required, shutting down worker! !!!!!!!!!!!!!');
|
||||
|
@ -279,9 +279,9 @@ final class Magic
|
||||
self::$zerowebhost = isset($_SERVER['SERVER_ADMIN']) && \strpos($_SERVER['SERVER_ADMIN'], '000webhost.io');
|
||||
self::$can_getmypid = !self::$altervista && !self::$zerowebhost;
|
||||
self::$version = null;
|
||||
if (\file_exists(__DIR__.'/../../../.git/refs/heads/stable')) {
|
||||
if (\file_exists(__DIR__.'/../.git/refs/heads/stable')) {
|
||||
try {
|
||||
self::$version = \trim(@\file_get_contents(__DIR__.'/../../../.git/refs/heads/stable'));
|
||||
self::$version = \trim(@\file_get_contents(__DIR__.'/../.git/refs/heads/stable'));
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user