Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes duplication of cache clearing #2738

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

luceos
Copy link
Member

@luceos luceos commented Mar 24, 2021

Changes proposed in this pull request:

This PR removes the duplicated cache clearing of the locales. The locales are cleared using the cache:clear command which is centrally dispatched from the CacheClear command. Using an listener on the ClearingCache event causes extensions to fail to do stuff with locales.

Eg:

  • extension listens on ClearingCache to run cache:assets to create locales ahead of next visit
  • LocaleServiceProvider, executed last, removes those files immediately

Ref: https://github.com/flarum/core/blob/d642fb531c1335c33ff7515da367f6815ea93b12/src/Foundation/Console/CacheClearCommand.php#L69

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

Copy link
Sponsor Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

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

Makes sense to me! I would eventually like to see caches move to a unified system ala https://github.com/flarum/core/issues/2727#issuecomment-805774878, but that's a matter for another release.

src/Locale/LocaleManager.php Outdated Show resolved Hide resolved
@askvortsov1 askvortsov1 self-requested a review March 25, 2021 15:17
@davwheat
Copy link
Member

davwheat commented Apr 3, 2021

2 approvals. Anything I'm missing or is this good to merge?

@SychO9 SychO9 merged commit 0074f0c into master Apr 7, 2021
@SychO9 SychO9 deleted the dk/locale-duplicate-cache-clearing branch April 7, 2021 16:29
@askvortsov1 askvortsov1 added this to the 0.1 milestone Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants