mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 03:34:42 +01:00
Test igbinary serialization
This commit is contained in:
parent
115497e4f6
commit
93af384d96
@ -49,7 +49,11 @@ final class DbPropertiesFactory
|
||||
'enableCache' => true,
|
||||
'cacheTtl' => $dbSettingsCopy->getCacheTtl(),
|
||||
], $config);
|
||||
if ($config['innerMadelineProto']) {
|
||||
|
||||
if ($config['innerMadelineProto']
|
||||
&& $config['serializer'] !== SerializerType::IGBINARY
|
||||
&& $config['serializer'] !== SerializerType::SERIALIZE
|
||||
) {
|
||||
$config['serializer'] = Magic::$can_use_igbinary
|
||||
? SerializerType::IGBINARY
|
||||
: SerializerType::SERIALIZE;
|
||||
|
@ -122,8 +122,9 @@ abstract class DriverDatabaseAbstract extends DatabaseAbstract
|
||||
*
|
||||
* If null, the best serializer is chosen.
|
||||
*/
|
||||
public function setSerializer(?SerializerType $serializer): void
|
||||
public function setSerializer(?SerializerType $serializer): static
|
||||
{
|
||||
$this->serializer = $serializer;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ use danog\MadelineProto\Settings\Database\Memory;
|
||||
use danog\MadelineProto\Settings\Database\Mysql;
|
||||
use danog\MadelineProto\Settings\Database\Postgres;
|
||||
use danog\MadelineProto\Settings\Database\Redis;
|
||||
use danog\MadelineProto\Settings\Database\SerializerType;
|
||||
|
||||
$MadelineProto = new API(__DIR__.'/../testing.madeline');
|
||||
|
||||
@ -31,6 +32,8 @@ $map = [
|
||||
'redis' => (new Redis)->setUri('redis://redis'),
|
||||
];
|
||||
|
||||
$MadelineProto->updateSettings($map[$argv[1]]);
|
||||
$MadelineProto->updateSettings(
|
||||
$map[$argv[1]]->setSerializer($argv[2] === 'igbinary' ? SerializerType::IGBINARY : SerializerType::SERIALIZE)
|
||||
);
|
||||
|
||||
var_dump($MadelineProto->getFullInfo('danogentili'));
|
||||
|
@ -96,15 +96,17 @@ cd $madelinePath
|
||||
|
||||
db()
|
||||
{
|
||||
php tests/db.php $1
|
||||
php tests/db.php $1 $2
|
||||
}
|
||||
cycledb()
|
||||
{
|
||||
db memory
|
||||
db mysql
|
||||
db postgres
|
||||
db redis
|
||||
db memory
|
||||
for f in serialize igbinary; do
|
||||
db memory $f
|
||||
db mysql $f
|
||||
db postgres $f
|
||||
db redis $f
|
||||
db memory $f
|
||||
done
|
||||
}
|
||||
|
||||
runTestSimple()
|
||||
@ -135,7 +137,7 @@ echo "Testing with previous version..."
|
||||
export ACTIONS_FORCE_PREVIOUS=1
|
||||
cp tools/phar.php madeline.php
|
||||
runTest
|
||||
db mysql
|
||||
db mysql serialize
|
||||
k
|
||||
|
||||
echo "Testing with new version (upgrade)..."
|
||||
|
Loading…
Reference in New Issue
Block a user