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