~ubuntu-branches/debian/sid/bugzilla/sid

« back to all changes in this revision

Viewing changes to whine.pl

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Patrick Davies
  • Date: 2008-05-29 17:20:32 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080529172032-tddh964ztksxayjm
Tags: 3.0.4-0ubuntu1
* New upstream release (LP: #138886, #235701).
* Removed "CVS" directories and ".cvsignore" files from upstream tarball.
* Added patches/ubuntu_01_bugzilla_libpath.dpatch - newly updated as necessary
  version of old 01_libpath.dpatch patch.
* Added patches/01_debian_package_version.dpatch - replaces old patch
  01_VERSION.dpatch, simply changes the version of Bugzilla to show the
  Debian packaging's versioning.
* Added patches/ubuntu_05_makefile_install.dpatch - Use a Makefile to
  install Bugzilla to the correct locations. Based on Makefile in old
  package but in patch form.
* Removed 02_checksetup.dpatch - fixed upstream.
* Removed 101_Config.diff - upstream has changed codebase.
* Renamed 06_contrib.dpatch to ubuntu_02_contrib_shebang_fixes.dpatch -
  corrects 'shebangs' which point to /usr/local/bin/ to /usr/bin/.
* Renamed 08_showdependencygraph.dpatch to
  ubuntu_03_showdependencygraph_url_fixes.dpatch and updated code as
  necessary - fixes graph URL to make the webdot generation possible.
* Removed CVE-2007-0791.dpatch - applied to upstream code.
* Removed CVE-2007-4543.dpatch - applied to upstream code.
* Renamed 09_homelink.dpatch to ubuntu_04_fixed_homepage_linked.dpatch -
  upstream now has links in
  'template/en/default/global/common-links.html.tmpl' instead of
  'useful-links.html.tmpl'.
* Removed 03_webpath.dpatch - upstream has changed stylesheet layout.
* Updated 10_perl_scripts_shebang.dpatch and removed part on "globals.pl" -
  no longer in source.
* Removed Debian vhost support patches (see docs/html/multiple-bz-dbs.html
  for how to run multiple Bugzilla instances):
  - Removed 04_Config.pm.dpatch - duplicate patch and unable to adapt it to
    new upstream code.
  - Removed 07_virtualhosting.dpatch - duplicate patch of
    04_Config.pm.dpatch.
  - Removed 'debian/examples' - contained Apache VHost example setup files
    for Bugzilla.
  - Removed section about vhosts from README.Debian.
* debian/rules:
  - Removed rules for "vhost conf dir", "examples" and "101_Config.diff"
    installation rules.
  - Removed part about bugzilla-fr package.
  - Remved part about "whine.pl" - now in Makefile.
  - Added rules to check the setup with upstream's "checksetup.pl" script.
* debian/control:
  - Updated Standards-Version to 3.7.3.
  - Updated compatibity level and debhelper build dependency version to 6.
  - Added Homepage field to source package stanza.
  - Added part about seeing 'bugzilla' package for more info to
    'bugzilla-docs'.
  - Added libapache2-mod-perl2, libtemplate-perl, libmime-perl,
    libappconfig-perl, libdbd-mysql-perl, libtimedate-perl, libgd-gd2-perl,
    libgd-text-perl, libxml-twig-perl, perlmagick, libemail-send-perl,
    libemail-mime-modifier-perl, libchart-perl, libgd-graph-perl,
    libhtml-scrubber-perl, libdbi-perl, libfile-spec-perl, libgd-graph-perl,
    libgd-text-perl, libnet-ldap-perl, libxml-parser-perl: to build
    dependencies with the necessary versions as stated by upstream in
    docs/html/installation.html - in order to check packaging correctly with
    'checksetup.pl' in rules. Also updated the 'bugzilla' dependencies with
    the above (LP: #235461).
  - Removed dependencies on old "apache" packages as they are no longer in
    the archives.
  - Moved mail transport agents on 'bugzilla' from Depends to
    Suggests (LP: #156405).
* debian/copyright: Updated the downloaded from link.
* debian/bugzilla.docs: Added "QUICKSTART", "rel_notes.txt" and "UPGRADING"
  documentation from source tarball for inclusion in package.
* debian/bugzilla-doc.doc-base: Corrected some spelling mistakes.
* debian/bugzilla.postinst: Removed sections about 101_Config.diff.
* Changed 'X_BUGZILLA_SITE' in bugzilla.cron.daily and bugzilla.postinst to
  'PROJECT'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
use strict;
28
28
 
29
29
use lib ".";
30
 
require "globals.pl";
31
30
 
32
 
use Bugzilla::Config qw(:DEFAULT $datadir);
 
31
use Bugzilla;
33
32
use Bugzilla::Constants;
34
33
use Bugzilla::Search;
35
34
use Bugzilla::User;
36
 
use Bugzilla::BugMail;
 
35
use Bugzilla::Mailer;
37
36
use Bugzilla::Util;
38
37
 
39
38
# create some handles that we'll need
94
93
# After that, it looks over each user to see if they have schedules that need
95
94
# running, then runs those and generates the email messages.
96
95
 
97
 
# Send whines from the address in the 'maintainer' Parameter so that all
 
96
# Send whines from the address in the 'mailfrom' Parameter so that all
98
97
# Bugzilla-originated mail appears to come from a single address.
99
 
my $fromaddress = Param('maintainer');
100
 
 
101
 
if ($fromaddress !~ Param('emailregexp')) {
102
 
    die "Cannot run.  " .
103
 
        "The maintainer email address has not been properly set!\n";
104
 
}
105
 
 
106
 
# Check the nomail file for users who should not receive mail
107
 
my %nomail;
108
 
if (open(NOMAIL, '<', "$datadir/nomail")) {
109
 
    while (<NOMAIL>) {
110
 
        $nomail{trim($_)} = 1;
111
 
    }
112
 
}
113
 
 
114
 
# get the current date and time from the database
115
 
$sth = $dbh->prepare('SELECT ' . $dbh->sql_date_format('NOW()', '%y,%m,%d,%a,%H,%i'));
116
 
$sth->execute;
117
 
my ($now_year, $now_month, $now_day, $now_weekdayname, $now_hour, $now_minute) =
118
 
        split(',', $sth->fetchrow_array);
119
 
$sth->finish;
120
 
 
121
 
# As DBs have different days numbering, use day name and convert it
122
 
# to the range 0-6
123
 
my $now_weekday = index("SunMonTueWedThuFriSat", $now_weekdayname) / 3;
 
98
my $fromaddress = Bugzilla->params->{'mailfrom'};
 
99
 
 
100
# get the current date and time
 
101
my ($now_sec, $now_minute, $now_hour, $now_day, $now_month, $now_year, 
 
102
    $now_weekday) = localtime;
 
103
# Convert year to two digits
 
104
$now_year = sprintf("%02d", $now_year % 100);
 
105
# Convert the month to January being "1" instead of January being "0".
 
106
$now_month++;
124
107
 
125
108
my @daysinmonth = qw(0 31 28 31 30 31 30 31 31 30 31 30 31);
126
109
# Alter February in case of a leap year.  This simple way to do it only
375
358
#
376
359
sub mail {
377
360
    my $args = shift;
378
 
 
379
 
    # Don't send mail to someone on the nomail list.
380
 
    return if $nomail{$args->{'recipient'}->{'login'}};
381
 
 
 
361
    my $addressee = $args->{recipient};
 
362
    # Don't send mail to someone whose bugmail notification is disabled.
 
363
    return if $addressee->email_disabled;
 
364
 
 
365
    my $template = Bugzilla->template_inner($addressee->settings->{'lang'}->{'value'});
382
366
    my $msg = ''; # it's a temporary variable to hold the template output
383
367
    $args->{'alternatives'} ||= [];
384
368
 
409
393
    $template->process("whine/multipart-mime.txt.tmpl", $args, \$msg)
410
394
        or die($template->error());
411
395
 
412
 
    Bugzilla::BugMail::MessageToMTA($msg);
 
396
    Bugzilla->template_inner("");
 
397
    MessageToMTA($msg);
413
398
 
414
399
    delete $args->{'boundary'};
415
400
    delete $args->{'alternatives'};