Skip to content

Commit

Permalink
Set CreatedAt and UpdatedAt based on filemtime
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed May 9, 2015
1 parent 839e1f5 commit 680357a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Service/PdoService.php
Expand Up @@ -182,13 +182,14 @@ public function upload(Space $space, $filekey, $filename)
}
// First delete any previous versions
$this->deleteFile($space, $filekey);
$stamp = filemtime($filename);

$data = file_get_contents($filename);
$hash = sha1($data);

$file = new File($filekey);
$file->setCreatedAt(time());
$file->setUpdatedAt(time());
$file->setCreatedAt($stamp);
$file->setUpdatedAt($stamp);
$file->setDataHash($hash);
$file->setSizeOriginal(strlen($data));
$file->setSizeStorage(strlen($data));
Expand Down

0 comments on commit 680357a

Please sign in to comment.