From e988abcdb130459c401149fa325497b4937a562e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 2 Jun 2019 08:19:41 -0500 Subject: [PATCH] SFTP: add callback parameter to get() --- phpseclib/Net/SFTP.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index a6216285..ae18df60 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2204,10 +2204,11 @@ class Net_SFTP extends Net_SSH2 * @param string $local_file * @param int $offset * @param int $length + * @param callable|null $progressCallback * @return mixed * @access public */ - function get($remote_file, $local_file = false, $offset = 0, $length = -1) + function get($remote_file, $local_file = false, $offset = 0, $length = -1, $progressCallback = null) { if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { return false; @@ -2273,6 +2274,9 @@ class Net_SFTP extends Net_SSH2 } $packet = null; $read+= $packet_size; + if (is_callable($progressCallback)) { + call_user_func($progressCallback, $read); + } $i++; }