Skip to content

Optimize custom shortcode rendering#931

Merged
CySSoO merged 1 commit intomasterfrom
cyssoo/optimize-shortcode-rendering-in-everblocktools
Feb 2, 2026
Merged

Optimize custom shortcode rendering#931
CySSoO merged 1 commit intomasterfrom
cyssoo/optimize-shortcode-rendering-in-everblocktools

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Feb 2, 2026

Motivation

  • Avoid loading the full set of custom shortcodes for every render when the input text does not contain shortcode-like tokens or when the current shop/language has none configured.
  • Reduce DB and memory overhead by performing a lightweight pre-scan and querying only relevant shortcodes when needed.

Description

  • Gate shortcode processing in src/Service/EverblockTools.php so getEverShortcodes is only invoked when textHasPotentialShortcode() returns true and a per shop/lang has_shortcodes cache indicates shortcodes exist.
  • Add textHasPotentialShortcode(), extractShortcodeCandidates() and hasCustomShortcodes() helpers and change getEverShortcodes() to accept an array of candidate tokens and early-return when empty.
  • Add models/EverblockShortcode.php::getShortcodesByList() which performs a targeted DbQuery for matching shortcode tokens, builds EverblockShortcode instances and caches the result instead of loading all shortcodes.
  • Use EverblockCache for a EverblockTools_has_shortcodes_{shop}_{lang} presence cache and for caching getShortcodesByList() results to avoid repeated DB hits.

Testing

  • No automated tests were executed for this change.

Codex Task

@CySSoO CySSoO merged commit b2ee237 into master Feb 2, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant