diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 99992683c..7a929ca5d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,7 @@ - Config file bugs fixed, see gotcha.txt for details. - Added export to context menu in asset manager - fix: XHTML 1.0 strict, FileUploadControl.js, resizable textarea + - fix: undefined activity - Polls now use JSON instead of Storable to serialize graph config diff --git a/docs/upgrades/upgrade_7.4.2-7.4.3.pl b/docs/upgrades/upgrade_7.4.2-7.4.3.pl index c3e31344a..52b55d594 100644 --- a/docs/upgrades/upgrade_7.4.2-7.4.3.pl +++ b/docs/upgrades/upgrade_7.4.2-7.4.3.pl @@ -12,7 +12,9 @@ use lib "../../lib"; use strict; use Getopt::Long; use WebGUI::Session; - +use WebGUI::Workflow::Cron; +use WebGUI::Asset; +use WebGUI::Utility; my $toVersion = "7.4.3"; # make this match what version you're going to my $quiet; # this line required @@ -22,16 +24,32 @@ my $session = start(); # this line required # upgrade functions go here reserializePollGraphConfigs($session); +fixCsMailWorkflow($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 fixCsMailWorkflow { + my $session = shift; + print "\tFixing CS Mail workflows and crons.\n" unless ($quiet); + # get valid crons + my $collaborations = $session->db->read("select assetId from asset where className like 'WebGUI::Asset::Wobject::Collaboration%'"); + my @cronIds = (); + while (my ($id) = $collaborations->array) { + my $cs = WebGUI::Asset->newByDynamicClass($session, $id); + if (defined $cs) { + push(@cronIds, $cs->get("getMailCronId")); + } + } + # delete invalid crons + for my $task (@{WebGUI::Workflow::Cron->getAllTasks($session)}) { + next unless ($task->get("className") =~ m/WebGUI::Asset::Wobject::Collaboration/); + unless (isIn($task->getId, @cronIds)) { + $task->delete; + } + } +} #------------------------------------------------- sub reserializePollGraphConfigs { diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 56f2af70f..c71bf3f31 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -324,7 +324,7 @@ sub commit { $cron = WebGUI::Workflow::Cron->create($self->session, { title=>$self->getTitle." ".$i18n->get("mail"), minuteOfHour=>"*/".($self->get("getMailInterval")/60), - className=>"WebGUI::Asset::Wobject::Collaboration", + className=>(ref $self), methodName=>"new", parameters=>$self->getId, workflowId=>"csworkflow000000000001"