From a8b27130cbcdad3f9c5856f3e6550093f0be265f Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Thu, 5 Dec 2013 14:20:40 +1100 Subject: [PATCH] Make "Edit Build Plan" more resiliant so old build configurations can be deleted Summary: Currently the "Edit Build Plan" page crashes if there are any build steps with invalid implementations (because the implementation class has been removed or renamed). This updates the Edit Build Plan page so that steps with invalid implementations can be deleted. Test Plan: Looked at a build plan with invalid configurations and deleted it's steps. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T4111, T1049 Differential Revision: https://secure.phabricator.com/D7708 --- .../HarbormasterPlanViewController.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php index 9cc6944202..6980056218 100644 --- a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php @@ -86,7 +86,31 @@ final class HarbormasterPlanViewController $step_list = id(new PHUIObjectItemListView()) ->setUser($viewer); foreach ($steps as $step) { - $implementation = $step->getStepImplementation(); + $implementation = null; + try { + $implementation = $step->getStepImplementation(); + } catch (Exception $ex) { + // We can't initialize the implementation. This might be because + // it's been renamed or no longer exists. + $item = id(new PHUIObjectItemView()) + ->setObjectName("Step ".$i++) + ->setHeader(pht('Unknown Implementation')) + ->setBarColor('red') + ->addAttribute(pht( + 'This step has an invalid implementation (%s).', + $step->getClassName())) + ->addAction( + id(new PHUIListItemView()) + ->setIcon('delete') + ->addSigil('harbormaster-build-step-delete') + ->setWorkflow(true) + ->setRenderNameAsTooltip(true) + ->setName(pht("Delete")) + ->setHref( + $this->getApplicationURI("step/delete/".$step->getID()."/"))); + $step_list->addItem($item); + continue; + } $item = id(new PHUIObjectItemView()) ->setObjectName("Step ".$i++) ->setHeader($implementation->getName());