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

Improve portability of advanced-cache.php #258

Closed
qeera opened this issue Aug 3, 2014 · 7 comments
Closed

Improve portability of advanced-cache.php #258

qeera opened this issue Aug 3, 2014 · 7 comments
Assignees
Milestone

Comments

@qeera
Copy link

qeera commented Aug 3, 2014

The latest update set a absolute path in advanced-cache.php on line
define('QUICK_CACHE_PLUGIN_FILE', '!ABSOLUTE_PATH!!/quick-cache.php');

This breaks the function if you move the wordpress to a other system. In My case develop on win and deploy it to linux.

Please try a bugfix with relative path or use something like:

define('QUICK_CACHE_PLUGIN_DIR', dirname(FILE) . '/plugins/quick-cache'); //[MS] 2014-08-03
if(!defined('QUICK_CACHE_PLUGIN_FILE'))
/**
* Plugin file path.
*
* @SInCE 140725 Reorganizing class members.
*
* @var string Absolute server path to QC plugin file.
*/
define('QUICK_CACHE_PLUGIN_FILE', QUICK_CACHE_PLUGIN_DIR . '/quick-cache.php'); //[MS] 2014-08-03

/*
 * Include shared methods between {@link advanced_cache} and {@link plugin}.
 */
require_once QUICK_CACHE_PLUGIN_DIR .'/includes/share.php'; //[MS] 2014-08-03
@raamdev raamdev added the invalid label Aug 5, 2014
@raamdev
Copy link
Contributor

raamdev commented Aug 5, 2014

@qeera The variables in advanced-cache.php are all set dynamically when you activate Quick Cache. If you look at includes/advanced-cache.tpl.php, you'll see the template file that is used. In there that line you mentioned with an absolute path actually looks like this:

define('QUICK_CACHE_PLUGIN_FILE', '%%QUICK_CACHE_PLUGIN_FILE%%');

The %%QUICK_CACHE_PLUGIN_FILE%% tag is replaced with the path detected by Quick Cache when you activate it.

If you move your WordPress site to a new system, you should delete wp-content/advanced-cache.php and then deactivate/reactivate Quick Cache on the new system, so that Quick Cache will automatically re-detect the correct path to the plugin and reinstall an updated wp-content/advanced-cache.php file.

@raamdev raamdev closed this as completed Aug 5, 2014
@jaswrks
Copy link

jaswrks commented Aug 5, 2014

@raamdev Maybe you already considered this, but perhaps we could use the ABSPATH constant to help make this more portable in a future release. Instead of hard-coding the entire absolute path, we could replace %%QUICK_CACHE_PLUGIN_FILE%% with ABSPATH.'/relative/path/to/quick-cache.php'

@raamdev
Copy link
Contributor

raamdev commented Aug 5, 2014

@jaswsinc But if we make that consideration, then we should make that consideration for everything else that's in wp-content/advanced-cache.php that might change from one system to another. Since the advanced-cache.php file is something that is generated by Quick Cache upon activation, it makes more sense to me to simply deactivate and reactivate Quick Cache after moving the system, if any of those variables might have changed.

I have nothing wrong with keeping things portable, I just think doing so will require a much larger consideration than just %%QUICK_CACHE_PLUGIN_FILE%%, which is a lot more work (and testing).

@jaswsinc If you think that's worth pursuing, I'll reopen this and mark it as a feature request.

@jaswrks
Copy link

jaswrks commented Aug 5, 2014

If you think that's worth pursuing, I'll reopen this and mark it as a feature request.

I think so, yes. Well, I should say... I think it's worth taking a closer look. Aside from this one Constant: QUICK_CACHE_PLUGIN_FILE, everything else inside of the auto-generated /advanced-cache.php is still quite portable (assuming the basic config values would remain the same from one site to another, such as the cache expiration time) and I think that's fairly common with Quick Cache, for the most part.

We prefix the configured cache directory with WP_CONTENT_DIR in this file, so prefixing the plugin file path with ABSPATH or WP_PLUGIN_DIR could help make it more portable. I actually considered doing this whenever I added that line awhile back, but I was too lazy to investigate further at the time. I will be happy to have a closer look at this however.

@raamdev
Copy link
Contributor

raamdev commented Aug 5, 2014

@jaswsinc OK, sounds good. I'll reopen this, mark it as an enhancement, and assign it to you. :) Thanks!

@raamdev raamdev reopened this Aug 5, 2014
@raamdev raamdev changed the title Bug with absulute path in latetst update Improve portability of advanced-cache.php Aug 5, 2014
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 5, 2014
jaswrks pushed a commit that referenced this issue Aug 5, 2014
@jaswrks
Copy link

jaswrks commented Aug 5, 2014

Resolved in the feature/258 branch.

@raamdev
Copy link
Contributor

raamdev commented Aug 5, 2014

@jaswsinc Thanks so much!

Closed by PR #263.

@raamdev raamdev closed this as completed Aug 5, 2014
@raamdev raamdev added this to the Next Release milestone Aug 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants