PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Quick Cache + Domain Mapping ?

Quick Cache Plugin. Speeds up WordPress®.

Quick Cache + Domain Mapping ?

Postby nickd32 » September 17th, 2011, 8:58 pm

I posted this question over at the WPMU DEV Forums as well, since it also involves their Domain Mapping plugin.

http://premium.wpmudev.org/forums/topic ... ost-132596


Many WPMU users have turned to the Quick Cache plugin for its built-in multisite features. I've noticed a problem however with the "Clear Cache Manually (this blog only)" button that it installs in the upper right of the WP dashboard.

SCREENSHOT: http://cl.ly/1Z1G2R140R0v0U470720

Let's say I have a Multisite network on MySites.com with a sub-blog called blog1.MySites.com, which is mapped to blog1.com

If you click the "clear cache" button while on blog1.com/wp-admin/ the cache clears just fine. . .
BUT, if you happen to be on blog1.MySites.com/wp-admin/, it doesn't clear the cache.

This is frustrating for users who aren't able to see their changes and can't figure out why the cache isn't clearing when they click the button.

Any ideas?

Is there a way to let Quick Cache know that these two (blog1.com and blog1.MySites.com) are the same?
User avatar
nickd32
Registered User
Registered User
 
Posts: 4
Joined: August 27, 2011

Re: Quick Cache + Domain Mapping ?

Postby Jason Caldwell » September 20th, 2011, 9:28 pm

I'm attaching a revised/development copy of this file.
/quick-cache/includes/classes/clearing-routines.inc.php
If you'd like to upload this file and let it override your existing copy, please let me know how it goes.
clearing-routines.inc.php.zip
(2.76 KiB) Downloaded 68 times
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Quick Cache + Domain Mapping ?

Postby nickd32 » September 22nd, 2011, 5:01 pm

Hi Jason,

I've replaced the file, but it doesn't seem to be working for me. When I click the "clear cache" button, the icon just keeps spinning, and the cache doesn't clear.

This is of course while I'm on the blog1.MySites.com/wp-admin/ link -- instead of the blog1.com/wp-admin/ link
User avatar
nickd32
Registered User
Registered User
 
Posts: 4
Joined: August 27, 2011

Re: Quick Cache + Domain Mapping ?

Postby nickd32 » September 22nd, 2011, 5:05 pm

I have reverted back to the original clearing-routines.inc.php file -- at least when I'm accessing the WP dashboard from the mapped domain (blog1.com/wp-admin/), and I click the "clear cache" button, the icon stops spinning.

With that new file, the icon would never stop spinning. Makes me think it was clearing the cache for the entire WPMU network or something.
User avatar
nickd32
Registered User
Registered User
 
Posts: 4
Joined: August 27, 2011

Re: Quick Cache + Domain Mapping ?

Postby mboynes » November 2nd, 2011, 1:00 pm

Greetings,
First off, thanks for a great plugin. I hope one day you use one of mine half as much as I use this so I can repay the awesomeness.

Second, I'm having this same issue. In looking through your code, it seems to be the best "global" fix would be to set the cache files by blog id instead of by domain. This way, if a site has multiple domains or if someone is using the domain mapper plugin and does not want the wordpress admin to redirect to the mapped domain, it will always work. If you'd like, I'd be happy to code up, test, and send it all back your way. I searched github to see if you have a repo there to facilitate this, but didn't find it -- do you have any mode of public collaboration I can use to get you the changes, or do you want me to just send you the changed files?

Thanks,
Matt Boynes
User avatar
mboynes
Registered User
Registered User
 
Posts: 2
Joined: November 2, 2011

Re: Quick Cache + Domain Mapping ?

Postby wholmes » December 31st, 2011, 4:01 pm

Has this issue been addressed? I'm having the same problem with Domain Mapping and QC. If anyone has a fix It's glady appreciated. Happy New Year!
User avatar
wholmes
Registered User
Registered User
 
Posts: 2
Joined: December 31, 2011

Re: Quick Cache + Domain Mapping ?

Postby nickd32 » December 31st, 2011, 6:48 pm

Agreed. I still need a fix. I like the solution posed by @mboynes -- setting cache files by blog ID instead of by domain.
User avatar
nickd32
Registered User
Registered User
 
Posts: 4
Joined: August 27, 2011

Re: Quick Cache + Domain Mapping ?

Postby mboynes » January 3rd, 2012, 9:27 am

Hey folks, here is a temporary fix that I've been using. It's far from ideal, but it's been doing the trick for me and works without touching the plugin code itself:


Code: Select all
add_action('ws_plugin__qcache_before_ajax_clear', 'dm_clear_routine_hook');
function dm_clear_routine_hook() {
   global $current_blog;
   $faux_blog = clone $current_blog;
   if (($nonce = $_POST["ws_plugin__qcache_ajax_clear"]) && wp_verify_nonce ($nonce, "ws-plugin--qcache-ajax-clear")) {
      if (function_exists('domain_mapping_siteurl') && is_object ($faux_blog) && $faux_blog->blog_id) {
         $faux_blog->domain = preg_replace('/https?:\/\//i', '', domain_mapping_siteurl(false));
         if (is_multisite () && !is_main_site () && $faux_blog && $faux_blog->domain && $faux_blog->domain != $current_blog->domain) {
            c_ws_plugin__qcache_purging_routines::purge_cache_dir ($faux_blog);
         }
      }
   }
}
User avatar
mboynes
Registered User
Registered User
 
Posts: 2
Joined: November 2, 2011


Return to Quick Cache Plugin

Who is online

Users browsing this forum: No registered users and 1 guest