r78079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78078‎ | r78079 | r78080 >
Date:17:35, 8 December 2010
Author:demon
Status:deferred (Comments)
Tags:
Comment:
(bug 25637) Make weekly report part of Bugzilla. Commit a basic framework for writing weekly reports in Bugzilla. Written for soon-to-be-released BZ 4.0. WeekAtAGlance.pm will come once I have it semi-working :)
Modified paths:
  • /trunk/tools/bugzilla-4.0 (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/Config.pm (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/Extension.pm (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/README.txt (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/lib (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/lib/Params.pm (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/lib/ReportBase.pm (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/sendReports.pl (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template/en (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template/en/default (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template/en/default/admin (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template/en/default/admin/params (added) (history)
  • /trunk/tools/bugzilla-4.0/extensions/template/en/default/admin/params/weeklyreporting.html.tmpl (added) (history)

Diff [purge]

Index: trunk/tools/bugzilla-4.0/extensions/Config.pm
@@ -0,0 +1,45 @@
 2+# -*- Mode: perl; indent-tabs-mode: nil -*-
 3+#
 4+# The contents of this file are subject to the Mozilla Public
 5+# License Version 1.1 (the "License"); you may not use this file
 6+# except in compliance with the License. You may obtain a copy of
 7+# the License at http://www.mozilla.org/MPL/
 8+#
 9+# Software distributed under the License is distributed on an "AS
 10+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 11+# implied. See the License for the specific language governing
 12+# rights and limitations under the License.
 13+#
 14+# The Original Code is the WeeklyReporting Bugzilla Extension.
 15+#
 16+# The Initial Developer of the Original Code is Chad Horohoe
 17+# Portions created by the Initial Developer are Copyright (C) 2010 the
 18+# Initial Developer. All Rights Reserved.
 19+#
 20+# Contributor(s):
 21+# Chad Horohoe <chad@anyonecanedit.org>
 22+
 23+package Bugzilla::Extension::WeeklyReporting;
 24+use strict;
 25+
 26+use constant NAME => 'WeeklyReporting';
 27+
 28+use constant REQUIRED_MODULES => [
 29+ {
 30+ package => 'DateTime',
 31+ module => 'DateTime',
 32+ },
 33+ {
 34+ package => 'Getopt-Long',
 35+ module => 'Getopt::Long',
 36+ },
 37+ {
 38+ package => 'Pod-Usage',
 39+ module => 'Pod::Usage',
 40+ }
 41+];
 42+
 43+use constant OPTIONAL_MODULES => [
 44+];
 45+
 46+__PACKAGE__->NAME;
Index: trunk/tools/bugzilla-4.0/extensions/sendReports.pl
@@ -0,0 +1,74 @@
 2+#!/usr/bin/perl -w
 3+#
 4+# The contents of this file are subject to the Mozilla Public
 5+# License Version 1.1 (the "License"); you may not use this file
 6+# except in compliance with the License. You may obtain a copy of
 7+# the License at http://www.mozilla.org/MPL/
 8+#
 9+# Software distributed under the License is distributed on an "AS
 10+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 11+# implied. See the License for the specific language governing
 12+# rights and limitations under the License.
 13+#
 14+# The Original Code is the VCS Bugzilla Extension.
 15+#
 16+# The Initial Developer of the Original Code is Red Hat, Inc.
 17+# Portions created by the Initial Developer are Copyright (C) 2010 the
 18+# Initial Developer. All Rights Reserved.
 19+#
 20+# Contributor(s):
 21+# Max Kanat-Alexander <mkanat@everythingsolved.com>
 22+
 23+use strict;
 24+use diagnostics;
 25+use warnings;
 26+use lib qw(lib);
 27+use Getopt::Long;
 28+use Pod::Usage qq/pod2usage/;
 29+use DateTime;
 30+use Bugzilla;
 31+
 32+BEGIN { Bugzilla->extensions }
 33+
 34+my %switch;
 35+my $end_date = DateTime->now;
 36+my $begin_date = $end_date->clone();
 37+$begin_date = $begin_date->subtract( days => 7 );
 38+
 39+GetOptions(\%switch, 'help|h|?', 'noemail' ) || die $@;
 40+
 41+if ( $switch{'help'} ) {
 42+ pod2usage({-exitval => 1});
 43+}
 44+
 45+foreach my $report ( Bugzilla::Extension::WeeklyReporting->get_report_list( $begin_date, $end_date ) ) {
 46+ if( $switch{'noemail'} ) {
 47+ $report->printReport();
 48+ } else {
 49+ $report->emailReport();
 50+ }
 51+}
 52+
 53+__END__
 54+
 55+=head1 NAME
 56+
 57+ sendReports.pl - Send reports scheduled for dispatch
 58+
 59+=head1 SYNOPSIS
 60+
 61+ sendReports.pl --noemail
 62+
 63+=head1 OPTIONS
 64+
 65+=over
 66+
 67+=item B<--noemail>
 68+
 69+Just print the report, rather than sending the e-mail
 70+
 71+=back
 72+
 73+=head1 DESCRIPTION
 74+
 75+This script can be used to send reports on Bugzilla activity
Index: trunk/tools/bugzilla-4.0/extensions/lib/ReportBase.pm
@@ -0,0 +1,49 @@
 2+# -*- Mode: perl; indent-tabs-mode: nil -*-
 3+#
 4+# The contents of this file are subject to the Mozilla Public
 5+# License Version 1.1 (the "License"); you may not use this file
 6+# except in compliance with the License. You may obtain a copy of
 7+# the License at http://www.mozilla.org/MPL/
 8+#
 9+# Software distributed under the License is distributed on an "AS
 10+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 11+# implied. See the License for the specific language governing
 12+# rights and limitations under the License.
 13+#
 14+# The Original Code is the WeeklyReporting Bugzilla Extension.
 15+#
 16+# The Initial Developer of the Original Code is Chad Horohoe
 17+# Portions created by the Initial Developer are Copyright (C) 2010 the
 18+# Initial Developer. All Rights Reserved.
 19+#
 20+# Contributor(s):
 21+# Chad Horohoe <chad@anyonecanedit.org>
 22+
 23+package Bugzilla::Extension::WeeklyReporting::ReportBase;
 24+use strict;
 25+use DateTime;
 26+use Bugzilla::Mailer;
 27+use Bugzilla::DB;
 28+
 29+sub new {
 30+ my($class, $begin, $end) = @_;
 31+ my $self = {
 32+ start => $begin,
 33+ stop => $end,
 34+ dbh => Bugzilla->dbh
 35+ };
 36+ bless($self, $class);
 37+ return $self;
 38+}
 39+
 40+sub emailReport {
 41+ MessageToMTA( get_report_text() );
 42+}
 43+
 44+sub printReport {
 45+ print get_report_text();
 46+}
 47+
 48+sub get_report_text { return "Test\n"; }
 49+
 50+1;
Index: trunk/tools/bugzilla-4.0/extensions/lib/Params.pm
@@ -0,0 +1,59 @@
 2+# -*- Mode: perl; indent-tabs-mode: nil -*-
 3+#
 4+# The contents of this file are subject to the Mozilla Public
 5+# License Version 1.1 (the "License"); you may not use this file
 6+# except in compliance with the License. You may obtain a copy of
 7+# the License at http://www.mozilla.org/MPL/
 8+#
 9+# Software distributed under the License is distributed on an "AS
 10+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 11+# implied. See the License for the specific language governing
 12+# rights and limitations under the License.
 13+#
 14+# The Original Code is the WeeklyReporting Bugzilla Extension.
 15+#
 16+# The Initial Developer of the Original Code is Chad Horohoe
 17+# Portions created by the Initial Developer are Copyright (C) 2010 the
 18+# Initial Developer. All Rights Reserved.
 19+#
 20+# Contributor(s):
 21+# Chad Horohoe <chad@anyonecanedit.org>
 22+
 23+package Bugzilla::Extension::WeeklyReporting::Params;
 24+use strict;
 25+
 26+use Bugzilla::Constants;
 27+use Bugzilla::Error;
 28+use Bugzilla::Util;
 29+
 30+use constant get_param_list => (
 31+ {
 32+ name => 'weeklyreporting_email',
 33+ type => 't',
 34+ default => '',
 35+ checker => \&_check_email_list,
 36+ }
 37+);
 38+
 39+# Validate the list of e-mail addresses
 40+sub _check_email_list {
 41+ my ($value) = @_;
 42+ foreach my $email (split ",", $value) {
 43+ $email = trim($email);
 44+ next if !$email;
 45+ if ( !validate_email_syntax($email) ) {
 46+ return "Invalid e-mail address";
 47+ }
 48+ my $error_mode = Bugzilla->error_mode;
 49+ Bugzilla->error_mode(ERROR_MODE_DIE);
 50+ my $success = eval {
 51+ trick_taint($email);
 52+ 1;
 53+ };
 54+ Bugzilla->error_mode($error_mode);
 55+ return $@ if !$success;
 56+ }
 57+ return "";
 58+}
 59+
 60+1;
Index: trunk/tools/bugzilla-4.0/extensions/Extension.pm
@@ -0,0 +1,45 @@
 2+# -*- Mode: perl; indent-tabs-mode: nil -*-
 3+#
 4+# The contents of this file are subject to the Mozilla Public
 5+# License Version 1.1 (the "License"); you may not use this file
 6+# except in compliance with the License. You may obtain a copy of
 7+# the License at http://www.mozilla.org/MPL/
 8+#
 9+# Software distributed under the License is distributed on an "AS
 10+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 11+# implied. See the License for the specific language governing
 12+# rights and limitations under the License.
 13+#
 14+# The Original Code is the WeeklyReporting Bugzilla Extension.
 15+#
 16+# The Initial Developer of the Original Code is Chad Horohoe
 17+# Portions created by the Initial Developer are Copyright (C) 2010 the
 18+# Initial Developer. All Rights Reserved.
 19+#
 20+# Contributor(s):
 21+# Chad Horohoe <chad@anyonecanedit.org>
 22+
 23+package Bugzilla::Extension::WeeklyReporting;
 24+use strict;
 25+use base qw(Bugzilla::Extension);
 26+
 27+our $VERSION = '0.1';
 28+
 29+sub config_add_panels {
 30+ my ($self, $args) = @_;
 31+ my $modules = $args->{'panel_modules'};
 32+ $modules->{'WeeklyReporting'} = 'Bugzilla::Extension::WeeklyReporting::Params';
 33+}
 34+
 35+# List of reports used below
 36+use Bugzilla::Extension::WeeklyReporting::WeekAtAGlance;
 37+
 38+# When adding a report module above, be sure to push it into the array below
 39+sub get_report_list {
 40+ my( $self, $begin, $end ) = @_;
 41+ my @reportList;
 42+# push @reportList, new Bugzilla::Extension::WeeklyReporting::WeekAtAGlance( $begin, $end );
 43+ return @reportList;
 44+}
 45+
 46+__PACKAGE__->NAME;
Index: trunk/tools/bugzilla-4.0/extensions/README.txt
@@ -0,0 +1,44 @@
 2+
 3+ WeeklyReporting, version 0.1
 4+
 5+ This Bugzilla extension provides a functionality to send weekly
 6+ reports to user(s) regarding the week's bug activity
 7+
 8+
 9+ WHAT YOU GET
 10+
 11+ After you set up everything as described below, you'll send weekly
 12+ status reports to the e-mail addresses specified.
 13+
 14+
 15+ OVERVIEW
 16+
 17+ This extension was created to replace the ad-hoc script used by
 18+ Wikimedia to generate weekly Bugzilla reports. Right now, the
 19+ original report is the only one. However, there could be more,
 20+ in theory.
 21+
 22+
 23+ INSTALLATION
 24+
 25+ Configuration of WeeklyReporting
 26+
 27+ - just store the module in the extension folder of your 3.6
 28+ Bugzilla installation. It will be activated automatically
 29+ and requires no further configuraiton.
 30+
 31+ Configuration of Bugzilla
 32+
 33+ - Use the Parameters interface or edit data/params directly to
 34+ set up the following values
 35+
 36+ # weeklyreporting_email - E-mail address (or more than one,
 37+ by comma-delimiting them
 38+
 39+ NOTES:
 40+ - Cannot currently configure reports to have different recipients
 41+
 42+
 43+Keywords: reporting, statistics
 44+
 45+
Property changes on: trunk/tools/bugzilla-4.0/extensions/README.txt
___________________________________________________________________
Added: svn:eol-style
146 + native
Index: trunk/tools/bugzilla-4.0/extensions/template/en/default/admin/params/weeklyreporting.html.tmpl
@@ -0,0 +1,33 @@
 2+[%# The contents of this file are subject to the Mozilla Public
 3+ # License Version 1.1 (the "License"); you may not use this file
 4+ # except in compliance with the License. You may obtain a copy of
 5+ # the License at http://www.mozilla.org/MPL/
 6+ #
 7+ # Software distributed under the License is distributed on an "AS
 8+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 9+ # implied. See the License for the specific language governing
 10+ # rights and limitations under the License.
 11+ #
 12+ # The Original Code is the WeeklyReporting Bugzilla Extension.
 13+ #
 14+ # The Initial Developer of the Original Code is Chad Horohoe
 15+ # Portions created by the Initial Developer are Copyright (C) 2010 the
 16+ # Initial Developer. All Rights Reserved.
 17+ #
 18+ # Contributor(s):
 19+ # Chad Horohoe <chad@anyonecanedit.org>#%]
 20+ #%]
 21+[%
 22+ title = "Weekly Reporting"
 23+ desc = "Manage weekly reporting configuration"
 24+%]
 25+
 26+[% weeklyreporting_weekataglanceemail = BLOCK %]
 27+
 28+ <p>List of comma-delimited e-mail addresses to send the Week-At-A-Glance reports to</p>
 29+
 30+[% END %]
 31+
 32+[% param_descs = {
 33+ "weeklyreporting_weekataglanceemail" => weeklyreporting_weekataglanceemail,
 34+} %]
Property changes on: trunk/tools/bugzilla-4.0/extensions/template/en/default/admin/params/weeklyreporting.html.tmpl
___________________________________________________________________
Added: svn:executable
135 + *

Follow-up revisions

RevisionCommit summaryAuthorDate
r84691Added weekly report mentioned in bug 25637#c3pdhanda18:33, 24 March 2011
r84692Added link to weekly report mentioned in bug 25637#c3pdhanda18:35, 24 March 2011

Comments

#Comment by Platonides (talk | contribs)   23:00, 8 December 2010

svn:eol-style missing from all but README.txt

Does weeklyreporting.html.tmpl really need the execute flag?

#Comment by 😂 (talk | contribs)   02:14, 9 December 2010

eol-style was fixed in subsequent commit.

And no, the execute flag was unintentional.

Status & tagging log