From bc40bd65f99c817cf4b72f743653d6cb31ace895 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 17 Jan 2017 16:44:29 +0100 Subject: [PATCH] CLEARSTATCACHE PLS NOW --- src/danog/MadelineProto/Wrappers/FilesHandler.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/danog/MadelineProto/Wrappers/FilesHandler.php b/src/danog/MadelineProto/Wrappers/FilesHandler.php index 77fc1746..00529c95 100644 --- a/src/danog/MadelineProto/Wrappers/FilesHandler.php +++ b/src/danog/MadelineProto/Wrappers/FilesHandler.php @@ -526,15 +526,15 @@ trait FilesHandler public function download_to_file($message_media, $file, $cb = null) { $file = str_replace('//', '/', $file); - $stream = fopen($file, 'wb'); $info = $this->get_download_info($message_media); + $stream = fopen($file, 'wb'); $this->download_to_stream($info, $stream, $cb, filesize($file), $info['size']); fclose($stream); - + clearstatcache(); return $file; } - public function download_to_stream($message_media, $stream, $cb = null, $offset = 0, $end = -1) + public function download_to_stream($message_media, &$stream, $cb = null, $offset = 0, $end = -1) { if ($cb === null) { $cb = function ($percent) { @@ -555,7 +555,6 @@ trait FilesHandler $real_part_size = ($offset + $part_size > $end) ? $part_size - (($offset + $part_size) - $end) : $part_size; \danog\MadelineProto\Logger::log($real_part_size, $offset); $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);