Calendar needs to cleanup its feeds when it is deleted

This commit is contained in:
Colin Kuskie 2007-03-08 21:12:02 +00:00
parent cc569b1b4d
commit 62f3a9b045
3 changed files with 31 additions and 7 deletions

View file

@ -30,6 +30,8 @@
- Fixed a bad module name in the updated WeatherData asset (perlDreamer Consulting, LLC)
- File and Image handling via Storage.pm (perlDreamer Consulting, LLC)
- Calendar: event details misdirection (perlDreamer Consulting, LLC)
- Calendar asset bug, hourly workflow error (Thanks to Chad Kotil (Global
Research NOC) for debug help with this)
7.3.11
- Added an option for enabling coverage tests to testCodebase.pl.

View file

@ -21,16 +21,24 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
deleteUnusedIcalFeeds($session);
finish($session); # this line required
##-------------------------------------------------
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet);
# # and here's our code
#}
#-------------------------------------------------
sub deleteUnusedIcalFeeds {
my $session = shift;
print "\tDeleting iCal feeds for Calendar that have already been deleted.\n" unless ($quiet);
my $calendarAssetIds = $session->db->buildArrayRef('select distinct(assetId) from Calendar');
return unless scalar @{ $calendarAssetIds };
my $query = sprintf(
"DELETE FROM Calendar_feeds WHERE assetId NOT IN (%s)",
$session->db->quoteAndJoin($calendarAssetIds)
);
print $query;
$session->db->write($query);
}