mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 19:46:44 +02:00
Merge branch 'develop' of https://github.com/getgrav/grav-plugin-admin into develop
# By Flavio Copes # Via Flavio Copes * 'develop' of https://github.com/getgrav/grav-plugin-admin: Fix #12 link to rockettheme.com, thanks @symac A better update success message. Update the version in the footer. Show error message if Grav is symlinked, and stop the upgrade process Manage permissions Add feedback during/after upgrade Remove unneeded code Update Grav when pressing the "Update Grav Now" button
This commit is contained in:
@@ -682,6 +682,35 @@ class AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updating Grav
|
||||
*
|
||||
* @return bool True is the action was performed
|
||||
*/
|
||||
public function taskUpdategrav()
|
||||
{
|
||||
require_once __DIR__ . '/gpm.php';
|
||||
|
||||
if (!$this->authoriseTask('install grav', ['admin.super'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_link(ROOT_DIR . 'index.php')) {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => 'Cannot upgrade: Grav is symlinked. Please upgrade manually'];
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = \Grav\Plugin\Admin\Gpm::selfupgrade();
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => 'Grav was successfully updated to '];
|
||||
} else {
|
||||
$this->admin->json_response = ['status' => 'error', 'message' => 'Grav update failed'];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles updating plugins and themes
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user