fix
This commit is contained in:
parent
5e549b92e7
commit
99bee52238
|
@ -44,7 +44,7 @@ class MTProto extends \Volatile
|
||||||
use \danog\MadelineProto\Wrappers\DialogHandler;
|
use \danog\MadelineProto\Wrappers\DialogHandler;
|
||||||
use \danog\MadelineProto\Wrappers\Login;
|
use \danog\MadelineProto\Wrappers\Login;
|
||||||
|
|
||||||
const V = 65;
|
const V = 66;
|
||||||
|
|
||||||
const NOT_LOGGED_IN = 0;
|
const NOT_LOGGED_IN = 0;
|
||||||
const WAITING_CODE = 1;
|
const WAITING_CODE = 1;
|
||||||
|
|
|
@ -28,14 +28,14 @@ class Serialization
|
||||||
*/
|
*/
|
||||||
public static function serialize($filename, $instance, $force = false)
|
public static function serialize($filename, $instance, $force = false)
|
||||||
{
|
{
|
||||||
if (!file_exists($lock = '.'.$filename.'.lock')) {
|
if (!file_exists($lock = $filename.'.lock')) {
|
||||||
touch($lock);
|
touch($lock);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
}
|
}
|
||||||
$lock = fopen($lock, 'r');
|
$lock = fopen($lock, 'r');
|
||||||
flock($lock, LOCK_EX);
|
flock($lock, LOCK_EX);
|
||||||
$wrote = file_put_contents('.'.$filename, \danog\Serialization::serialize($instance, true));
|
$wrote = file_put_contents($filename.'.temp.session', \danog\Serialization::serialize($instance, true));
|
||||||
rename('.'.$filename, $filename);
|
rename($filename.'.temp.session', $filename);
|
||||||
flock($lock, LOCK_UN);
|
flock($lock, LOCK_UN);
|
||||||
fclose($lock);
|
fclose($lock);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class Serialization
|
||||||
{
|
{
|
||||||
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
if (!file_exists($lock = '.'.$filename.'.lock')) {
|
if (!file_exists($lock = $filename.'.lock')) {
|
||||||
touch($lock);
|
touch($lock);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user