mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Wait with getting the timezone from the server until we need it
This commit is contained in:
parent
ededbfbaa3
commit
476980d4ce
5 changed files with 72 additions and 15 deletions
35
src/TimeZoneProvider.php
Normal file
35
src/TimeZoneProvider.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
|
||||
* This file is licensed under the Licensed under the MIT license:
|
||||
* http://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
class TimeZoneProvider {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $host;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $timeZone;
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
*/
|
||||
function __construct($host) {
|
||||
$this->host = $host;
|
||||
}
|
||||
|
||||
public function get() {
|
||||
if (!$this->timeZone) {
|
||||
$command = 'net time zone -S ' . escapeshellarg($this->host);
|
||||
$this->timeZone = exec($command);
|
||||
}
|
||||
return $this->timeZone;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue