1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 06:18:58 +01:00

Separately require entry module

This commit is contained in:
Daniil Gentili 2021-09-06 16:22:07 +02:00
parent 5d9009dc27
commit 657e974264
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
6 changed files with 20 additions and 6 deletions

5
.gitignore vendored
View File

@ -124,3 +124,8 @@ extracted.json
ponyScripts
*.madeline.*
uwu
madeline*phar
madeline*phar.version
e.php

View File

@ -89,7 +89,6 @@
"files": [
"src/BigIntegor.php",
"src/YieldReturnValue.php",
"src/danog/MadelineProto/Ipc/Runner/entry.php",
"src/polyfill.php"
]
},

View File

@ -306,7 +306,7 @@ class API extends InternalDoc
if ($unserialized === 0) {
// Timeout
Logger::log("!!! Could not connect to MadelineProto, please check and report the logs for more details. !!!", Logger::FATAL_ERROR);
if (!$tryReconnect) {
if (!$tryReconnect || (\defined('MADELINEPROTO_TEST') && \constant("MADELINEPROTO_TEST") === 'pony')) {
throw new Exception('Could not connect to MadelineProto, please check the MadelineProto.log file to debug!');
}
Logger::log("!!! Reconnecting using slower method. !!!", Logger::FATAL_ERROR);

View File

@ -55,7 +55,7 @@ class ContextConnector implements Connector
$this->logger->logger('OK!', \danog\MadelineProto\Logger::WARNING);
return $result->getSocket();
} catch (\Throwable $e) {
if (\defined('MADELINEPROTO_TEST') && \constant("MADELINEPROTO_TEST") === 'pony') {
if (\defined('MADELINEPROTO_TEST') && \constant("MADELINEPROTO_TEST") === 'pony') {
throw $e;
}
$this->logger->logger('Connection failed: '.$e, \danog\MadelineProto\Logger::ERROR);

View File

@ -28,6 +28,7 @@ if ($phar = \getenv('ACTIONS_PHAR')) {
} else {
require_once 'vendor/autoload.php';
}
define('MADELINEPROTO_TEST', 'pony');
if ($loader) {
foreach ($loader->getClassMap() as $class => $file) {
if (\in_array($class, [

View File

@ -109,7 +109,11 @@ function ___install_madeline()
}
$packages = [];
foreach ($composer['packages'] as $dep) {
$packages[$dep['name']] = $dep['version_normalized'];
$name = $dep['name'];
if (strpos($name, 'phabel/transpiler') === 0) {
$name = explode('/', $name, 3)[2];
}
$packages[$name] = $dep['version_normalized'];
}
return $packages;
};
@ -123,6 +127,7 @@ function ___install_madeline()
\file_put_contents($madeline_phar, $phar, LOCK_EX);
\file_put_contents("$madeline_phar.version", $release, LOCK_EX);
unset($phar);
$current = $extractVersions();
$postData = ['downloads' => []];
@ -164,7 +169,11 @@ function ___install_madeline()
}
}
return $madeline_phar;
$result = require_once $madeline_phar;
if (defined('MADELINE_WORKER_TYPE') && constant('MADELINE_WORKER_TYPE') === 'madeline-ipc') {
require_once "phar://$madeline_phar/vendor/danog/madelineproto/src/danog/MadelineProto/Ipc/Runner/entry.php";
}
return $result;
}
return require_once ___install_madeline();
return ___install_madeline();