Skip to content

Improve cache clearing and add logging#870

Open
giuscris wants to merge 5 commits into2.xfrom
feature/improved-cache-clear
Open

Improve cache clearing and add logging#870
giuscris wants to merge 5 commits into2.xfrom
feature/improved-cache-clear

Conversation

@giuscris
Copy link
Member

@giuscris giuscris commented Mar 1, 2026

This pull request enhances cache management across both CLI and Panel interfaces by introducing unified cache clearing logic, adding support for clearing the config cache, and improving logging and user feedback. It also updates translations to support new cache operations.

Cache clearing logic and features:

  • Refactored cache clearing in both CacheCommand (CLI) and CacheController (Panel) to use a new clearCaches method, allowing multiple cache types (pages, images, config) to be cleared in a single call. (formwork/src/Commands/CacheCommand.phpL106-R127, Fa742de5L22R64)
  • Added support for clearing the config cache via the CLI and Panel, including a new static clearCache method in ConfigServiceLoader for consistent cache directory handling. [1] [2] [3] Fa742de5L101R101)
  • Updated the dashboard frontend to add buttons and event handlers for clearing the config cache and all caches at once. [1] [2]

Logging and feedback improvements:

  • Integrated logging for cache clearing actions in both CLI and Panel, including details about which caches were cleared and, in the Panel, by which user. [1] [2] Fa742de5L22R64)

Internationalization:

  • Updated translation files in all supported languages to include new strings for clearing and confirming clearing of all caches and the config cache. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

@giuscris giuscris requested a review from Copilot March 1, 2026 20:53
@giuscris giuscris self-assigned this Mar 1, 2026
@giuscris giuscris added the enhancement New feature or request label Mar 1, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances cache management across the CLI and Panel by unifying cache-clearing logic, adding support for clearing the config cache, and improving user-facing feedback and logging.

Changes:

  • Refactors CLI (CacheCommand) and Panel (CacheController) cache clearing to use a shared “clear multiple cache types” approach.
  • Adds config cache clearing support via a shared ConfigServiceLoader::clearCache() implementation.
  • Updates the Panel dashboard UI and translations to expose “clear config cache” and “clear all caches” actions.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
panel/views/dashboard/index.php Adds new dashboard dropdown actions for clearing config cache and all caches.
panel/src/ts/components/views/dashboard.ts Wires new dashboard actions to POST the appropriate cache-clear requests.
formwork/src/Services/Loaders/ConfigServiceLoader.php Centralizes config cache path and introduces clearCache() helper.
formwork/src/Panel/Controllers/CacheController.php Adds multi-cache clearing (pages/images/config) and logging for Panel-triggered operations.
formwork/src/Commands/CacheCommand.php Adds multi-cache clearing (pages/images/config) and CLI logging.
panel/translations/en.yaml Adds new translation strings for config/all cache operations.
panel/translations/de.yaml Adds new translation strings for config/all cache operations.
panel/translations/el.yaml Adds new translation strings for config/all cache operations.
panel/translations/es.yaml Adds new translation strings for config/all cache operations.
panel/translations/fr.yaml Adds new translation strings for config/all cache operations.
panel/translations/hu.yaml Adds new translation strings for config/all cache operations.
panel/translations/it.yaml Adds new translation strings for config/all cache operations.
panel/translations/nl.yaml Adds new translation strings for config/all cache operations.
panel/translations/pl.yaml Adds new translation strings for config/all cache operations.
panel/translations/pt.yaml Adds new translation strings for config/all cache operations.
panel/translations/ro.yaml Adds new translation strings for config/all cache operations.
panel/translations/ru.yaml Adds new translation strings for config/all cache operations.
panel/translations/sv.yaml Adds new translation strings for config/all cache operations.
panel/translations/tr.yaml Adds new translation strings for config/all cache operations.
panel/translations/uk.yaml Adds new translation strings for config/all cache operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@giuscris giuscris added this to the 2.4.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants