]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Introducing drupal_update function
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 15 Nov 2012 13:34:27 +0000 (11:34 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 15 Nov 2012 13:34:27 +0000 (11:34 -0200)
templates/drupal.sh.erb

index 84843b8a53d5a3a7ca2000821a8ce3090c147f01..06754c81f06cad0d929bbd272cfb68e2bbcf575d 100644 (file)
@@ -82,7 +82,12 @@ function drupal_iterate {
           if [ "$1" != "cron" ] && [ "$SILENT" != "yes" ]; then
             echo "Processing $drupal..."
           fi
-          drush -l $drupal $*
+
+          if [ "$1" == "update" && "$1" == "cron-update" ]; then
+            drupal_update $1 $drupal
+          else
+            drush -l $drupal $*
+          fi
         fi
       fi
     done
@@ -97,6 +102,22 @@ function drupal_iterate {
   done
 }
 
+# Update a drupal instance
+function drupal_update {
+  local method="$1"
+  local instance="$2"
+  local pipe
+
+  if [ "$method" == "" ]; then
+    pipe="--pipe"
+  fi
+
+  # See https://drupal.org/node/823146#comment-3319070
+  # Also, avoid automated core updates
+  drush -l $instance up -u 1 --pipe | grep -v -E '^drupal|Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK' \
+    | cut -d " " -f1 | xargs drush up -u 1 -y $pipe
+}
+
 # Deploy a fresh drupal tree
 function drupal_deploy {
   if [ -z "$1" ]; then
@@ -375,7 +396,7 @@ elif [ "$1" == "cron" ]; then
 elif [ "$1" == "cron-update" ]; then
   SILENT="yes"
   drupal_iterate pm-refresh &> /dev/null
-  drupal_iterate pm-update -y -p | grep -v -E 'Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK'
+  drupal_iterate pm-update
 elif [ "$1" == "deploy" ]; then
   shift
   drupal_deploy $*