mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
Merge branch 'master-callback'
This commit is contained in:
commit
e71f203742
@ -2083,11 +2083,12 @@ class SFTP extends SSH2
|
|||||||
* @param string|bool|resource $local_file
|
* @param string|bool|resource $local_file
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @param int $length
|
* @param int $length
|
||||||
|
* @param callable|null $progressCallback
|
||||||
* @throws \UnexpectedValueException on receipt of unexpected packets
|
* @throws \UnexpectedValueException on receipt of unexpected packets
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function get($remote_file, $local_file = false, $offset = 0, $length = -1)
|
public function get($remote_file, $local_file = false, $offset = 0, $length = -1, $progressCallback = null)
|
||||||
{
|
{
|
||||||
if (!($this->bitmap & SSH2::MASK_LOGIN)) {
|
if (!($this->bitmap & SSH2::MASK_LOGIN)) {
|
||||||
return false;
|
return false;
|
||||||
@ -2153,6 +2154,9 @@ class SFTP extends 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