Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit 25843b1

Browse files
committed
🐛 boost for file was resolving parent
Signed-off-by: bnomei <[email protected]>
1 parent 9b39602 commit 25843b1

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bnomei/kirby3-boost",
33
"type": "kirby-plugin",
4-
"version": "2.4.0",
4+
"version": "2.4.1",
55
"description": "Boost the speed of Kirby by having content files of files/pages/users cached, with fast lookup based on uuid.",
66
"license": "MIT",
77
"authors": [

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function boost($id)
7575
// since that is faster than letting kirby core do it
7676
// FileUuuid::findByCache() would resolve so we do it manually
7777
if ($uuid = FileUuid::for($schema . '://' . $id) ) {
78-
$value = $uuid->value();
78+
// $value = $uuid->value(); // would resolve parent
79+
$value = Uuids::cache()->get($uuid->key());
7980
if (!$value) {
8081
return null;
8182
}

tests/BoostTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,23 @@ public function testNonTranslatable()
158158
public function testBoostCanLoadFile() {
159159
$fileUuid = 'file://hp4IB3c6UxKODRyK';
160160
$time = microtime(true);
161-
$file = boost($fileUuid);
161+
$c = 10000;
162+
while ($c > 0) {
163+
$file = boost($fileUuid);
164+
$c--;
165+
}
162166
echo 'boost(): ' . (microtime(true) - $time) . PHP_EOL;
163167
$this->assertEquals($file->uuid()->toString(), $fileUuid);
164168
}
165169

166170
public function testKirbyCanLoadFile() {
167171
$fileUuid = 'file://hp4IB3c6UxKODRyK';
168172
$time = microtime(true);
169-
$file = site()->file($fileUuid);
173+
$c = 10000;
174+
while ($c > 0) {
175+
$file = site()->file($fileUuid);
176+
$c--;
177+
}
170178
echo 'site()->file(): ' . (microtime(true) - $time) . PHP_EOL;
171179
$this->assertEquals($file->uuid()->toString(), $fileUuid);
172180
}

vendor/composer/installed.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php return array(
22
'root' => array(
33
'name' => 'bnomei/kirby3-boost',
4-
'pretty_version' => '2.4.0',
5-
'version' => '2.4.0.0',
4+
'pretty_version' => '2.4.1',
5+
'version' => '2.4.1.0',
66
'reference' => NULL,
77
'type' => 'kirby-plugin',
88
'install_path' => __DIR__ . '/../../',
@@ -11,8 +11,8 @@
1111
),
1212
'versions' => array(
1313
'bnomei/kirby3-boost' => array(
14-
'pretty_version' => '2.4.0',
15-
'version' => '2.4.0.0',
14+
'pretty_version' => '2.4.1',
15+
'version' => '2.4.1.0',
1616
'reference' => NULL,
1717
'type' => 'kirby-plugin',
1818
'install_path' => __DIR__ . '/../../',

0 commit comments

Comments
 (0)