wp-multi-network icon indicating copy to clipboard operation
wp-multi-network copied to clipboard

Sticky cache after changing a network's domain/path

Open kraftbj opened this issue 8 years ago • 2 comments

After changing the domain/path of a network via https://github.com/stuttter/wp-multi-network/blob/66ac5b8bb2c9082c49b0b06fc4830006a3151d5c/wp-multi-network/includes/functions.php#L634 , the old URL was still being populated via https://github.com/stuttter/wp-multi-network/blob/66ac5b8bb2c9082c49b0b06fc4830006a3151d5c/wp-multi-network/includes/metaboxes/edit-network.php#L22 until running wp_cache_flush.

We run clean_network_cache, which sounds like it should take care of it, but didn't. Still digging around on it.

kraftbj avatar Mar 20 '17 03:03 kraftbj

This has a secondary issue that can leave you in a weird situation.

  1. Change the network domain/path from example.com to example.coms.
  2. On the page reload, the cache will still display example.com for the network domain/path (though the individual subsites below will display .coms URL).
  3. Submit update, which has example.com still in error.
  4. The network domain/path accepts the change, but the individual subsites do not change. I think it is due to this conditional https://github.com/stuttter/wp-multi-network/blob/66ac5b8bb2c9082c49b0b06fc4830006a3151d5c/wp-multi-network/includes/functions.php#L688
  5. The result is the domain/path is set as example.com while the subsites are on .coms.

There is no way to retrigger the loop to update the domain on all subsites. If you edit it to, say, example.test, the subsites would update to example.tests. In this example, the s at the end of the URL would always remain.

To resolve, need to edit the db (_blogs and the specific blog's options table) to change the URL of the primary site to the correct domain, then you can update the others through the UI for each site.

kraftbj avatar Mar 20 '17 03:03 kraftbj

I've made a few modifications here.

Instead of calling refresh_blog_details() we are now calling clean_blog_cache() directly.

Curious if you have a better experience once 2.5.0 is released. 🙏

JJJ avatar Aug 25 '21 21:08 JJJ