adjust modified dates to the correct timezone

This commit is contained in:
Robin Appelman 2013-09-08 14:31:26 +02:00
commit f8bc64f097
4 changed files with 33 additions and 2 deletions

View file

@ -130,4 +130,12 @@ class Server {
return new Share($this, $name);
}
}
/**
* @return string
*/
public function getTimeZone() {
$command = 'net time zone -S ' . escapeshellarg($this->getHost());
return exec($command);
}
}

View file

@ -24,6 +24,8 @@ class Share {
*/
private $connection;
private $serverTimezone;
/**
* @param Server $server
* @param string $name
@ -58,6 +60,13 @@ class Share {
return $this->parseOutput($output);
}
private function getServerTimeZone() {
if (!$this->serverTimezone) {
$this->serverTimezone = $this->server->getTimeZone();
}
return $this->serverTimezone;
}
/**
* List the content of a remote folder
*
@ -84,7 +93,7 @@ class Share {
$content[$name] = array(
'size' => intval(trim($size)),
'type' => (strpos($type, 'D') !== false) ? 'dir' : 'file',
'time' => strtotime($time)
'time' => strtotime($time . ' ' . $this->getServerTimeZone())
);
}
}