mirror of
https://github.com/danog/tgseclib.git
synced 2025-01-22 05:51:20 +01:00
SFTP: stat cache fixes
This commit is contained in:
parent
41ae2fb130
commit
a84861bb52
@ -1061,11 +1061,12 @@ class Net_SFTP extends Net_SSH2
|
|||||||
$dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path));
|
$dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path));
|
||||||
|
|
||||||
$temp = &$this->stat_cache;
|
$temp = &$this->stat_cache;
|
||||||
foreach ($dirs as $dir) {
|
$max = count($dirs) - 1;
|
||||||
|
foreach ($dirs as $i=>$dir) {
|
||||||
if (!isset($temp[$dir])) {
|
if (!isset($temp[$dir])) {
|
||||||
$temp[$dir] = array();
|
$temp[$dir] = array();
|
||||||
}
|
}
|
||||||
if ($dir == end($dirs)) {
|
if ($i === $max) {
|
||||||
$temp[$dir] = $value;
|
$temp[$dir] = $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1085,8 +1086,9 @@ class Net_SFTP extends Net_SSH2
|
|||||||
$dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path));
|
$dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path));
|
||||||
|
|
||||||
$temp = &$this->stat_cache;
|
$temp = &$this->stat_cache;
|
||||||
foreach ($dirs as $dir) {
|
$max = count($dirs) - 1;
|
||||||
if ($dir == end($dirs)) {
|
foreach ($dirs as $i=>$dir) {
|
||||||
|
if ($i === $max) {
|
||||||
unset($temp[$dir]);
|
unset($temp[$dir]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2206,7 +2208,7 @@ class Net_SFTP extends Net_SSH2
|
|||||||
$result = $this->_query_stat_cache($path);
|
$result = $this->_query_stat_cache($path);
|
||||||
|
|
||||||
if (isset($result)) {
|
if (isset($result)) {
|
||||||
// return true if $result is an array or if it's int(1)
|
// return true if $result is an array or if it's an stdClass object
|
||||||
return $result !== false;
|
return $result !== false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user