Merge branch 'feature/exit_after_removel_package' into develop

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Andy Miller
2017-01-12 12:00:34 -07:00
2 changed files with 11 additions and 11 deletions

View File

@@ -10,6 +10,7 @@
* Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921)
* Fix html markup in section twig [#922](https://github.com/getgrav/grav-plugin-admin/pull/922)
* Fix bug in deleting a file uploaded with the `file` field [#920](github.com/getgrav/grav-plugin-admin/issues/920)
* Fix for plugin throwing event-based errors when plugin is removed and no longer available to process said event
# v1.2.7
## 12/22/2016

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;