Update Grav when pressing the "Update Grav Now" button

This commit is contained in:
Flavio Copes
2015-08-06 09:34:55 +02:00
parent 1945099227
commit 01c73d1451
4 changed files with 62 additions and 3 deletions

View File

@@ -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
*