mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-05 04:57:53 +00: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 string $local_file
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @param int $length
|
* @param int $length
|
||||||
|
* @param callable|null $progressCallback
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @access public
|
* @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)) {
|
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||||
return false;
|
return false;
|
||||||
@ -2273,6 +2274,9 @@ class Net_SFTP extends Net_SSH2
|
|||||||
}
|
}
|
||||||
$packet = null;
|
$packet = null;
|
||||||
$read+= $packet_size;
|
$read+= $packet_size;
|
||||||
|
if (is_callable($progressCallback)) {
|
||||||
|
call_user_func($progressCallback, $read);
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user