PhoenixKit.Modules.Publishing.Web.Controller.PostFetching (phoenix_kit v1.7.33)

Copy Markdown View Source

Post fetching functionality for the publishing controller.

Handles fetching posts from cache and filesystem, including:

  • Slug mode posts (versioned)
  • Timestamp mode posts (versioned and legacy)
  • Language fallback logic

Summary

Functions

Detect available language files in a directory.

Detect available languages in a timestamp post directory. Handles both versioned (files in v1/, v2/) and legacy (files in root) structures.

Fetch a legacy timestamp post (files directly in post directory). Falls back to primary language or first available if requested language isn't found.

Fetches a slug-mode post - iterates from highest version down, returns first published. Falls back to primary language or first available if requested language isn't found.

Fetches posts using cache when available, falls back to filesystem scan. On cache miss, regenerates cache synchronously for next request.

Fast path: Use cache to get metadata, only read content file.

Fetch a versioned timestamp post (files in v1/, v2/, etc.). Iterates from highest version down, returns first published version found. Falls back to primary language or first available if requested language isn't found.

List version numbers for a timestamp post directory.

Functions

detect_available_languages_in_dir(dir_path)

Detect available language files in a directory.

detect_available_languages_in_timestamp_dir(post_dir)

Detect available languages in a timestamp post directory. Handles both versioned (files in v1/, v2/) and legacy (files in root) structures.

fetch_legacy_timestamp_post(blog_slug, date, time, language, post_dir)

Fetch a legacy timestamp post (files directly in post directory). Falls back to primary language or first available if requested language isn't found.

fetch_post(blog_slug, arg, language)

Fetches a slug-mode post - iterates from highest version down, returns first published. Falls back to primary language or first available if requested language isn't found.

fetch_posts_with_cache(blog_slug)

Fetches posts using cache when available, falls back to filesystem scan. On cache miss, regenerates cache synchronously for next request.

fetch_timestamp_post_from_cache(blog_slug, date, time, language)

Fast path: Use cache to get metadata, only read content file.

fetch_versioned_timestamp_post(blog_slug, date, time, language, post_dir)

Fetch a versioned timestamp post (files in v1/, v2/, etc.). Iterates from highest version down, returns first published version found. Falls back to primary language or first available if requested language isn't found.

list_timestamp_versions(post_dir)

List version numbers for a timestamp post directory.