Enforce UTC on all datetime instances, set lock release date to datetime always, refs #923
parent
18973ed0b9
commit
326fcbcab7
|
@ -76,7 +76,7 @@ class ValidatingArrayLoader implements LoaderInterface
|
||||||
$this->validateString('time');
|
$this->validateString('time');
|
||||||
if (!empty($this->config['time'])) {
|
if (!empty($this->config['time'])) {
|
||||||
try {
|
try {
|
||||||
$date = new \DateTime($this->config['time']);
|
$date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
|
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
|
||||||
unset($this->config['time']);
|
unset($this->config['time']);
|
||||||
|
|
|
@ -292,7 +292,8 @@ class Locker
|
||||||
$sourceRef = $package->getSourceReference() ?: $package->getDistReference();
|
$sourceRef = $package->getSourceReference() ?: $package->getDistReference();
|
||||||
$process = new ProcessExecutor();
|
$process = new ProcessExecutor();
|
||||||
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path)) {
|
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path)) {
|
||||||
$spec['time'] = trim($output);
|
$datetime = new \DateTime('@'.$output, new \DateTimeZone('UTC'));
|
||||||
|
$spec['time'] = $datetime->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class GitDriver extends VcsDriver
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$this->process->execute(sprintf('git log -1 --format=%%at %s', escapeshellarg($identifier)), $output, $this->repoDir);
|
$this->process->execute(sprintf('git log -1 --format=%%at %s', escapeshellarg($identifier)), $output, $this->repoDir);
|
||||||
$date = new \DateTime('@'.trim($output));
|
$date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
|
||||||
$composer['time'] = $date->format('Y-m-d H:i:s');
|
$composer['time'] = $date->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
$this->infoCache[$identifier] = $composer;
|
$this->infoCache[$identifier] = $composer;
|
||||||
|
|
|
@ -127,7 +127,7 @@ class HgDriver extends VcsDriver
|
||||||
|
|
||||||
if (!isset($composer['time'])) {
|
if (!isset($composer['time'])) {
|
||||||
$this->process->execute(sprintf('hg log --template "{date|rfc822date}" -r %s', escapeshellarg($identifier)), $output, $this->repoDir);
|
$this->process->execute(sprintf('hg log --template "{date|rfc822date}" -r %s', escapeshellarg($identifier)), $output, $this->repoDir);
|
||||||
$date = new \DateTime(trim($output));
|
$date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
|
||||||
$composer['time'] = $date->format('Y-m-d H:i:s');
|
$composer['time'] = $date->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
$this->infoCache[$identifier] = $composer;
|
$this->infoCache[$identifier] = $composer;
|
||||||
|
|
|
@ -138,7 +138,7 @@ class SvnDriver extends VcsDriver
|
||||||
$output = $this->execute('svn info', $this->baseUrl . $path . $rev);
|
$output = $this->execute('svn info', $this->baseUrl . $path . $rev);
|
||||||
foreach ($this->process->splitLines($output) as $line) {
|
foreach ($this->process->splitLines($output) as $line) {
|
||||||
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
|
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
|
||||||
$date = new \DateTime($match[1]);
|
$date = new \DateTime($match[1], new \DateTimeZone('UTC'));
|
||||||
$composer['time'] = $date->format('Y-m-d H:i:s');
|
$composer['time'] = $date->format('Y-m-d H:i:s');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue