id = $data['id']; $this->action = $data['action']; } public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $task = id(new PhabricatorWorkerActiveTask())->load($this->id); if (!$task) { return new Aphront404Response(); } if ($request->isFormPost()) { switch ($this->action) { case 'delete': $task->delete(); break; case 'release': $task->setLeaseOwner(null); $task->setLeaseExpires(time()); $task->save(); break; } return id(new AphrontRedirectResponse())->setURI('/daemon/'); } $dialog = new AphrontDialogView(); $dialog->setUser($user); switch ($this->action) { case 'delete': $dialog->setTitle('Really delete task?'); $dialog->appendChild( '

The work this task represents will never be performed if you '. 'delete it. Are you sure you want to delete it?

'); $dialog->addSubmitButton('Delete Task'); break; case 'release': $dialog->setTitle('Really free task lease?'); $dialog->appendChild( '

If the process which owns the task lease is still doing work '. 'on it, the work may be performed twice. Are you sure you '. 'want to free the lease?

'); $dialog->addSubmitButton('Free Lease'); break; default: return new Aphront404Response(); } $dialog->addCancelButton('/daemon/'); return id(new AphrontDialogResponse())->setDialog($dialog); } }