Create a wordpress test-system as a clone from productive system
For our WordPress-website, I wanted to create a test instance - to test WordPress-updates/plugin updates and new developments on the theme and so on ...
so i wrote a script to copy the database and the files:
sourcedir="/srv/www/htdocs/www.example.de"
testdir="/srv/www/htdocs/test.example.de"
workdir="/data/example.de_test-system"
sqldumpfile="$workdir/mysql_dump_example_wp2017.sql"
echo "delete webroot test.example.de"
rm -rf $testdir
echo "www.example.de nach test.example.de kopieren"
cp -R $sourcedir $testdir
echo "cache-verzeichnisse leeren"
rm -rf $testdir/wp-content/cache/minify
rm -rf $testdir/wp-content/cache/db
rm -rf $testdir/wp-content/cache/object
rm -rf $testdir/wp-content/cache/page_enhanced
rm -rf $testdir/wp-content/cache/tmp
echo "alten dump loeschen"
rm -f $sqldumpfile
echo "aktuellen Dump aus DB ziehen"
mysqldump -u root --password=xxx example_wp_2017 $sqldumpfile
echo "dump bearbeiten - www.example.de gegen test.example.de ersetzen"
sed -i s/www.example.de/test.example.de/g $sqldumpfile
echo "bearbeiteten dump in test-DB einspielen"
mysql -u root --password=xxx example_wp_2017_test $sqldumpfile
echo "test-config einspielen"
cp /data/example.de_test-system/wp-config.php $testdir
echo "www-nutzer-rechte auf test.example.de setzen"
chown -R wwwrun $testdir
chgrp -R www $testdir
the script will copy the WordPress-folder, empty cache folders, dump the database and find/replace entries of the productive system with test-system and import the dump to the database - finally, copy the test-config to the test folder
this works, but I got some strange errors - like a logo image, where it displays a placeholder image instead
the meta-navigation is missing
and in the backend, some points in the left navigation are missing - like the custom post types
am I missing some things in my script?
Topic clone-site custom-post-types themes Wordpress
Category Web