From 998316559677b9b0829efa51db27cf15c27f697f Mon Sep 17 00:00:00 2001 From: Bruno Meilick Date: Fri, 3 Dec 2021 13:52:50 +0000 Subject: [PATCH] :sparkles: site/page->boost() forces ids to make migrations easier --- composer.json | 2 +- index.php | 18 ++++++++++++++---- vendor/composer/installed.php | 8 ++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 3f199d5..7b475bf 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "bnomei/kirby3-boost", "type": "kirby-plugin", - "version": "1.7.0", + "version": "1.7.1", "description": "Boost the speed of Kirby by having content files of pages cached, with automatic unique ID, fast lookup and Tiny-URL.", "license": "MIT", "authors": [ diff --git a/index.php b/index.php index bb1df17..423aac6 100644 --- a/index.php +++ b/index.php @@ -68,17 +68,27 @@ function siteIndexFilterByBoostID(string $id): ?\Kirby\Cms\Page return \Bnomei\Bolt::page($id, $this); }, 'boost' => function () { + $page = $this; + // has boost? - if ($this->hasBoost() === false) { + if ($page->hasBoost() === false) { return false; } - $this->boostIndexAdd(); + + // if not has an id force one + $page = $page->forceNewBoostId(); + // needs write? $lang = kirby()->languageCode(); - $content = $this->readContentCache($lang); + $content = $page->readContentCache($lang); + + // add after cache was read and id exists + $page->boostIndexAdd(); + + // if needs write if (! $content) { // then write - return $this->writeContentCache($this->content()->toArray(), $lang); + return $page->writeContentCache($page->content()->toArray(), $lang); } return true; }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 19da3e5..906e0da 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,7 +1,7 @@ array( - 'pretty_version' => '1.7.0', - 'version' => '1.7.0.0', + 'pretty_version' => '1.7.1', + 'version' => '1.7.1.0', 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -20,8 +20,8 @@ 'dev_requirement' => false, ), 'bnomei/kirby3-boost' => array( - 'pretty_version' => '1.7.0', - 'version' => '1.7.0.0', + 'pretty_version' => '1.7.1', + 'version' => '1.7.1.0', 'type' => 'kirby-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(),