1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 05:58:58 +01:00
This commit is contained in:
Daniil Gentili 2023-12-21 20:24:22 +01:00
parent 49c9c190db
commit 4e007dc301

View File

@ -22,6 +22,7 @@ use danog\MadelineProto\Exception;
use danog\MadelineProto\Logger;
use danog\MadelineProto\Settings\Database\Mysql as DatabaseMysql;
use PDO;
use Webmozart\Assert\Assert;
/**
* MySQL database backend.
@ -132,7 +133,9 @@ final class MysqlArray extends SqlArray
$database = $this->dbSettings->getDatabase();
$result = $this->db->prepare("SELECT data_free FROM information_schema.tables WHERE table_schema=? AND table_name=?")
->execute([$database, $this->table])
->fetchRow()['data_free'];
->fetchRow();
Assert::notNull($result);
$result = $result['data_free'];
if (($result >> 20) > $this->dbSettings->getOptimizeIfWastedGtMb()) {
$this->db->query("OPTIMIZE TABLE `{$this->table}`");
}