From 61008c8bb830132072edf0ea500f7109d971300b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 1 Jul 2010 11:08:44 -0700 Subject: [PATCH] Check that the Purge workflow exists before trying to run it. Fixes bug #11698 --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetTrash.pm | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ad37b0280..d53afcdf6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fixed #11693: Shopping cart does not show for visitor user - fixed: missing per-item template variables for the cart. - fixed #11696: WebGUI 7.9.8 gotcha + - fixed #11698: Trash dies on missing or bad workflow 7.9.8 - fixed #11651: First Day of Week is a string... diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index a22acbeaa..f6c7110a5 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -298,11 +298,16 @@ sub _invokeWorkflowOnExportedFiles { if ($workflowId) { my ($lastExportedAs) = $self->get("lastExportedAs"); my $wfInstance = WebGUI::Workflow::Instance->create($self->session, { workflowId => $workflowId }); - $wfInstance->setScratch( - WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() => - Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ]) - ); - $wfInstance->start(1); + if ($wfInstance) { + $wfInstance->setScratch( + WebGUI::Workflow::Activity::DeleteExportedFiles::DELETE_FILES_SCRATCH() => + Storable::freeze([ defined($lastExportedAs) ? ($lastExportedAs) : () ]) + ); + $wfInstance->start(1); + } + else { + $self->session->log->warn('The Purge Workflow from the settings has been deleted and cannot be run.'); + } } }