mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 19:04:40 +01:00
Always run updateSettings if settings are passed to constructor
This commit is contained in:
parent
0eb5b36421
commit
f9fc6d8370
@ -123,7 +123,7 @@
|
||||
"test-php56": "tests/test-conversion.sh 5",
|
||||
"cs": "PHP_CS_FIXER_IGNORE_ENV=1 php -d pcre.jit=0 vendor/bin/php-cs-fixer fix -v --diff --dry-run",
|
||||
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php -d pcre.jit=0 vendor/bin/php-cs-fixer fix -v --diff",
|
||||
"psalm": "psalm.phar --no-cache",
|
||||
"psalm": "psalm --no-cache",
|
||||
"docs": "php tools/build_docs.php",
|
||||
"docs-fix": "tools/fix_docs.sh",
|
||||
"test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit --coverage-text",
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit f855706e1b65ce6b4c5a6babed5928a138d10f56
|
||||
Subproject commit 099e464774b3001f8bb54d9dd0ce61875ad5fceb
|
@ -13,6 +13,14 @@ final class OnlinePlugin extends PluginEventHandler
|
||||
{
|
||||
private bool $isOnline = true;
|
||||
|
||||
/**
|
||||
* Returns a list of names for properties that will be automatically saved to the session database (MySQL/postgres/redis if configured, the session file otherwise).
|
||||
*/
|
||||
public function __sleep(): array
|
||||
{
|
||||
return ['isOnline'];
|
||||
}
|
||||
|
||||
public function setOnline(bool $online): void
|
||||
{
|
||||
$this->isOnline = $online;
|
||||
|
@ -2,6 +2,8 @@
|
||||
<psalm
|
||||
errorLevel="2"
|
||||
resolveFromConfigFile="true"
|
||||
findUnusedCode="false"
|
||||
findUnusedBaselineEntry="false"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
|
@ -211,6 +211,9 @@ final class API extends AbstractAPI
|
||||
: ($settings instanceof SettingsLogger ? $settings : new SettingsLogger));
|
||||
|
||||
if ($this->connectToMadelineProto($settings)) {
|
||||
if (!$settings instanceof SettingsEmpty) {
|
||||
EventLoop::queue($this->updateSettings(...), $settings);
|
||||
}
|
||||
return; // OK
|
||||
}
|
||||
|
||||
|
@ -282,10 +282,6 @@ final class DataCenter
|
||||
*/
|
||||
public function generateContexts(int $dc_number, ?ConnectContext $context = null): array
|
||||
{
|
||||
if (!isset($this->dclist[$test][$ipv6][$dc_number])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ctxs = [];
|
||||
$combos = [];
|
||||
$test = $this->settings->getTestMode() ? 'test' : 'main';
|
||||
@ -326,6 +322,10 @@ final class DataCenter
|
||||
}
|
||||
$combos[] = $default;
|
||||
|
||||
if (!isset($this->dclist[$test][$ipv6][$dc_number])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$only = $this->dclist[$test][$ipv6][$dc_number]['tcpo_only'];
|
||||
if ($only || isset($this->dclist[$test][$ipv6][$dc_number]['secret'])) {
|
||||
$extra = isset($this->dclist[$test][$ipv6][$dc_number]['secret']) ? ['secret' => $this->dclist[$test][$ipv6][$dc_number]['secret']] : [];
|
||||
|
@ -29,7 +29,6 @@ use danog\MadelineProto\Lang;
|
||||
use danog\MadelineProto\MTProto;
|
||||
use danog\MadelineProto\RPCErrorException;
|
||||
use danog\MadelineProto\Settings;
|
||||
use danog\MadelineProto\TL\Types\LoginQrCode;
|
||||
use danog\MadelineProto\Tools;
|
||||
|
||||
use const PHP_SAPI;
|
||||
@ -58,7 +57,6 @@ trait Start
|
||||
if ($this->getAuthorization() === API::NOT_LOGGED_IN) {
|
||||
$stdout = getStdout();
|
||||
do {
|
||||
/** @var ?LoginQrCode */
|
||||
$qr = $this->qrLogin();
|
||||
if (!$qr) {
|
||||
$this->serialize();
|
||||
@ -218,13 +216,11 @@ trait Start
|
||||
} elseif (isset($_GET['waitQrCodeOrLogin']) || isset($_GET['getQrCode'])) {
|
||||
\header('Content-type: application/json');
|
||||
try {
|
||||
/** @var ?LoginQrCode */
|
||||
$qr = $this->qrLogin();
|
||||
if (isset($_GET['waitQrCodeOrLogin'])) {
|
||||
$qr = $qr?->waitForLoginOrQrCodeExpiration(Tools::getTimeoutCancellation(5.0));
|
||||
}
|
||||
} catch (CancelledException) {
|
||||
/** @var ?LoginQrCode */
|
||||
$qr = $this->qrLogin();
|
||||
}
|
||||
if ($qr) {
|
||||
|
Loading…
Reference in New Issue
Block a user