From e9cff8c1551d6ad967ae3b7da772d81a05eee8c6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 14 Nov 2012 20:30:44 -0200 Subject: Storing per-action hashes at drupal_iterate and other enhancements --- templates/drupal.sh.erb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb index 51a10d5..8e419ae 100644 --- a/templates/drupal.sh.erb +++ b/templates/drupal.sh.erb @@ -50,6 +50,14 @@ function drupal_check_not_existing { # Iterate through all drupal instances function drupal_iterate { + if [ -z "$1" ]; then + return + fi + + if [ "$SILENT" != "yes" ]; then + echo "Issuing $1 in all installed instances..." + fi + for version in $SERIES; do # Setup base folder base="$BASE/drupal-$version" @@ -69,8 +77,8 @@ function drupal_iterate { if [ -e "$drupal/settings.php" ]; then hash="`sha1sum $drupal/settings.php | cut -d ' ' -f 1`" # Process sites just once, avoiding symlinks - if echo $settings_hash | grep -q -v $hash; then - settings_hash="$settings_hash-$hash" + if echo $settings_hash | grep -q -v "$1:$hash"; then + settings_hash="$settings_hash-$1:$hash" if [ "$1" != "cron" ] && [ "$SILENT" != "yes" ]; then echo "Processing $drupal..." fi @@ -366,14 +374,14 @@ elif [ "$1" == "cron" ]; then drupal_iterate cron elif [ "$1" == "cron-update" ]; then SILENT="yes" - drupal_iterate pm-refresh $* &> /dev/null + drupal_iterate pm-refresh &> /dev/null drupal_iterate -y -p pm-update | grep -v -E 'Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK' elif [ "$1" == "deploy" ]; then shift drupal_deploy $* elif [ "$1" == "update" ]; then shift - drupal_iterate pm-refresh $* + drupal_iterate pm-refresh drupal_iterate pm-update $* # Update alone might not trigger updatedb in a farm for all instances. -- cgit v1.2.3