1
0
Fork 0

Enforce UTC on all datetime instances, set lock release date to datetime always, refs #923

pull/1349/merge
Jordi Boggiano 2012-11-20 14:36:33 +01:00
parent 18973ed0b9
commit 326fcbcab7
5 changed files with 6 additions and 5 deletions

View File

@ -76,7 +76,7 @@ class ValidatingArrayLoader implements LoaderInterface
$this->validateString('time');
if (!empty($this->config['time'])) {
try {
$date = new \DateTime($this->config['time']);
$date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
} catch (\Exception $e) {
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
unset($this->config['time']);

View File

@ -292,7 +292,8 @@ class Locker
$sourceRef = $package->getSourceReference() ?: $package->getDistReference();
$process = new ProcessExecutor();
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');
}
}
}

View File

@ -140,7 +140,7 @@ class GitDriver extends VcsDriver
if (!isset($composer['time'])) {
$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');
}
$this->infoCache[$identifier] = $composer;

View File

@ -127,7 +127,7 @@ class HgDriver extends VcsDriver
if (!isset($composer['time'])) {
$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');
}
$this->infoCache[$identifier] = $composer;

View File

@ -138,7 +138,7 @@ class SvnDriver extends VcsDriver
$output = $this->execute('svn info', $this->baseUrl . $path . $rev);
foreach ($this->process->splitLines($output) as $line) {
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');
break;
}