Fix missing argument to create
authorVincent Tondellier <tonton+hg@team1664.org>
Sun, 14 Feb 2016 19:35:51 +0100
changeset 91 10a62da240f4
parent 90 6f091abdf5fb
child 92 702e246e5c9f
Fix missing argument to create
lib/CrashTest/Model/CrashReport.pm
lib/CrashTest/Plugin/Storage/File.pm
--- a/lib/CrashTest/Model/CrashReport.pm	Wed Dec 30 19:57:32 2015 +0100
+++ b/lib/CrashTest/Model/CrashReport.pm	Sun Feb 14 19:35:51 2016 +0100
@@ -23,9 +23,15 @@
 }
 
 sub create {
-    my ($self, $uuid, $pjson, $dump) = @_;
+    my ($self, $uuid, $pjson, $client_info, $dump) = @_;
+
+    return $self->app->storage->each("CrashReport::create", $uuid, $pjson, $client_info, $dump);
+}
 
-    return $self->app->storage->each("CrashReport::create", $uuid, $pjson, $dump);
+sub update {
+    my ($self, $uuid, $pjson, $client_info, $dump) = @_;
+
+    return $self->app->storage->each("CrashReport::update", $uuid, $pjson, $client_info, $dump);
 }
 
 sub get_processed_data {
--- a/lib/CrashTest/Plugin/Storage/File.pm	Wed Dec 30 19:57:32 2015 +0100
+++ b/lib/CrashTest/Plugin/Storage/File.pm	Sun Feb 14 19:35:51 2016 +0100
@@ -36,7 +36,8 @@
 package CrashTest::Plugin::Storage::File::Model::CrashReport;
 use Mojo::Base -base;
 use Mojo::Util qw/slurp spurt/;
-use Mojo::JSON qw/j decode_json/;
+use Mojo::JSON::MaybeXS;
+use Mojo::JSON qw/encode_json decode_json/;
 use File::Spec;
 
 has [ qw/instance app config extra_columns data_path/ ];
@@ -50,9 +51,9 @@
 }
 
 sub create {
-    my ($self, $uuid, $pjson, $client_info, $dump) = @_;
+    my ($self, $uuid, $pjson, $client_info, $dmp_file) = @_;
 
-    $self->_store_dump($uuid, $dump);
+    $self->_store_dump($uuid, slurp($dmp_file));
     $self->_store_processed_data($uuid, $pjson, $client_info);
 }
 
@@ -76,7 +77,7 @@
     my $jsonfilename = File::Spec->catfile($self->data_path, "$uuid.json");
     my $dmpfilename = File::Spec->catfile($self->data_path, "$uuid.dmp");
 
-    spurt(j($pjson), $jsonfilename) or die $!;
+    spurt(encode_json($pjson), $jsonfilename) or die $!;
 
     # Set time of the .dmp to the CrashTime
     my $crashtime = $pjson->{client_info}->{CrashTime};