~ubuntu-branches/ubuntu/oneiric/request-tracker3.8/oneiric-updates

« back to all changes in this revision

Viewing changes to sbin/rt-email-dashboards.in

  • Committer: Bazaar Package Importer
  • Author(s): Dominic Hargreaves, Dominic Hargreaves, Christian Perrier
  • Date: 2009-06-16 21:46:59 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090616214659-5ji9k1n3qyc2br3n
Tags: 3.8.4-1
[ Dominic Hargreaves ]
* Add missing comma in Depends (fixes FTBFS on etch)
* Update debconf translations: pt.po, ja.po, sv.po, it.po, cs.po, ru.po
  (Closes: #519885, #519922, #520603, #520759, #521199, #521926)
* Document preference for not using SQLite in production
  (Closes: #512750)

[ Christian Perrier ]
* Debconf templates and debian/control reviewed by the debian-l10n-
  english team as part of the Smith review project.
  (Closes: #522367, #520959)
* [Debconf translation updates]
  - Japanese. Closes: #522896
  - German. Closes: #520958
  - Portuguese. Closes: #523481
  - Galician. Closes: #524256
  - Galician. Closes: #524256
  - Spanish. Closes: #524449
  - Italian. Closes: #524715
  - Russian. Closes: #524894
  - Swedish. Closes: #525171
  - French. Closes: #525281

[ Dominic Hargreaves ]
* Don't tell dbconfig to comment out unused variables, since this
  breaks MySQL and Postgres database configuration (Closes: #523090)
* Update Standards-Version (no changes)
* Switch dependency on sysklogd to rsyslog (Closes: #526914)
* New upstream release; includes
  - Minor security fix (Closes: #533069)
  - Add missing Postgres index (Closes: #512653)
* Patch webmux.pl to provide a better error message when the wrong
  major version of RT is in @INC (for example in a mod_perl context).
  (Closes: #518692)
* Add some more example Exim 4 configuration (Closes: #238345)
* Don't apply database ACLs in databases managed by dbconfig-common.
* Remove unused ACL patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
use HTML::RewriteAttributes::Links;
87
87
use MIME::Types;
88
88
use POSIX 'tzset';
 
89
use File::Temp 'tempdir';
89
90
 
90
91
# Clean out all the nasties from the environment
91
92
CleanEnv();
114
115
}
115
116
 
116
117
# helper functions
117
 
sub verbose  { print loc(@_), "\n" if $opts{verbose} || $opts{verbose}; 1 }
 
118
sub verbose  { print loc(@_), "\n" if $opts{debug} || $opts{verbose}; 1 }
118
119
sub debug    { print loc(@_), "\n" if $opts{debug}; 1 }
119
120
sub error    { $RT::Logger->error(loc(@_)); verbose(@_); 1 }
120
121
sub warning  { $RT::Logger->warning(loc(@_)); verbose(@_); 1 }
148
149
    # look through this user's subscriptions, are any supposed to be generated
149
150
    # right now?
150
151
    for my $subscription ($user->Attributes->Named('Subscription')) {
 
152
        my $counter = $subscription->SubValue('Counter') || 0;
151
153
 
152
154
        if (!$opts{all}) {
153
 
            debug "Checking against subscription with frequency [_1], hour [_2], dow [_3], dom [_4]", $subscription->SubValue('Frequency'), $subscription->SubValue('Hour'), $subscription->SubValue('Dow'), $subscription->SubValue('Dom');
 
155
            debug "Checking against subscription with frequency [_1], hour [_2], dow [_3], dom [_4]",
 
156
                $subscription->SubValue('Frequency'), $subscription->SubValue('Hour'),
 
157
                $subscription->SubValue('Dow'), $subscription->SubValue('Dom');
154
158
 
155
159
            next if $subscription->SubValue('Frequency') eq 'never';
156
160
 
160
164
            # if weekly, correct day of week?
161
165
            if ( $subscription->SubValue('Frequency') eq 'weekly' ) {
162
166
                next if $subscription->SubValue('Dow') ne $dow;
163
 
                my $counter = $subscription->SubValue('Counter') || 0;
164
167
                my $fow       = $subscription->SubValue('Fow') || 1;
165
168
                if ( $counter % $fow ) {
166
 
                    $subscription->SetSubValues( Counter => $counter+1 )
 
169
                    $subscription->SetSubValues( Counter => $counter + 1 )
167
170
                      unless $opts{'dryrun'};
168
171
                    next;
169
172
                }
173
176
            elsif ($subscription->SubValue('Frequency') eq 'monthly') {
174
177
                next if $subscription->SubValue('Dom') != $dom;
175
178
            }
 
179
 
 
180
            elsif ($subscription->SubValue('Frequency') eq 'm-f') {
 
181
                next if $dow eq 'Sunday' || $dow eq 'Saturday';
 
182
            }
176
183
        }
177
184
 
178
185
        my $email = $subscription->SubValue('Recipient')
184
191
        }
185
192
        else {
186
193
            $subscription->SetSubValues(
187
 
                Counter => $subscription->SubValue('Counter') + 1 )
 
194
                Counter => $counter + 1 )
188
195
              unless $opts{'dryrun'};
189
196
        }
190
197
    }
360
367
{
361
368
    my $mason;
362
369
    my $outbuf = '';
 
370
    my $data_dir = '';
363
371
 
364
372
    sub mason {
365
373
        unless ($mason) {
366
374
            debug "Creating Mason object.";
 
375
 
 
376
            # user may not have permissions on the data directory, so create a
 
377
            # new one
 
378
            $data_dir = tempdir(CLEANUP => 1);
 
379
 
367
380
            $mason = HTML::Mason::Interp->new(
368
381
                RT::Interface::Web::Handler->DefaultHandlerArgs,
369
382
                out_method => \$outbuf,
370
383
                autohandler_name => '', # disable forced login and more
 
384
                data_dir => $data_dir,
371
385
            );
372
386
        }
373
387
        return $mason;