From 0d1dcfcfd51c53555cf736cd944ce3a3bf475b7b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 5 Jan 2012 14:13:40 -0200 Subject: Fixing themes and plugins copy on upgrade --- templates/wordpress.sh.erb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/templates/wordpress.sh.erb b/templates/wordpress.sh.erb index cfcbd9e..05ab928 100644 --- a/templates/wordpress.sh.erb +++ b/templates/wordpress.sh.erb @@ -78,22 +78,32 @@ function wordpress_upgrade { cp -a wordpress-$old/$file wordpress-$new/ fi done + + # Extra folders for extra_folder in $extra_folders; do if [ -d ../wordpress-$old/$extra_folder ]; then cp -Rp ../wordpress-$old/$extra_folder . fi done - # Exclusions - exclude_plugins="--exclude=akismet --exclude=hello.php --exclude=index.php" - exclude_themes="--exclude=index.php --exclude=twentytwelve --exclude=twentyeleven --exclude=twentyten" - - # Files, Plugins and Themes + # Files rsync -av wordpress-$old/wp-content/uploads/ wordpress-$new/wp-content/uploads/ rsync -av wordpress-$old/wp-content/blogs.dir/ wordpress-$new/wp-content/blogs.dir/ - rsync -av $exclude_plugins wordpress-$old/wp-content/plugins/ wordpress-$new/wp-content/plugins/ - rsync -av $exclude_themes wordpress-$old/wp-content/themes/ wordpress-$new/wp-content/themes/ - + + # Plugins + for plugin in `ls wordpress-$old/wp-content/plugins/`; do + if [ ! -e "wordpress-$new/wp-content/plugins/$plugin" ]; then + cp -r wordpress-$old/wp-content/plugins/$plugin wordpress-$new/wp-content/plugins/ + fi + done + + # Themes + for theme in `ls wordpress-$old/wp-content/themes/`; do + if [ ! -e "wordpress-$new/wp-content/themes/$theme" ]; then + cp -r wordpress-$old/wp-content/themes/$theme wordpress-$new/wp-content/themes/ + fi + done + # Fix permissions chown -R root.root wordpress-$new/wp-content/{plugins,themes} -- cgit v1.2.3