]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1559147 - Add option to report ping to only send results since a particular timestamp
authorDylan William Hardison <dylan@hardison.net>
Sat, 22 Jun 2019 02:55:33 +0000 (22:55 -0400)
committerGitHub <noreply@github.com>
Sat, 22 Jun 2019 02:55:33 +0000 (22:55 -0400)
Bugzilla/App/Command/report_ping.pm
Bugzilla/Report/Ping.pm
Bugzilla/Report/Ping/Simple.pm

index d61df7b32e9eaaa7872a73a15adf5c440bca4f33..48485439dbd0872dfc38e4088eec8cb096b73dc7 100644 (file)
@@ -26,13 +26,14 @@ sub run {
     = JSON::MaybeXS->new(convert_blessed => 1, canonical => 1, pretty => 1);
   my $class       = 'Simple';
   my $working_dir = cwd();
-  my ($namespace, $doctype, $page, $rows, $base_url, $test, $dump_schema, $dump_documents);
+  my ($namespace, $doctype, $page, $rows, $base_url, $test, $dump_schema, $dump_documents, $since);
 
   Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
   getopt \@args,
     'base-url|u=s'   => \$base_url,
     'page|p=i'       => \$page,
     'rows|r=i'       => \$rows,
+    'since=s'        => \$since,
     'dump-schema'    => \$dump_schema,
     'dump-documents' => \$dump_documents,
     'class|c=s'      => \$class,
@@ -64,6 +65,7 @@ sub run {
     maybe page      => $page,
     maybe namespace => $namespace,
     maybe doctype   => $doctype,
+    maybe since     => $since,
   );
 
   if ($dump_schema) {
@@ -141,6 +143,7 @@ Bugzilla::App::Command::report_ping - descriptionsend a report ping to a url';
     -u, --base-url           URL to send the json documents to.
     -r, --rows num           (Optional) Number of requests to send at once. Default: 10.
     -p, --page num           (Optional) Page to start on. Default: 1
+    --since str              (Optional) Typically the date of the last run.
     --class word             (Optional) Report class to use. Default: Simple
     --test                   Validate the json documents against the json schema.
     --dump-schema            Print the json schema.
index e3460ffa4d978afac7d15f8004e413158b7458a7..bdc6a40aa1d0954b4979e50e71d8e985bb6f850d 100644 (file)
@@ -33,6 +33,8 @@ has 'page' => (is => 'ro', isa => Int, default => 1);
 
 has 'rows' => (is => 'ro', default => 10);
 
+has 'since' => (is => 'ro', predicate => 1);
+
 has 'user_agent' => (
   is       => 'lazy',
   init_arg => undef,
index 6e47a0afa31523768b8c4eb36455436dcd2cea3f..c430712761b40c0e6cc98b0b35ccf87ead9fb275 100644 (file)
@@ -60,6 +60,10 @@ sub _build_resultset {
   my $options = {
     order_by => 'me.bug_id',
   };
+
+  if ($self->has_since) {
+    $query->{'me.delta_ts'} = { '>' => $self->since };
+  }
   return $bugs->search($query, $options);
 }