I’ve built an auto-sync script that does the following:
- Cleanup the current location
- Copy Dynamic files such as uploads
- Backups the database from the target, do some replacement et restore it
The real script is the following:
echo Updating via SVN
export LC_ALL=fr_CA.UTF-8
svn up
echo Cleaning up the image and temp folder
rm -Rf wp-content/uploads/*
echo Copying files from production version
cp -R ../public_html/wp-content/uploads/* wp-content/uploads/
echo Importing wordpress database
mysqldump -u xxxyyyzzz --password=xxxyyyzzz xxxyyyzzz_db --skip-opt --add-drop-table --default-character-set=utf8 > temp.sql
sed 's/www.domain.com/preprod.domain.com/g' temp.sql > temp2.sql
mysql -u xxxyyyzzz --password=xxxyyyzzz xxxyyyzzz_preprod_db < temp2.sql
rm temp.sql
rm temp2.sql
echo Complete
The code up here works fine except for one small issue. When i load the WP-ADMIN from wordpress after synching the two projects (PROD > PREPROD) and i suspect it’ll do the same when i do PROD > STAGE and PROD > DEV, the admin control panel shoots me a “You’re database is out of date, we’ll upgrade it now” and many perma links are failing in the database when i browse the frontside of the site i synched.
Is there any wordpress guru out there that can tell me what i might be doing wrong? Is there a cache somewhere to update or clear.
List of pluggins installed:
- A few custom internal plugins that have nothing to do with it
- Advanted Custom Fields
- Gravity Forms
- Members by Justin Tadlock
- WordPress SEO by Joost de Valk
- WPML Multilingual CMS
- WPML String Translation
I hope someone knows…
Good luck to all
WordPress caches lots of information in the
wp_options
table using the Transients API. Clearing the cache may fix some problems.As MightyE said, the
sed
command won’t work on any serialized data, which many plugins use. I’m not sure of an easy way round this for all database tables.