diff --git a/src/GarbageCollector.php b/src/GarbageCollector.php
index c4a624c32..0bb72b1d4 100644
--- a/src/GarbageCollector.php
+++ b/src/GarbageCollector.php
@@ -72,10 +72,10 @@ final class GarbageCollector
$cb = function () use ($client, $request, &$id): void {
try {
$latest = $client->request($request);
- Magic::$version_latest = \trim($latest->getBody()->buffer());
- if (Magic::$version !== Magic::$version_latest) {
- $old = Magic::$version;
- $new = Magic::$version_latest;
+ Magic::$latest_release = \trim($latest->getBody()->buffer());
+ if (API::RELEASE !== Magic::$latest_release) {
+ $old = API::RELEASE;
+ $new = Magic::$latest_release;
Logger::log("!!!!!!!!!!!!! An update of MadelineProto is required (old=$old, new=$new)! !!!!!!!!!!!!!", Logger::FATAL_ERROR);
$contents = $client->request(new Request("https://phar.madelineproto.xyz/phar.php?v=new".\rand(0, PHP_INT_MAX)))
@@ -105,7 +105,7 @@ final class GarbageCollector
foreach (\glob(MADELINE_PHAR_GLOB) as $path) {
$base = \basename($path);
- if ($base === 'madeline-'.Magic::$version.'.phar') {
+ if ($base === 'madeline-'.API::RELEASE.'.phar') {
continue;
}
$f = \fopen("$path.lock", 'c');
diff --git a/src/MTProto.php b/src/MTProto.php
index da4d31d33..5fb832614 100644
--- a/src/MTProto.php
+++ b/src/MTProto.php
@@ -1657,7 +1657,7 @@ final class MTProto implements TLCallback, LoggerGetter
{
Magic::start(light: false);
$warning = '';
- if (Magic::$version !== Magic::$version_latest) {
+ if (API::RELEASE !== Magic::$latest_release) {
$warning .= "
".\htmlentities(Lang::$current_lang['update_madelineproto']).'
';
}
if (!Magic::$hasOpenssl) {
diff --git a/src/Magic.php b/src/Magic.php
index 5830c3a61..2d66ea6fc 100644
--- a/src/Magic.php
+++ b/src/Magic.php
@@ -156,16 +156,11 @@ final class Magic
*
*/
public static string $revision;
- /**
- * MadelineProto version (clean).
- *
- */
- public static ?string $version;
/**
* Latest MadelineProto version.
*
*/
- public static ?string $version_latest;
+ public static ?string $latest_release;
/**
* Our CWD.
*
@@ -286,18 +281,7 @@ final class Magic
self::$altervista = isset($_SERVER['SERVER_ADMIN']) && \strpos($_SERVER['SERVER_ADMIN'], 'altervista.org');
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/v8')) {
- try {
- self::$version = \trim(@\file_get_contents(__DIR__.'/../.git/refs/heads/v8'));
- if (self::$version && !\str_ends_with(self::$version, '-81')) {
- // Running from within repo
- self::$version_latest = self::$version;
- }
- } catch (Throwable $e) {
- }
- }
- self::$revision = 'Revision: '.self::$version;
+ self::$revision = 'Revision: '.API::RELEASE;
self::$initedLight = true;
if ($light) {
return;
@@ -332,14 +316,14 @@ final class Magic
self::$twoe1984 = new BigInteger('010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
self::$twoe2047 = new BigInteger('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
self::$twoe2048 = new BigInteger('0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
- if (self::$version && !isset(self::$version_latest)) {
- self::$version_latest = null;
+ if (!isset(self::$latest_release)) {
+ self::$latest_release = null;
try {
$php = (string) \min(81, (int) (PHP_MAJOR_VERSION.PHP_MINOR_VERSION));
- self::$version_latest = \trim(@\file_get_contents("https://phar.madelineproto.xyz/release$php"));
+ self::$latest_release = \trim(@\file_get_contents("https://phar.madelineproto.xyz/release$php"));
} catch (Throwable $e) {
}
- if (self::$version_latest !== self::$version) {
+ if (self::$latest_release !== API::RELEASE) {
self::$revision .= ' (AN UPDATE IS REQUIRED)';
}
}
diff --git a/src/Serialization.php b/src/Serialization.php
index db4bd6389..c66e91517 100644
--- a/src/Serialization.php
+++ b/src/Serialization.php
@@ -206,7 +206,7 @@ abstract class Serialization
Logger::log("Session has event handler, but it's not started.", Logger::ERROR);
Logger::log("We don't have access to the event handler class, so we can't start it.", Logger::ERROR);
Logger::log('Please start the event handler or unset it to use the IPC server.', Logger::ERROR);
- throw new AssertionError("Please make sure the $class class is in scope.");
+ throw new AssertionError("Please make sure the $class class is in scope, or that the event handler is running (in a separate process).");
} elseif ($class && \is_subclass_of($class, EventHandler::class)) {
EventHandler::cachePlugins($class);
}
diff --git a/src/Settings/AppInfo.php b/src/Settings/AppInfo.php
index bee9b4df6..9512421f9 100644
--- a/src/Settings/AppInfo.php
+++ b/src/Settings/AppInfo.php
@@ -74,7 +74,7 @@ final class AppInfo extends SettingsAbstract
$this->setLangCode(\explode('_', $_SERVER['LANG'])[0]);
}
$this->init();
- $this->appVersion = \danog\MadelineProto\API::RELEASE.' ('.MTProto::V.', '.Magic::$version.')';
+ $this->appVersion = \danog\MadelineProto\API::RELEASE;
}
public function __wakeup(): void
{
diff --git a/tests/makephar.sh b/tests/makephar.sh
index 63513d1fe..6910994be 100755
--- a/tests/makephar.sh
+++ b/tests/makephar.sh
@@ -203,7 +203,7 @@ if [ "$PLATFORM" == "linux/arm64" ]; then :; else exit 0; fi
cp "$input/madeline$php$branch.phar" "madeline81.phar"
git remote add hub https://github.com/danog/MadelineProto
-echo -n "$COMMIT-81" > release
+echo -n "$TAG" > release
cp tools/phar.php madeline.php
gh release upload "$TAG" "madeline81.phar"
diff --git a/tools/makephar.php b/tools/makephar.php
index 281b023b2..6f2c1e5a4 100755
--- a/tools/makephar.php
+++ b/tools/makephar.php
@@ -20,8 +20,6 @@ if (!isset($argv[3])) {
$p = new Phar(__DIR__.'/../'.$argv[2], 0, $argv[2]);
$p->buildFromDirectory(realpath($argv[1]), '/^((?!tests).)*(\.php|\.py|\.exe|\.tl|\.json|\.dat|\.h)$/i');
-$p->addFromString('vendor/danog/madelineproto/.git/refs/heads/v8', $argv[3]);
-$p->addFromString('.git/refs/heads/v8', $argv[3]);
$p->setStub('