From 02bb1602d26f4712a1dfe57e86ecdb728c607241 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 27 Feb 2014 23:18:21 +0800 Subject: remove unused RequestWhiner extension --- extensions/RequestWhiner/Config.pm | 33 ----- extensions/RequestWhiner/Extension.pm | 43 ------ extensions/RequestWhiner/bin/whineatrequests.pl | 155 --------------------- extensions/RequestWhiner/disabled | 0 extensions/RequestWhiner/lib/Constants.pm | 31 ----- .../en/default/requestwhiner/header.txt.tmpl | 6 - .../en/default/requestwhiner/mail.html.tmpl | 62 --------- .../en/default/requestwhiner/mail.txt.tmpl | 41 ------ 8 files changed, 371 deletions(-) delete mode 100644 extensions/RequestWhiner/Config.pm delete mode 100644 extensions/RequestWhiner/Extension.pm delete mode 100755 extensions/RequestWhiner/bin/whineatrequests.pl delete mode 100644 extensions/RequestWhiner/disabled delete mode 100644 extensions/RequestWhiner/lib/Constants.pm delete mode 100644 extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl delete mode 100644 extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl delete mode 100644 extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl (limited to 'extensions/RequestWhiner') diff --git a/extensions/RequestWhiner/Config.pm b/extensions/RequestWhiner/Config.pm deleted file mode 100644 index fb08bd7af..000000000 --- a/extensions/RequestWhiner/Config.pm +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the RequestWhiner Bugzilla Extension. -# -# The Initial Developer of the Original Code is Gervase Markham -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham - -package Bugzilla::Extension::RequestWhiner; -use strict; - -use constant NAME => 'RequestWhiner'; - -use constant REQUIRED_MODULES => [ -]; - -use constant OPTIONAL_MODULES => [ -]; - -__PACKAGE__->NAME; \ No newline at end of file diff --git a/extensions/RequestWhiner/Extension.pm b/extensions/RequestWhiner/Extension.pm deleted file mode 100644 index 3f1ee1f27..000000000 --- a/extensions/RequestWhiner/Extension.pm +++ /dev/null @@ -1,43 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the RequestWhiner Bugzilla Extension. -# -# The Initial Developer of the Original Code is the Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham - -package Bugzilla::Extension::RequestWhiner; -use strict; -use base qw(Bugzilla::Extension); - -use Bugzilla::Constants qw(bz_locations); -use Bugzilla::Install::Filesystem; - -our $VERSION = '0.01'; - -sub install_filesystem { - my ($self, $args) = @_; - my $files = $args->{'files'}; - - my $extensionsdir = bz_locations()->{'extensionsdir'}; - my $scriptname = $extensionsdir . "/" . __PACKAGE__->NAME . "/bin/whineatrequests.pl"; - - $files->{$scriptname} = { - perms => Bugzilla::Install::Filesystem::WS_EXECUTE - }; -} - -__PACKAGE__->NAME; diff --git a/extensions/RequestWhiner/bin/whineatrequests.pl b/extensions/RequestWhiner/bin/whineatrequests.pl deleted file mode 100755 index f7cb61dbb..000000000 --- a/extensions/RequestWhiner/bin/whineatrequests.pl +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/perl -wT -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# The Initial Developer of the Original Code is Netscape Communications -# Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): Erik Stambaugh -# Gervase Markham - -use strict; - -BEGIN { - use lib qw(lib .); - use Bugzilla; - Bugzilla->extensions; -} - -use lib qw(. lib); - -use Bugzilla; -use Bugzilla::User; -use Bugzilla::Mailer; -use Email::MIME; - -use Bugzilla::Extension::RequestWhiner::Constants; - -my $dbh = Bugzilla->dbh; - -my $sth_get_requests = - $dbh->prepare("SELECT profiles.login_name, - flagtypes.name, - flags.attach_id, - bugs.bug_id, - bugs.short_desc, " . - $dbh->sql_to_days('NOW()') . - " - " . - $dbh->sql_to_days('flags.modification_date') . " - AS age_in_days - FROM flags - JOIN bugs ON bugs.bug_id = flags.bug_id, - flagtypes, - profiles - WHERE flags.status = '?' - AND flags.requestee_id = profiles.userid - AND flags.type_id = flagtypes.id - AND " . $dbh->sql_to_days('NOW()') . - " - " . - $dbh->sql_to_days('flags.modification_date') . - " > " . - WHINE_AFTER_DAYS . " - ORDER BY flags.modification_date"); - -$sth_get_requests->execute(); - -# Build data structure -my $requests = {}; - -while (my ($login_name, - $flag_name, - $attach_id, - $bug_id, - $short_desc, - $age_in_days) = $sth_get_requests->fetchrow_array()) -{ - if (!defined($requests->{$login_name})) { - $requests->{$login_name} = {}; - } - - if (!defined($requests->{$login_name}->{$flag_name})) { - $requests->{$login_name}->{$flag_name} = []; - } - - push(@{ $requests->{$login_name}->{$flag_name} }, { - bug_id => $bug_id, - attach_id => $attach_id, - summary => $short_desc, - age => $age_in_days - }); -} - -$sth_get_requests->finish(); - -foreach my $recipient (keys %$requests) { - my $user = new Bugzilla::User({ name => $recipient }); - - next if $user->email_disabled; - - mail({ - from => Bugzilla->params->{'mailfrom'}, - recipient => $user, - subject => "Your Outstanding Requests", - requests => $requests->{$recipient}, - threshold => WHINE_AFTER_DAYS - }); -} - -exit; - -############################################################################### -# Functions -# -# Note: this function is exactly the same as the one in whine.pl, just using -# different templates for the messages themselves. -############################################################################### -sub mail { - my $args = shift; - my $addressee = $args->{recipient}; - my $template = Bugzilla->template; - my ($content, @parts); - - $template->process("requestwhiner/mail.txt.tmpl", $args, \$content) - || die($template->error()); - push(@parts, Email::MIME->create( - attributes => { - content_type => "text/plain", - }, - body => $content, - )); - - $content = ''; - $template->process("requestwhiner/mail.html.tmpl", $args, \$content) - || die($template->error()); - - push(@parts, Email::MIME->create( - attributes => { - content_type => "text/html", - }, - body => $content, - )); - - $content = ''; - $template->process("requestwhiner/header.txt.tmpl", $args, \$content) - || die($template->error()); - - # TT trims the trailing newline - my $email = new Email::MIME("$content\n"); - $email->content_type_set('multipart/alternative'); - $email->parts_set(\@parts); - - MessageToMTA($email); -} diff --git a/extensions/RequestWhiner/disabled b/extensions/RequestWhiner/disabled deleted file mode 100644 index e69de29bb..000000000 diff --git a/extensions/RequestWhiner/lib/Constants.pm b/extensions/RequestWhiner/lib/Constants.pm deleted file mode 100644 index 0e24ae1f0..000000000 --- a/extensions/RequestWhiner/lib/Constants.pm +++ /dev/null @@ -1,31 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the RequestWhiner Bugzilla Extension. -# -# The Initial Developer of the Original Code is the Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gervase Markham - -package Bugzilla::Extension::RequestWhiner::Constants; -use strict; -use base qw(Exporter); -our @EXPORT = qw( - WHINE_AFTER_DAYS -); - -use constant WHINE_AFTER_DAYS => 7; - -1; diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl deleted file mode 100644 index 390fd3e2f..000000000 --- a/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -[% PROCESS global/variables.none.tmpl %] -From: [% from %] -To: [% recipient.email %] -Subject: [[% terms.Bugzilla %]] [% subject %] -X-Bugzilla-Type: whine - diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl deleted file mode 100644 index 07b2b31ee..000000000 --- a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl +++ /dev/null @@ -1,62 +0,0 @@ -[%# The contents of this file are subject to the Mozilla Public - # License Version 1.1 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.mozilla.org/MPL/ - # - # Software distributed under the License is distributed on an "AS - # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - # implied. See the License for the specific language governing - # rights and limitations under the License. - # - # The Original Code is the RequestWhiner Bugzilla Extension. - # - # The Initial Developer of the Original Code is Gervase Markham - # Portions created by the Initial Developer are Copyright (C) 2011 the - # Initial Developer. All Rights Reserved. - # - # Contributor(s): Gervase Markham - #%] - -[% PROCESS global/variables.none.tmpl %] -[% PROCESS 'global/field-descs.none.tmpl' %] - - - - - - [[% terms.Bugzilla %]] [% subject FILTER html %] - - - - -

