Skip to content

Make cache directory configurable like other dirs - #237

Merged
shadoath merged 1 commit into
ConnectThink:masterfrom
matt-bernhardt:197-cache-location
Jan 16, 2023
Merged

shadoath merged 1 commit into
ConnectThink:masterfrom
matt-bernhardt:197-cache-location

Conversation

@matt-bernhardt

Copy link
Copy Markdown
Contributor

Why are these changes being introduced:

  • Some environments deny plugins the ability to create and maintain a cache internally, but other locations (like the uploads directory) may be okay.
  • The plugin already allows the ability to configure the scss and css folders, so perhaps the cache directory could be treated similarly.

Relevant ticket(s):

How does this address that need:

  • This attempts to handle the cache directory in a similar fashion to the scss and css directory, leveraging the work already done to move those locations according to user preferences.
  • I've tested this change by deploying this update within a Pantheon application, and it appears to work correctly - but I'm not sure how to confirm whether the fix works more repeatedly elsewhere.

Document any side effects to this change:

  • The Wp_Scss class uses cache instead of cache_dir, while the other folders are named scss_dir and css_dir. I've opted to leave these names intact to try and make the smallest possible change, but this may be a mistake.

** Why are these changes being introduced:

* Some environments deny plugins the ability to create and maintain a
  cache internally, but other locations (like the uploads directory)
  may be okay.
* The plugin already allows the ability to configure the scss and css
  folders, so perhaps the cache directory could be treated similarly.

** Relevant ticket(s):

* ConnectThink#197

** How does this address that need:

* This attempts to handle the cache directory in a similar fashion to
  the scss and css directory, leveraging the work already done to move
  those locations according to user preferences.

** Document any side effects to this change:

* The Wp_Scss class uses `cache` instead of `cache_dir`, while the
  other folders are named `scss_dir` and `css_dir`. I've opted to leave
  these names intact to try and make the smallest possible change, but
  this may be a mistake.
@shadoath

Copy link
Copy Markdown
Collaborator

I like the idea of cache_dir, but your side-effect point is valid. To do this, it would require a migration script.

@matt-bernhardt

Copy link
Copy Markdown
Contributor Author

Do you feel comfortable merging this as-is, or would you prefer to see a PR that implements a migration script for upgrading users? I'm not sure what sort of bandwidth I can commit to that work (I have some time, but don't know whether it will be sufficient for that piece of work). I've never looked into how WordPress plugins implement migration scripts - but I suspect the documentation is out there.

Obviously I'm happy for others to build on this, as well if I can't do it.

@shadoath

Copy link
Copy Markdown
Collaborator

Upon further reflection. I don’t see a need for a migration script. It will default to the same value it had before.

My request would be that we make the change from ‘cache’ to ‘cache_dir’ throughout the code.

I still need to test out the new setting option. To see if it is best to leave as an open text field or make it a drop-down select.

@shadoath
shadoath self-requested a review December 14, 2022 22:55
@shadoath

Copy link
Copy Markdown
Collaborator

Merging this in, I'll test and then make any needed minor adjustments before pushing up a new version.

@shadoath
shadoath merged commit 3768809 into ConnectThink:master Jan 16, 2023
@matt-bernhardt
matt-bernhardt deleted the 197-cache-location branch March 7, 2023 18:47
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.

2 participants