This commit is contained in:
Daniil Gentili 2017-07-27 18:03:57 +02:00
parent 5e549b92e7
commit 99bee52238
2 changed files with 5 additions and 5 deletions

View File

@ -44,7 +44,7 @@ class MTProto extends \Volatile
use \danog\MadelineProto\Wrappers\DialogHandler;
use \danog\MadelineProto\Wrappers\Login;
const V = 65;
const V = 66;
const NOT_LOGGED_IN = 0;
const WAITING_CODE = 1;

View File

@ -28,14 +28,14 @@ class Serialization
*/
public static function serialize($filename, $instance, $force = false)
{
if (!file_exists($lock = '.'.$filename.'.lock')) {
if (!file_exists($lock = $filename.'.lock')) {
touch($lock);
clearstatcache();
}
$lock = fopen($lock, 'r');
flock($lock, LOCK_EX);
$wrote = file_put_contents('.'.$filename, \danog\Serialization::serialize($instance, true));
rename('.'.$filename, $filename);
$wrote = file_put_contents($filename.'.temp.session', \danog\Serialization::serialize($instance, true));
rename($filename.'.temp.session', $filename);
flock($lock, LOCK_UN);
fclose($lock);
@ -55,7 +55,7 @@ class Serialization
{
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
if (file_exists($filename)) {
if (!file_exists($lock = '.'.$filename.'.lock')) {
if (!file_exists($lock = $filename.'.lock')) {
touch($lock);
clearstatcache();
}