Skip to content

Commit 155bd4b

Browse files
committed
Fixed it for realsies
1 parent 63c32af commit 155bd4b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

microblog/index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ function loadPosts($limit = 5, $page = 1, $query = null) {
7272
}
7373
}
7474
if ($needBuild) {
75-
build_posts_index($postsDir, $indexPath);
75+
// build_posts_index returns the array it built; use it directly
76+
$index = build_posts_index($postsDir, $indexPath);
77+
} else {
78+
$index = @json_decode(@file_get_contents($indexPath), true) ?: [];
7679
}
7780

78-
$index = @json_decode(@file_get_contents($indexPath), true) ?: [];
79-
8081
// apply search filter on index (text field). limit query length to 200 chars
8182
if ($query) {
8283
$q = mb_substr(trim((string)$query), 0, 200);

0 commit comments

Comments
 (0)