From: Dylan William Hardison Date: Sat, 22 Jun 2019 02:55:33 +0000 (-0400) Subject: Bug 1559147 - Add option to report ping to only send results since a particular timestamp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=338ccb063b499061257be5e6681a12f6ac444819;p=thirdparty%2Fbugzilla.git Bug 1559147 - Add option to report ping to only send results since a particular timestamp --- diff --git a/Bugzilla/App/Command/report_ping.pm b/Bugzilla/App/Command/report_ping.pm index d61df7b32..48485439d 100644 --- a/Bugzilla/App/Command/report_ping.pm +++ b/Bugzilla/App/Command/report_ping.pm @@ -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. diff --git a/Bugzilla/Report/Ping.pm b/Bugzilla/Report/Ping.pm index e3460ffa4..bdc6a40aa 100644 --- a/Bugzilla/Report/Ping.pm +++ b/Bugzilla/Report/Ping.pm @@ -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, diff --git a/Bugzilla/Report/Ping/Simple.pm b/Bugzilla/Report/Ping/Simple.pm index 6e47a0afa..c43071276 100644 --- a/Bugzilla/Report/Ping/Simple.pm +++ b/Bugzilla/Report/Ping/Simple.pm @@ -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); }