mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
Prevent upgrade of Grav if PHP min requirement is not met. Gracefully fail with additional information
This commit is contained in:
@@ -862,7 +862,7 @@ class AdminController
|
|||||||
require_once __DIR__ . '/gpm.php';
|
require_once __DIR__ . '/gpm.php';
|
||||||
|
|
||||||
if (!$this->authorizeTask('install grav', ['admin.super'])) {
|
if (!$this->authorizeTask('install grav', ['admin.super'])) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = \Grav\Plugin\Admin\Gpm::selfupgrade();
|
$result = \Grav\Plugin\Admin\Gpm::selfupgrade();
|
||||||
|
|||||||
@@ -179,6 +179,17 @@ class Gpm
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$upgrader->meetsRequirements()) {
|
||||||
|
$error = [];
|
||||||
|
$error[] = '<p>Grav has increased the minimum PHP requirement.<br />';
|
||||||
|
$error[] = 'You are currently running PHP <strong>' . PHP_VERSION .'</strong>';
|
||||||
|
$error[] = ', but PHP <strong>' . GRAV_PHP_MIN .'</strong> is required.</p>';
|
||||||
|
$error[] = '<p><a href="http://getgrav.org/blog/changing-php-requirements-to-5.5" class="button button-small secondary">Additional information</a></p>';
|
||||||
|
|
||||||
|
Installer::setError(implode("\n", $error));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$update = $upgrader->getAssets()['grav-update'];
|
$update = $upgrader->getAssets()['grav-update'];
|
||||||
$tmp = CACHE_DIR . 'tmp/Grav-' . uniqid();
|
$tmp = CACHE_DIR . 'tmp/Grav-' . uniqid();
|
||||||
$file = self::_downloadSelfupgrade($update, $tmp);
|
$file = self::_downloadSelfupgrade($update, $tmp);
|
||||||
|
|||||||
Reference in New Issue
Block a user