mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
Merge branch 'master' of https://github.com/phpseclib/phpseclib
This commit is contained in:
commit
300a3afe8d
@ -161,10 +161,11 @@ class Net_SCP {
|
|||||||
* @param String $remote_file
|
* @param String $remote_file
|
||||||
* @param String $data
|
* @param String $data
|
||||||
* @param optional Integer $mode
|
* @param optional Integer $mode
|
||||||
|
* @param optional Callable $callback
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function put($remote_file, $data, $mode = NET_SCP_STRING)
|
function put($remote_file, $data, $mode = NET_SCP_STRING, $callback = null)
|
||||||
{
|
{
|
||||||
if (!isset($this->ssh)) {
|
if (!isset($this->ssh)) {
|
||||||
return false;
|
return false;
|
||||||
@ -213,6 +214,10 @@ class Net_SCP {
|
|||||||
$temp = $mode & NET_SCP_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size);
|
$temp = $mode & NET_SCP_STRING ? substr($data, $sent, $this->packet_size) : fread($fp, $this->packet_size);
|
||||||
$this->_send($temp);
|
$this->_send($temp);
|
||||||
$sent+= strlen($temp);
|
$sent+= strlen($temp);
|
||||||
|
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($sent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->_close();
|
$this->_close();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class Net_SFTP_Stream {
|
|||||||
if ($host[0] == '$') {
|
if ($host[0] == '$') {
|
||||||
$host = substr($host, 1);
|
$host = substr($host, 1);
|
||||||
global $$host;
|
global $$host;
|
||||||
if (!is_object($$host) || get_class($$host) != 'Net_sFTP') {
|
if (!is_object($$host) || get_class($$host) != 'Net_SFTP') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->sftp = $$host;
|
$this->sftp = $$host;
|
||||||
|
Loading…
Reference in New Issue
Block a user