Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13] prefer using dir instead of allinfo for getting smb file info #10804

Merged
merged 3 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/files_external/3rdparty/icewind/smb/src/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ public function dir($path) {
* @return \Icewind\SMB\IFileInfo
*/
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);
$output = $this->execute('allinfo ' . $escapedPath);
// Windows and non Windows Fileserver may respond different
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ public function __construct($host, System $system) {
public function get() {
if (!$this->timeZone) {
$net = $this->system->getNetPath();
if ($net) {
// for local domain names we can assume same timezone
if ($net && strpos($this->host, '.') !== false) {
$command = sprintf('%s time zone -S %s',
$net,
escapeshellarg($this->host)
);
$this->timeZone = exec($command);
} else { // fallback to server timezone
}

if (!$this->timeZone) {
// fallback to server timezone
$this->timeZone = date_default_timezone_get();
}
}
Expand Down