diff --git a/now.json b/now.json index fe7b94b37..d2e629cf1 100644 --- a/now.json +++ b/now.json @@ -1,4 +1,4 @@ - { +{ "version": 2, "builds": [{ "src": "*.php", "use": "@now/php" }] } diff --git a/system/src/Grav/Installer/Install.php b/system/src/Grav/Installer/Install.php index 6c82109a6..30d7c056f 100644 --- a/system/src/Grav/Installer/Install.php +++ b/system/src/Grav/Installer/Install.php @@ -167,11 +167,11 @@ final class Install if (\defined('GRAV_CLI') && GRAV_CLI) { $errors = "\n\n" . strip_tags($errors) . "\n\n"; $errors .= <<get($name, []); - return $this->get($name, []); + // Fix for broken Grav 1.6 history + if ($extension === 'grav') { + $history = $this->fixHistory($history); + } + + return $history; } /** @@ -207,7 +213,7 @@ final class Versions public function updateHistory(string $extension, ?string $version): void { $name = "{$extension}/history"; - $history = $this->get($name, []); + $history = $this->getHistory($extension); $history[] = ['version' => $version, 'date' => gmdate('Y-m-d H:i:s')]; $this->set($name, $history); } @@ -222,6 +228,21 @@ final class Versions $this->undef("{$extension}/history"); } + /** + * @param array $history + * @return array + */ + private function fixHistory(array $history): array + { + if (isset($history['version'], $history['date'])) { + $fix = [['version' => $history['version'], 'date' => $history['date']]]; + unset($history['version'], $history['date']); + $history = array_merge($fix, $history); + } + + return $history; + } + /** * Get value by using dot notation for nested arrays/objects. *