Fix for processing exiting after removing package so events are not fired on missing plugins

This commit is contained in:
Andy Miller
2017-01-11 20:05:07 -07:00
parent d7d0fe5b53
commit 78a7d60c82

View File

@@ -958,12 +958,11 @@ class AdminController extends AdminBaseController
$type = isset($data['type']) ? $data['type'] : '';
if (!$this->authorizeTask('uninstall ' . $type, ['admin.' . $type, 'admin.super'])) {
$this->admin->json_response = [
$json_response = [
'status' => 'error',
'message' => $this->admin->translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK')
];
return false;
echo json_encode($json_response);exit;
}
//check if there are packages that have this as a dependency. Abort and show which ones
@@ -977,31 +976,31 @@ class AdminController extends AdminBaseController
$dependent_packages) . "</cyan> depends on this package. Please remove it first.";
}
$this->admin->json_response = ['status' => 'error', 'message' => $message];
return false;
$json_response = ['status' => 'error', 'message' => $message];
echo json_encode($json_response);exit;
}
try {
$dependencies = $this->admin->dependenciesThatCanBeRemovedWhenRemoving($package);
$result = Gpm::uninstall($package, []);
} catch (\Exception $e) {
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
return false;
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
echo json_encode($json_response);exit;
}
if ($result) {
$this->admin->json_response = [
$json_response = [
'status' => 'success',
'dependencies' => $dependencies,
'message' => $this->admin->translate(is_string($result) ? $result : 'PLUGIN_ADMIN.UNINSTALL_SUCCESSFUL')
];
echo json_encode($json_response);exit;
} else {
$this->admin->json_response = [
$json_response = [
'status' => 'error',
'message' => $this->admin->translate('PLUGIN_ADMIN.UNINSTALL_FAILED')
];
echo json_encode($json_response);exit;
}
return true;