Auto sync of a wordpress database requires updating it

I’ve built an auto-sync script that does the following:

  1. Cleanup the current location
  2. Copy Dynamic files such as uploads
  3. Backups the database from the target, do some replacement et restore it

The real script is the following:

Read More
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:

  1. A few custom internal plugins that have nothing to do with it
  2. Advanted Custom Fields
  3. Gravity Forms
  4. Members by Justin Tadlock
  5. WordPress SEO by Joost de Valk
  6. WPML Multilingual CMS
  7. WPML String Translation

I hope someone knows…

Good luck to all

Related posts

Leave a Reply

1 comment

  1. WordPress caches lots of information in the wp_options table using the Transients API. Clearing the cache may fix some problems.

    DELETE FROM 'wp_options' WHERE 'option_name' LIKE '_transient_%'
    

    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.