mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 06:59:01 +01:00
Merge branch 'master' of https://github.com/danog/MadelineProto
This commit is contained in:
commit
8a88dc8650
@ -8,7 +8,7 @@
|
||||
"require": {
|
||||
"php": ">=5.6.0",
|
||||
"danog/phpstruct": "^1.2",
|
||||
"phpseclib/phpseclib": "dev-master|^2.0.4",
|
||||
"phpseclib/phpseclib": "^2.0.4",
|
||||
"vlucas/phpdotenv": "^2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -17,6 +17,15 @@ namespace danog\MadelineProto;
|
||||
*/
|
||||
class Serialization
|
||||
{
|
||||
/**
|
||||
* Serialize API class.
|
||||
*
|
||||
* @param string $filename the dump file
|
||||
* @param API $instance
|
||||
* @param bool $force
|
||||
*
|
||||
* @return number|bool
|
||||
*/
|
||||
public static function serialize($filename, $instance, $force = false)
|
||||
{
|
||||
if ($instance->API->should_serialize || !(file_exists($filename) && !empty(file_get_contents($filename))) || $force) {
|
||||
@ -28,6 +37,13 @@ class Serialization
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize API class.
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return bool|API
|
||||
*/
|
||||
public static function deserialize($filename)
|
||||
{
|
||||
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
||||
|
Loading…
Reference in New Issue
Block a user