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

allow $cache_dir & $settings_dir to be overriden with constants #231

Closed
wants to merge 4 commits into from

Conversation

Dynamo6Dev
Copy link

Re issue #226

@coreykn coreykn self-requested a review April 16, 2021 18:30
Copy link
Contributor

@coreykn coreykn left a comment

Choose a reason for hiding this comment

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

Let's define CACHE_ENABLER_CACHE_DIR and CACHE_ENABLER_SETTINGS_DIR in cache-enabler.php instead, like how CACHE_ENABLER_DIR is done. (These new statements can go below the one for CACHE_ENABLER_DIR.)

@coreykn coreykn linked an issue Apr 16, 2021 that may be closed by this pull request
Replaced ternary operator statements with constants
Added default values for new constants here
Update cache-enabler.php
@Dynamo6Dev
Copy link
Author

No worries, thats updated now

@coreykn
Copy link
Contributor

coreykn commented Apr 19, 2021

Oops! I just realized I had made a mistake in my first review. When the advanced-cache.php drop-in is included by WordPress (based on if WP_CACHE is true), the Cache Enabler plugin (or any plugin for that matter) isn't loaded yet, meaning cache-enabler.php hasn't been loaded. That means the default constant wouldn't be defined yet. The change I requested won't work. I sincerely apologize for that oversight. However, the way you initially proposed won't work either because if a class property has an initialization it must be constant, which means the ternary operator in this declaration would cause a fatal error.

This is bringing up some memories of the limitations for why I didn't make those paths customizable yet. Let's close this for now while leaving the linked issue open as I'd like to introduce this control but I need to think of how to best approach it and what may need to change to support it. On the top of my head I'm thinking I will first explore a new way to handle the define statements for our constants so it doesn't rely on Cache Enabler being initialized. I will also explore if what was proposed in #229 would be a good way of handling this. If you or anyone else has ideas on a good approach please feel free to share.

@coreykn coreykn closed this Apr 19, 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.

Change cache and settings paths
2 participants