Skip to content

Commit

Permalink
Fix issue with ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Apr 8, 2024
1 parent f54f2fc commit b5535e6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 33 deletions.
42 changes: 21 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require": {
"php-64bit": ">=8.2",
"danog/primemodule": "^1",
"danog/primemodule": "^1.0.13",
"symfony/polyfill-mbstring": "*",
"ext-mbstring": "*",
"ext-json": "*",
Expand All @@ -35,44 +35,44 @@
"ext-zlib": "*",
"ext-fileinfo": "*",
"amphp/amp": "^3",
"amphp/http-client": "^5",
"amphp/http-client": "^5.0.1",
"amphp/websocket-client": "^2",
"amphp/http": "^2",
"amphp/socket": "^2",
"amphp/dns": "^2",
"amphp/byte-stream": "^2",
"amphp/file": "^3.0.1",
"amphp/http": "^2.1.1",
"amphp/socket": "^2.3",
"amphp/dns": "^2.1.1",
"amphp/byte-stream": "^2.1.1",
"amphp/file": "^3.0.2",
"amphp/mysql": "^3",
"amphp/postgres": "^2",
"danog/dns-over-https": "^1",
"amphp/http-client-cookies": "^2",
"danog/tg-file-decoder": "^1",
"league/uri": "^7",
"league/uri": "^7.4.1",
"danog/ipc": "^1",
"amphp/log": "^2",
"danog/loop": "^1.1.0",
"phpseclib/phpseclib": "^3.0.22",
"danog/loop": "^1.1.1",
"phpseclib/phpseclib": "^3.0.37",
"amphp/redis": "^2",
"psr/http-factory": "^1.0",
"psr/http-factory": "^1.0.2",
"psr/log": "^3",
"webmozart/assert": "^1.11",
"bacon/bacon-qr-code": "^2.0",
"nikic/php-parser": "^5",
"revolt/event-loop": "^1.0.5",
"danog/async-orm": "^1.0.1",
"bacon/bacon-qr-code": "^2.0.8",
"nikic/php-parser": "^5.0.2",
"revolt/event-loop": "^1.0.6",
"danog/async-orm": "^1.0.2",
"symfony/thanks": "^1.3"
},
"require-dev": {
"ext-ctype": "*",
"danog/phpdoc": "^0.1.7",
"phpunit/phpunit": "^9",
"danog/phpdoc": "^0.1.24",
"phpunit/phpunit": "^9.6.19",
"amphp/phpunit-util": "^3",
"bamarni/composer-bin-plugin": "1.8.2",
"symfony/yaml": "^6.0",
"amphp/http-server": "^3",
"revolt/event-loop-adapter-react": "^1",
"symfony/yaml": "^6.4.3",
"amphp/http-server": "^3.3",
"revolt/event-loop-adapter-react": "^1.1.1",
"dg/bypass-finals": "dev-master",
"brianium/paratest": "^6.11"
"brianium/paratest": "^6.11.1"
},
"suggest": {
"ext-primemodule": "Install the primemodule and FFI extensions to speed up MadelineProto (https://prime.madelineproto.xyz)",
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 1 files
+196 −0 docs/docs/FAQ.md.save
2 changes: 1 addition & 1 deletion src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class API extends AbstractAPI
*
* @var string
*/
public const RELEASE = '8.0.0-beta197';
public const RELEASE = '8.0.0-beta198';
/**
* We're not logged in.
*
Expand Down
23 changes: 14 additions & 9 deletions src/MTProto.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,7 @@ private function cleanupProperties(): void
$this->minDatabase ??= new MinDatabase($this);
$this->peerDatabase ??= new PeerDatabase($this);

$db = [];
$db []= async($this->referenceDatabase->init(...));
$db []= async($this->minDatabase->init(...));
$db []= async($this->peerDatabase->init(...));
$db []= async($this->internalInitDbProperties(...), $this->getDbSettings(), $this->getDbPrefix().'_MTProto_');
foreach ($this->secretChats as $chat) {
$db []= async($chat->init(...));
}
await($db);
$this->initDb();

if (!isset($this->TL)) {
$this->TL = new TL($this);
Expand All @@ -924,6 +916,19 @@ private function cleanupProperties(): void
$this->seqUpdater ??= new SeqLoop($this);
}

/** @internal */
public function initDb(): void
{
$db = [];
$db []= async($this->referenceDatabase->init(...));
$db []= async($this->minDatabase->init(...));
$db []= async($this->peerDatabase->init(...));
$db []= async($this->internalInitDbProperties(...), $this->getDbSettings(), $this->getDbPrefix().'_MTProto_');
foreach ($this->secretChats as $chat) {
$db []= async($chat->init(...));
}
await($db);
}
/**
* Upgrade MadelineProto instance.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/MTProtoTools/PeerDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private function processChat(int $id): void
) {
$existingChat = $this->db[$chat['id']];
if (!$existingChat || $existingChat != $chat) {
$this->API->logger("Updated chat -{$chat['id']}", Logger::ULTRA_VERBOSE);
$this->API->logger("Updated chat {$chat['id']}", Logger::ULTRA_VERBOSE);
if (!$this->API->settings->getDb()->getEnablePeerInfoDb()) {
$chat = [
'_' => $chat['_'],
Expand Down
2 changes: 2 additions & 0 deletions src/Wrappers/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ private function processAuthorization(array $authorization): array
$this->fullGetSelf();
$this->getPhoneConfig();
$this->startUpdateSystem();
$this->initDb();
$this->serialize();
return $authorization;
}
/**
Expand Down

0 comments on commit b5535e6

Please sign in to comment.