mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 03:16:02 +00:00
SFTP: add stream to get method
This commit is contained in:
parent
40b67bf939
commit
9547587cb7
@ -2278,7 +2278,7 @@ class Net_SFTP extends Net_SSH2
|
||||
$res_offset = $stat['size'];
|
||||
} else {
|
||||
$res_offset = 0;
|
||||
if ($local_file !== false) {
|
||||
if ($local_file !== false && !is_callable($local_file) ) {
|
||||
$fp = fopen($local_file, 'wb');
|
||||
if (!$fp) {
|
||||
return false;
|
||||
@ -2288,7 +2288,7 @@ class Net_SFTP extends Net_SSH2
|
||||
}
|
||||
}
|
||||
|
||||
$fclose_check = $local_file !== false && !is_resource($local_file);
|
||||
$fclose_check = $local_file !== false && !is_callable($local_file) && !is_resource($local_file);
|
||||
|
||||
$start = $offset;
|
||||
$read = 0;
|
||||
@ -2335,6 +2335,8 @@ class Net_SFTP extends Net_SSH2
|
||||
$offset+= strlen($temp);
|
||||
if ($local_file === false) {
|
||||
$content.= $temp;
|
||||
} elseif (is_callable($local_file)) {
|
||||
$local_file($temp);
|
||||
} else {
|
||||
fputs($fp, $temp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user