mirror of
https://github.com/danog/MadelineProto.git
synced 2024-12-02 14:17:45 +01:00
Merge branch 'danog:v8' into v8
This commit is contained in:
commit
717635c9a2
@ -51,7 +51,7 @@ final class API extends AbstractAPI
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE = '8.0.0-beta121';
|
public const RELEASE = '8.0.0-beta122';
|
||||||
/**
|
/**
|
||||||
* Secret chat was not found.
|
* Secret chat was not found.
|
||||||
*
|
*
|
||||||
|
@ -72,10 +72,10 @@ final class GarbageCollector
|
|||||||
$cb = function () use ($client, $request, &$id): void {
|
$cb = function () use ($client, $request, &$id): void {
|
||||||
try {
|
try {
|
||||||
$latest = $client->request($request);
|
$latest = $client->request($request);
|
||||||
Magic::$version_latest = \trim($latest->getBody()->buffer());
|
Magic::$latest_release = \trim($latest->getBody()->buffer());
|
||||||
if (Magic::$version !== Magic::$version_latest) {
|
if (API::RELEASE !== Magic::$latest_release) {
|
||||||
$old = Magic::$version;
|
$old = API::RELEASE;
|
||||||
$new = Magic::$version_latest;
|
$new = Magic::$latest_release;
|
||||||
Logger::log("!!!!!!!!!!!!! An update of MadelineProto is required (old=$old, new=$new)! !!!!!!!!!!!!!", Logger::FATAL_ERROR);
|
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)))
|
$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) {
|
foreach (\glob(MADELINE_PHAR_GLOB) as $path) {
|
||||||
$base = \basename($path);
|
$base = \basename($path);
|
||||||
if ($base === 'madeline-'.Magic::$version.'.phar') {
|
if ($base === 'madeline-'.API::RELEASE.'.phar') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$f = \fopen("$path.lock", 'c');
|
$f = \fopen("$path.lock", 'c');
|
||||||
|
@ -1657,7 +1657,7 @@ final class MTProto implements TLCallback, LoggerGetter
|
|||||||
{
|
{
|
||||||
Magic::start(light: false);
|
Magic::start(light: false);
|
||||||
$warning = '';
|
$warning = '';
|
||||||
if (Magic::$version !== Magic::$version_latest) {
|
if (API::RELEASE !== Magic::$latest_release) {
|
||||||
$warning .= "<h2 style='color:red;'>".\htmlentities(Lang::$current_lang['update_madelineproto']).'</h2>';
|
$warning .= "<h2 style='color:red;'>".\htmlentities(Lang::$current_lang['update_madelineproto']).'</h2>';
|
||||||
}
|
}
|
||||||
if (!Magic::$hasOpenssl) {
|
if (!Magic::$hasOpenssl) {
|
||||||
|
@ -156,16 +156,11 @@ final class Magic
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static string $revision;
|
public static string $revision;
|
||||||
/**
|
|
||||||
* MadelineProto version (clean).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static ?string $version;
|
|
||||||
/**
|
/**
|
||||||
* Latest MadelineProto version.
|
* Latest MadelineProto version.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static ?string $version_latest;
|
public static ?string $latest_release;
|
||||||
/**
|
/**
|
||||||
* Our CWD.
|
* Our CWD.
|
||||||
*
|
*
|
||||||
@ -286,18 +281,7 @@ final class Magic
|
|||||||
self::$altervista = isset($_SERVER['SERVER_ADMIN']) && \strpos($_SERVER['SERVER_ADMIN'], 'altervista.org');
|
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::$zerowebhost = isset($_SERVER['SERVER_ADMIN']) && \strpos($_SERVER['SERVER_ADMIN'], '000webhost.io');
|
||||||
self::$can_getmypid = !self::$altervista && !self::$zerowebhost;
|
self::$can_getmypid = !self::$altervista && !self::$zerowebhost;
|
||||||
self::$version = null;
|
self::$revision = 'Revision: '.API::RELEASE;
|
||||||
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::$initedLight = true;
|
self::$initedLight = true;
|
||||||
if ($light) {
|
if ($light) {
|
||||||
return;
|
return;
|
||||||
@ -332,14 +316,14 @@ final class Magic
|
|||||||
self::$twoe1984 = new BigInteger('010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
self::$twoe1984 = new BigInteger('010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
||||||
self::$twoe2047 = new BigInteger('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
self::$twoe2047 = new BigInteger('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
||||||
self::$twoe2048 = new BigInteger('0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
self::$twoe2048 = new BigInteger('0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 16);
|
||||||
if (self::$version && !isset(self::$version_latest)) {
|
if (!isset(self::$latest_release)) {
|
||||||
self::$version_latest = null;
|
self::$latest_release = null;
|
||||||
try {
|
try {
|
||||||
$php = (string) \min(81, (int) (PHP_MAJOR_VERSION.PHP_MINOR_VERSION));
|
$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) {
|
} catch (Throwable $e) {
|
||||||
}
|
}
|
||||||
if (self::$version_latest !== self::$version) {
|
if (self::$latest_release !== API::RELEASE) {
|
||||||
self::$revision .= ' (AN UPDATE IS REQUIRED)';
|
self::$revision .= ' (AN UPDATE IS REQUIRED)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ abstract class Serialization
|
|||||||
Logger::log("Session has event handler, but it's not started.", Logger::ERROR);
|
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("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);
|
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)) {
|
} elseif ($class && \is_subclass_of($class, EventHandler::class)) {
|
||||||
EventHandler::cachePlugins($class);
|
EventHandler::cachePlugins($class);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ namespace danog\MadelineProto\Settings;
|
|||||||
use danog\MadelineProto\Exception;
|
use danog\MadelineProto\Exception;
|
||||||
use danog\MadelineProto\Lang;
|
use danog\MadelineProto\Lang;
|
||||||
use danog\MadelineProto\Magic;
|
use danog\MadelineProto\Magic;
|
||||||
use danog\MadelineProto\MTProto;
|
|
||||||
use danog\MadelineProto\SettingsAbstract;
|
use danog\MadelineProto\SettingsAbstract;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ final class AppInfo extends SettingsAbstract
|
|||||||
$this->setLangCode(\explode('_', $_SERVER['LANG'])[0]);
|
$this->setLangCode(\explode('_', $_SERVER['LANG'])[0]);
|
||||||
}
|
}
|
||||||
$this->init();
|
$this->init();
|
||||||
$this->appVersion = \danog\MadelineProto\API::RELEASE.' ('.MTProto::V.', '.Magic::$version.')';
|
$this->appVersion = \danog\MadelineProto\API::RELEASE;
|
||||||
}
|
}
|
||||||
public function __wakeup(): void
|
public function __wakeup(): void
|
||||||
{
|
{
|
||||||
|
@ -203,7 +203,7 @@ if [ "$PLATFORM" == "linux/arm64" ]; then :; else exit 0; fi
|
|||||||
cp "$input/madeline$php$branch.phar" "madeline81.phar"
|
cp "$input/madeline$php$branch.phar" "madeline81.phar"
|
||||||
git remote add hub https://github.com/danog/MadelineProto
|
git remote add hub https://github.com/danog/MadelineProto
|
||||||
|
|
||||||
echo -n "$COMMIT-81" > release
|
echo -n "$TAG" > release
|
||||||
cp tools/phar.php madeline.php
|
cp tools/phar.php madeline.php
|
||||||
|
|
||||||
gh release upload "$TAG" "madeline81.phar"
|
gh release upload "$TAG" "madeline81.phar"
|
||||||
|
@ -20,8 +20,6 @@ if (!isset($argv[3])) {
|
|||||||
|
|
||||||
$p = new Phar(__DIR__.'/../'.$argv[2], 0, $argv[2]);
|
$p = new Phar(__DIR__.'/../'.$argv[2], 0, $argv[2]);
|
||||||
$p->buildFromDirectory(realpath($argv[1]), '/^((?!tests).)*(\.php|\.py|\.exe|\.tl|\.json|\.dat|\.h)$/i');
|
$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('<?php
|
$p->setStub('<?php
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user