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:
Andy Miller
2015-08-06 11:03:28 -06:00
5 changed files with 78 additions and 15 deletions

View File

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