From e5582beb8710c2c6221591997e14107a0a1c2ea1 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 27 Dec 2018 17:16:49 +0100 Subject: [PATCH] Logging bugfix --- docs | 2 +- src/danog/MadelineProto/MTProtoTools/Files.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs b/docs index 0fcff8e5..82b301b0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0fcff8e5a31af300511949c4dbafc7be6c0d4dd7 +Subproject commit 82b301b00560298776ce9ca852e8db71ac21b2e9 diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php index d2761de5..7bba7b4e 100644 --- a/src/danog/MadelineProto/MTProtoTools/Files.php +++ b/src/danog/MadelineProto/MTProtoTools/Files.php @@ -39,6 +39,9 @@ trait Files $cb = $file; $file = $file->getFile(); } + + $t = microtime(true); + $file = \danog\MadelineProto\Absolute::absolute($file); if (!file_exists($file)) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['file_not_exist']); @@ -127,17 +130,16 @@ trait Files } fclose($f); + clearstatcache(); + + $this->logger->logger('Speed: '.((filesize($file) * 8) / (microtime(true) - $t) / 1000000)); return $constructor; } public function upload($file, $file_name = '', $cb = null, $encrypted = false, $datacenter = null) { - $t = microtime(true); - $res = $this->wait(call([$this, 'upload_async'], $file, $file_name, $cb, $encrypted, $datacenter)); - $this->logger->logger('Speed: '.((filesize($file) * 8) / (microtime(true) - $t) / 1000000)); - - return $res; + return $this->wait(call([$this, 'upload_async'], $file, $file_name, $cb, $encrypted, $datacenter)); } public function upload_encrypted($file, $file_name = '', $cb = null)