mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-01-06 07:41:05 +01:00
Update Grav when pressing the "Update Grav Now" button
This commit is contained in:
@@ -682,6 +682,36 @@ class AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updating Grav
|
||||
*
|
||||
* @return bool True is the action was performed
|
||||
*/
|
||||
public function taskUpdategrav()
|
||||
{
|
||||
require_once __DIR__ . '/gpm.php';
|
||||
|
||||
//TODO: manage permissions
|
||||
|
||||
$result = \Grav\Plugin\Admin\Gpm::selfupgrade();
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => 'Everything updated'];
|
||||
} else {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => 'Updates failed'];
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$this->admin->setMessage("Installation successful.", 'info');
|
||||
} else {
|
||||
$this->admin->setMessage("Installation failed.", 'error');
|
||||
}
|
||||
|
||||
//$this->post = array('_redirect' => $this->view . '/' . $this->route);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updating plugins and themes
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user