Merge branch '2.0' into 3.0

This commit is contained in:
terrafrost 2020-02-25 00:00:25 -06:00
commit 8c8e805c73
1 changed files with 41 additions and 7 deletions

View File

@ -1568,6 +1568,13 @@ class SFTP extends SSH2
}
$i++;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
}
}
@ -1577,8 +1584,11 @@ class SFTP extends SSH2
$i++;
if (!$this->read_put_responses($i)) {
return false;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
return true;
@ -1940,7 +1950,7 @@ class SFTP extends SSH2
$subtemp = $offset + $sent;
$packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp);
if (!$this->send_sftp_packet(NET_SFTP_WRITE, $packet, $i)) {
if (!$this->send_sftp_packet(NET_SFTP_WRITE, $packet)) {
if ($mode & self::SOURCE_LOCAL_FILE) {
fclose($fp);
}
@ -1952,6 +1962,14 @@ class SFTP extends SSH2
}
$i++;
if ($i == NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
$i = 0;
break;
}
$i = 0;
}
}
if (!$this->read_put_responses($i)) {
@ -2236,7 +2254,10 @@ class SFTP extends SSH2
return false;
}
return $this->delete_recursive($path);
$i = 0;
$result = $this->delete_recursive($path, $i);
$this->read_put_responses($i);
return $result;
}
$this->remove_from_stat_cache($path);
@ -2254,8 +2275,11 @@ class SFTP extends SSH2
* @return bool
* @access private
*/
private function delete_recursive($path)
private function delete_recursive($path, &$i)
{
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
$entries = $this->readlist($path, true);
@ -2283,6 +2307,13 @@ class SFTP extends SSH2
$this->remove_from_stat_cache($temp);
$i++;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
}
}
@ -2293,8 +2324,11 @@ class SFTP extends SSH2
$i++;
if (!$this->read_put_responses($i)) {
return false;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
return true;