mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 10:56:08 +01:00
Handle gpm events in Admin (#508)
* Fix removing packages * npm install "babel-preset-es2015": "^6.6.0" * Run gulp * Handle messages in packages install/remove/update procedures
This commit is contained in:
@@ -387,15 +387,19 @@ class AdminController
|
||||
|
||||
require_once __DIR__ . '/gpm.php';
|
||||
|
||||
$result = false;
|
||||
|
||||
try {
|
||||
$result = \Grav\Plugin\Admin\Gpm::install($package, ['theme' => ($type == 'theme')]);
|
||||
} catch (\Exception $e) {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
|
||||
return;
|
||||
}
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => $result];
|
||||
return true;
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => "Package $package installed successfully"];
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => $this->admin->translate(is_string($result) ? $result : sprintf($this->admin->translate('PLUGIN_ADMIN.PACKAGE_X_INSTALLED_SUCCESSFULLY', null, true), $package))];
|
||||
} else {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.INSTALLATION_FAILED')];
|
||||
}
|
||||
@@ -434,8 +438,7 @@ class AdminController
|
||||
return;
|
||||
}
|
||||
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => 'xxx'];
|
||||
return true;
|
||||
$result = false;
|
||||
|
||||
try {
|
||||
$dependencies = $this->admin->dependenciesThatCanBeRemovedWhenRemoving($package);
|
||||
@@ -446,7 +449,7 @@ class AdminController
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = ['status' => 'success', 'dependencies' => $dependencies, 'message' => $this->admin->translate('PLUGIN_ADMIN.UNINSTALL_SUCCESSFUL')];
|
||||
$this->admin->json_response = ['status' => 'success', 'dependencies' => $dependencies, 'message' => $this->admin->translate(is_string($result) ? $result :'PLUGIN_ADMIN.UNINSTALL_SUCCESSFUL')];
|
||||
} else {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.UNINSTALL_FAILED')];
|
||||
}
|
||||
@@ -1212,6 +1215,8 @@ class AdminController
|
||||
/**
|
||||
* Handles uninstalling plugins and themes
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @return bool True if the action was performed
|
||||
*/
|
||||
public function taskUninstall()
|
||||
|
||||
Reference in New Issue
Block a user