Archive for October, 2009

Setting the Timezones across all VPS’s (OpenVZ)

All of our servers are currently based off of the Phoenix, Arizona, USA Timezone. This script allows this conversion from each HN (Host Node):

 
#!/bin/bash
for f in `ls /vz/private`
do
  vzctl exec $f rm -f /etc/localtime 2>/dev/null
  vzctl exec $f ln -s /usr/share/zoneinfo/America/Phoenix /etc/localtime
done

Moving a WordPress Install from one Domain (A) to another Domain (B)

From time to time I had have to move one installation of WordPress from one domain (let’s call it domain A) to a new domain (let’s call it domain B). Because WordPress embeds the domain all over the data schema (not faulting; simply disclosing) you have to make a lot of dB changes for the updated site location to function. Here is the quick and dirty way to move the data:

UPDATE wp_posts SET post_content = REPLACE(post_content,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_posts SET guid = REPLACE(guid,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_options SET option_value = REPLACE(option_value,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,"[OLD_DOMAIN]","[NEW_DOMAIN]");

Finally, for the final bit of trickery if you are using Advanced Caching on the site there is a great place where the localized PATH is hard coded. Edit your new and updated path on file advanced-cache.php

vi wp-content/advanced-cache.php