Rework the CS mail fetching interval so that it can't have crazy values like never, every second or yearly. Fixes bug #12043

This commit is contained in:
Colin Kuskie 2011-02-14 16:37:06 -08:00
parent 016df9aa32
commit f3e340fa3a
4 changed files with 198 additions and 11 deletions

View file

@ -2,6 +2,7 @@
- fixed #12035: Story Manager - make keywords from Story view work
- fixed #12042: userDefined variables have no template variable help
- fixed #12045: Job listing template, missing summary
- fixed #12043: Collaboration Systems don't pull mail that fast!
7.10.9
- fixed #12030: Calendar Feed Time Zone Issue

View file

@ -31,6 +31,7 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
convertCsMailInterval($session);
finish($session); # this line required
@ -44,6 +45,33 @@ finish($session); # this line required
# print "DONE!\n" unless $quiet;
#}
#----------------------------------------------------------------------------
sub convertCsMailInterval {
my $session = shift;
print "\tConvert the getMailInterval from seconds to enumeration... " unless $quiet;
# and here's our code
$session->db->write('alter table Collaboration modify column getMailInterval char(64)');
my $get_row = $session->db->read('select assetId, revisionDate, getMailInterval from Collaboration');
my $change_row = $session->db->prepare('update Collaboration set getMailInterval=? where assetId=? and revisionDate=?');
while (my ($assetId, $revisionDate, $seconds ) = $get_row->array) {
my $interval;
if ($seconds <= 60) { $interval = 'every minute'; }
elsif ($seconds <= 120) { $interval = 'every other minute'; }
elsif ($seconds <= 300) { $interval = 'every 5 minutes'; }
elsif ($seconds <= 600) { $interval = 'every 10 minutes'; }
elsif ($seconds <= 900) { $interval = 'every 15 minutes'; }
elsif ($seconds <= 1200) { $interval = 'every 20 minutes'; }
elsif ($seconds <= 1800) { $interval = 'every 30 minutes'; }
elsif ($seconds <= 3600) { $interval = 'every hour'; }
elsif ($seconds <= 7200) { $interval = 'every other hour'; }
else { $interval = 'once per day'; }
$change_row->execute([$interval, $assetId, $revisionDate]);
}
$get_row->finish;
$change_row->finish;
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------