feat: add settings construct cache

This will avoid the awkward recursive query for
each post by fetching cached post settings if available, and
caching them nicely.
This commit is contained in:
David Bailey 2023-12-20 18:54:31 +01:00
parent 94b65aec8c
commit 6cb60a6652
3 changed files with 56 additions and 35 deletions

View file

@ -71,12 +71,12 @@ class PostHandler extends MySQLAdapter {
if(basename($post_path) == "README.md") {
$readme_metadata = [];
if(isset($post_metadata['directory_data'])) {
$readme_metadata = $post_metadata['directory_data'];
}
if(isset($post_metadata['settings'])) {
$readme_metadata['settings'] = $post_metadata['settings'];
}
if(isset($post_metadata['directory_data'])) {
$readme_metadata = $post_metadata['directory_data'];
}
$this->update_or_create_post(dirname($post_path),
$readme_metadata, $post_content);