From 625aa3f1bd144def2529c57b43c8a88212d2346f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 21 Jan 2021 23:00:34 +0200 Subject: [PATCH] Fixed a bug in post-install methods --- system/defines.php | 2 +- system/src/Grav/Installer/Install.php | 13 ++++--------- ....7.2_2021-01-21_1.php => 1.7.3_2021-01-21_1.php} | 6 ++++-- 3 files changed, 9 insertions(+), 12 deletions(-) rename system/src/Grav/Installer/updates/{1.7.2_2021-01-21_1.php => 1.7.3_2021-01-21_1.php} (83%) diff --git a/system/defines.php b/system/defines.php index 5b20589d1..612a303a5 100644 --- a/system/defines.php +++ b/system/defines.php @@ -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 diff --git a/system/src/Grav/Installer/Install.php b/system/src/Grav/Installer/Install.php index 56696b218..d10427489 100644 --- a/system/src/Grav/Installer/Install.php +++ b/system/src/Grav/Installer/Install.php @@ -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); diff --git a/system/src/Grav/Installer/updates/1.7.2_2021-01-21_1.php b/system/src/Grav/Installer/updates/1.7.3_2021-01-21_1.php similarity index 83% rename from system/src/Grav/Installer/updates/1.7.2_2021-01-21_1.php rename to system/src/Grav/Installer/updates/1.7.3_2021-01-21_1.php index d10e1bec2..09376f896 100644 --- a/system/src/Grav/Installer/updates/1.7.2_2021-01-21_1.php +++ b/system/src/Grav/Installer/updates/1.7.3_2021-01-21_1.php @@ -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); }