mirror of
https://github.com/danog/tgseclib.git
synced 2024-11-26 20:24:39 +01:00
SFTP: add callback parameter to get()
This commit is contained in:
parent
8df35cc368
commit
e988abcdb1
@ -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++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user