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 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 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 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 # v1.2.7
## 12/22/2016 ## 12/22/2016

View File

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