From 70b0c262f59c5df5bb0d12f45b5dbddfe199e729 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 29 Jan 2009 17:40:43 +0000 Subject: [PATCH] Forward port removing workflow instances that don't have an underlying workflow anymore. --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.6.10-7.6.11.pl | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b123d2c63..f144a162c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -21,6 +21,7 @@ - fixed: utf8 issues with Survey should be correct. JSON fields are now longText instead of longBlob. - fixed #9522: Time tracker does not display - fixed #9215: Survey 2.0 results screens missing + - fixed #9018: orphan workflows from upgrade. 7.6.9 - fixed: ukplayer example is now loaded with swfobject.js released under the MIT licence, see gotcha's and /extras/ukplayer diff --git a/docs/upgrades/upgrade_7.6.10-7.6.11.pl b/docs/upgrades/upgrade_7.6.10-7.6.11.pl index 88966e39f..4038b894f 100644 --- a/docs/upgrades/upgrade_7.6.10-7.6.11.pl +++ b/docs/upgrades/upgrade_7.6.10-7.6.11.pl @@ -31,6 +31,7 @@ my $quiet; # this line required my $session = start(); # this line required hideGalleryAlbums($session); +removeBrokenWorkflowInstances($session); # upgrade functions go here @@ -58,6 +59,19 @@ sub hideGalleryAlbums { print "DONE!\n" unless $quiet; } +#---------------------------------------------------------------------------- +sub removeBrokenWorkflowInstances { + my $session = shift; + print "\tRemove Workflow Instances whose Workflows have been deleted... " unless $quiet; + # and here's our code + my $instances = WebGUI::Workflow::Instance->getAllInstances($session); + foreach my $instance (@{ $instances }) { + my $workflow = $instance->getWorkflow; + $instance->delete('skipNotify') if !defined $workflow; + } + print "DONE!\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- #----------------------------------------------------------------------------