The following is a list of requests people have made of you, which have been -outstanding more than [% threshold FILTER html %] days. To avoid disappointing -others, please deal with them as quickly as possible. -(Here is some -guidance on handling requests.) -

- -[% FOREACH request_type = requests.keys %] -

[% request_type FILTER html %]

- - - -[% END %] - -

See all your outstanding requests.

- - - diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl deleted file mode 100644 index ef21563c9..000000000 --- a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -[%# The contents of this file are subject to the Mozilla Public - # License Version 1.1 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.mozilla.org/MPL/ - # - # Software distributed under the License is distributed on an "AS - # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - # implied. See the License for the specific language governing - # rights and limitations under the License. - # - # The Original Code is the RequestWhiner Bugzilla Extension. - # - # The Initial Developer of the Original Code is Gervase Markham - # Portions created by the Initial Developer are Copyright (C) 2011 the - # Initial Developer. All Rights Reserved. - # - # Contributor(s): Gervase Markham - #%] - -[% PROCESS global/variables.none.tmpl %] -[% PROCESS 'global/field-descs.none.tmpl' %] - -The following is a list of requests people have made of you, which have been -outstanding more than [% threshold %] days. To avoid disappointing others, please deal with -them as quickly as possible. Here is some guidance on handling requests: - https://wiki.mozilla.org/BMO/Handling_Requests - -[% FOREACH request_type = requests.keys %] -[%+ request_type +%] -[%+ "-" FILTER repeat(request_type.length) +%] - - [% FOREACH request = requests.$request_type %] - [%+ terms.Bug +%] [%+ request.bug_id %]: [% request.summary +%] ([% request.age %] days old) - [%+ urlbase %]show_bug.cgi?id=[% request.bug_id +%] - [% IF request.attach_id %] - [%+ urlbase %]attachment.cgi?id=[% request.attach_id %]&action=edit - [% END %] - [%+ END +%] -[% END %] -To see all your outstanding requests, visit: -[%+ urlbase %]request.cgi?action=queue&requestee=[% recipient.email FILTER url %]&group=type -- cgit v1.2.3-24-g4f1b