Fixed a bug in post-install methods

This commit is contained in:
Matias Griese
2021-01-21 23:00:34 +02:00
parent 8e337647a2
commit 625aa3f1bd
3 changed files with 9 additions and 12 deletions

View File

@@ -9,7 +9,7 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.7.2');
define('GRAV_SCHEMA', '1.7.2_2021-01-21_1');
define('GRAV_SCHEMA', '1.7.3_2021-01-21_1');
define('GRAV_TESTING', false);
// PHP minimum requirement

View File

@@ -218,21 +218,16 @@ ERR;
throw new RuntimeException('Grav has already been installed here!', 400);
}
// Make sure that none of the Grav\Installer classes have been loaded, otherwise installation may fail!
// Load the installer classes.
foreach ($this->classMap as $class_name => $path) {
// Make sure that none of the Grav\Installer classes have been loaded, otherwise installation may fail!
if (class_exists($class_name, false)) {
throw new RuntimeException(sprintf('Cannot update Grav, class %s has already been loaded!', $class_name), 500);
}
require $path;
}
$grav = Grav::instance();
/** @var ClassLoader $loader */
$loader = $grav['loader'];
// Override Grav\Installer classes by using this version of Grav.
$loader->addClassMap($this->classMap);
$this->legacySupport();
$this->location = dirname($location, 4);

View File

@@ -17,8 +17,10 @@ return [
try {
// Keep old defaults for backwards compatibility.
$yaml = YamlUpdater::instance(GRAV_ROOT . '/user/config/system.yaml');
$yaml->undefine('gpm.releases');
$yaml->save();
if (!$yaml->isHandWritten()) {
$yaml->undefine('gpm.releases');
$yaml->save();
}
} catch (\Exception $e) {
throw new InstallException('Could not update system configuration to maintain backwards compatibility', $e);
}