[Resolved] CCTM and cookieless static content
Hi, I’ve been using this plugin on several sites for a long time and never had big issues.
For performance reasons and to speed up loading time I’m converting existing sites to a “Cookieless approach”. Quickly, the steps I followed for doing this are:
- Create an alias static.mywebsite.com that points to the same IP address of the main site “www.mywebsite.com”;
- Change some constants in wp-config.php:
- Perform some DB updates to change the existing references to not-static content.
Something like :
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.mywebsite.com/wp-content', 'http://static.mywebsite.com/wp-content'), post_excerpt = REPLACE(post_excerpt, 'http://www.mywebsite.com/wp-content', 'http://static.mywebsite.com/wp-content'), guid = REPLACE('guid', 'http://www.mywebsite.com/wp-content', 'http://static.mywebsite.com/wp-content');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://www.mywebsite.com/wp-content', 'http://static.mywebsite.com/wp-content');
Now everything worked fine and the difference in loading time is immediately visible (pages with lots of images loads about 50% faster) BUT all the Custom Content Types created with CCTM have disappeared!
I’ve restored everything with a backup and they got back.
I’m suspecting that I made something wrong with the MySql UPDATES, changing values that should not have been changed but I can’t figure out what.
Do you have an idea to address me in solving this? Thank you.
Wow, that’s a ballsy upgrade. I don’t think your edits there have anything to do with cookies per se, but no matter what you do, WP is still going to be fairly slow at its core, so it’s sorta like trying to strap a jet engine to a go-cart. The only kosher answer I can give is “be extremely careful when issuing queries against the database.” I’m glad you had a backup.
Probably what happened is that your options got corrupted. WP stores options as serialized data, which relies on a character count. So changing your domain name from a.com to b.com is ok, but a.com to ab.com is not (the character count changed = BOOM). This is one huge reason why WP is not really a “production ready” tool in my mind: it has severe restrictions like this and several important and fundamental attributes have no configuration settings. In other words, on a production ready application, you wouldn’t need to do the type of database edits you’re doing here, and even if you did, the application wouldn’t explode.
I built the CCTM’s import/export functionality specifically as workaround for the “serialization issue”.
See the last FAQ: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/FAQ
And if you want to really geek out: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomFieldsDataStructure
Thank You. I supposed that was something related to the change of options.
I managed to solve by reading to the FAQ and using Export/Import Tool and now it’s working as expected.
I agree with your opionion about storing/retrieving of serialized data on WP and I’ll take a deeper look at your wiki about CustomFieldsDataStructure.
- The topic ‘[Resolved] CCTM and cookieless static content’ is closed to new replies.