lib/CrashTest/Storage/FileSystem.pm
changeset 24 b69b7aa98a1d
parent 19 300b902b5461
child 29 006e82a1bcd0
--- a/lib/CrashTest/Storage/FileSystem.pm	Wed Jul 30 23:49:59 2014 +0200
+++ b/lib/CrashTest/Storage/FileSystem.pm	Sat Aug 02 23:46:30 2014 +0200
@@ -12,9 +12,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package CrashTest::Storage::FileSystem;
-
-use strict;
-use warnings;
+use Mojo::Base -strict;
+use DateTime;
 
 sub new {
     my ($class, $config) = @_;
@@ -27,7 +26,8 @@
 sub index {
     my ($self) = @_;
     my @files;
-    opendir my ($dh), $self->{data_path} or die $!;
+    my $dh;
+    opendir($dh, $self->{data_path}) or die $!;
     my @allfiles = readdir $dh;
     foreach(@allfiles)
     {
@@ -35,11 +35,12 @@
         {
             my $filename = File::Spec->catfile($self->{data_path}, $_);
             push @files, {
-                file => $filename,
-                uuid => $1,
-                signature => $1,
-                product => "",
-                date => (stat $filename)[9],
+                file        => $filename,
+                uuid        => $1,
+                product     => "",
+                version     => "",
+                user        => "",
+                date        => DateTime->from_epoch(epoch => ((stat $filename)[9])),
             };
         }
     }
@@ -73,6 +74,9 @@
     open JSON, '>', File::Spec->catfile($self->{data_path}, "$uuid.json") or die $!;
     print JSON $j;
     close JSON;
+    utime $pjson->{client_info}->{CrashTime}, $pjson->{client_info}->{CrashTime}, File::Spec->catfile($self->{data_path}, "$uuid.json");
+    utime $pjson->{client_info}->{CrashTime}, $pjson->{client_info}->{CrashTime}, File::Spec->catfile($self->{data_path}, "$uuid.dmp");
+
 }
 
 sub store_dump {