diff options
Diffstat (limited to 'apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php')
-rw-r--r-- | apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php index 22406a4f956..86d7859a6f7 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php +++ b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php @@ -19,16 +19,31 @@ class TimeZoneProvider { private $timeZone; /** + * @var System + */ + private $system; + + /** * @param string $host + * @param System $system */ - function __construct($host) { + function __construct($host, System $system) { $this->host = $host; + $this->system = $system; } public function get() { if (!$this->timeZone) { - $command = 'net time zone -S ' . escapeshellarg($this->host); - $this->timeZone = exec($command); + $net = $this->system->getNetPath(); + if ($net) { + $command = sprintf('%s time zone -S %s', + $net, + escapeshellarg($this->host) + ); + $this->timeZone = exec($command); + } else { // fallback to server timezone + $this->timeZone = date_default_timezone_get(); + } } return $this->timeZone; } |