mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
use dir instead of allinfo where possible
This commit is contained in:
parent
fc9f0bd408
commit
4126ef2217
1 changed files with 14 additions and 1 deletions
|
|
@ -13,10 +13,10 @@ use Icewind\SMB\Exception\DependencyException;
|
||||||
use Icewind\SMB\Exception\FileInUseException;
|
use Icewind\SMB\Exception\FileInUseException;
|
||||||
use Icewind\SMB\Exception\InvalidTypeException;
|
use Icewind\SMB\Exception\InvalidTypeException;
|
||||||
use Icewind\SMB\Exception\NotFoundException;
|
use Icewind\SMB\Exception\NotFoundException;
|
||||||
|
use Icewind\SMB\IFileInfo;
|
||||||
use Icewind\SMB\INotifyHandler;
|
use Icewind\SMB\INotifyHandler;
|
||||||
use Icewind\SMB\IServer;
|
use Icewind\SMB\IServer;
|
||||||
use Icewind\SMB\ISystem;
|
use Icewind\SMB\ISystem;
|
||||||
use Icewind\SMB\TimeZoneProvider;
|
|
||||||
use Icewind\Streams\CallbackWrapper;
|
use Icewind\Streams\CallbackWrapper;
|
||||||
|
|
||||||
class Share extends AbstractShare {
|
class Share extends AbstractShare {
|
||||||
|
|
@ -154,6 +154,19 @@ class Share extends AbstractShare {
|
||||||
* @return \Icewind\SMB\IFileInfo
|
* @return \Icewind\SMB\IFileInfo
|
||||||
*/
|
*/
|
||||||
public function stat($path) {
|
public function stat($path) {
|
||||||
|
// some windows server setups don't seem to like the allinfo command
|
||||||
|
// use the dir command instead to get the file info where possible
|
||||||
|
if ($path !== "" && $path !== "/") {
|
||||||
|
$parent = dirname($path);
|
||||||
|
$dir = $this->dir($parent);
|
||||||
|
$file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) {
|
||||||
|
return $info->getPath() === $path;
|
||||||
|
}));
|
||||||
|
if ($file) {
|
||||||
|
return $file[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$escapedPath = $this->escapePath($path);
|
$escapedPath = $this->escapePath($path);
|
||||||
$output = $this->execute('allinfo ' . $escapedPath);
|
$output = $this->execute('allinfo ' . $escapedPath);
|
||||||
// Windows and non Windows Fileserver may respond different
|
// Windows and non Windows Fileserver may respond different
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue