]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Adding cron handling into drupal script
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 9 Mar 2010 19:47:39 +0000 (16:47 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 9 Mar 2010 19:47:39 +0000 (16:47 -0300)
templates/drupal.sh.erb

index 26060fd47b67b85d3b34cbd1cf45e1865b1d8c3b..3a10864dde5b1378d44bceb1fe0a30e00a02a9a8 100644 (file)
@@ -14,36 +14,13 @@ function drupal_get_major {
 # Check for existing installations
 function drupal_check_existing {
   if [ -e "$BASE/drupal-$1" ]; then
-    echo "Folder $BASE/drupal-$1 already exist, skipping"
+    echo "Folder $BASE/drupal-$1 already exists, skipping"
     exit 1
   fi  
 }
 
-# Deploy a fresh drupal tree
-function drupal_deploy {
-  if [ "$#" != "1" ]; then
-    echo "Usage: `basename $0` deploy <version>"
-    exit 1
-  fi
-
-  # Setup
-  new="$1"
-  cd $BASE
-  drupal_check_existing $new
-
-  # Deploy a fresh drupal tree
-  wget http://ftp.drupal.org/files/projects/drupal-$new.tar.gz
-  tar zxvf drupal-$new.tar.gz && rm drupal-$new.tar.gz
-  chown -R root.root drupal-$new/
-  cd drupal-$new && rm -rf sites
-}
-
-# Update all drupal instances in the host
-function drupal_update {
-  if [ -z "$update" ]; then
-    update="update"
-  fi
-
+# Iterate through all drupal instances
+function drupal_iterate {
   for version in $SERIES; do
     # Setup base folder
     base="$BASE/drupal-$version"
@@ -61,7 +38,7 @@ function drupal_update {
       # Ignore symlinks so sites are updated just once
       if [ ! -h "$drupal" ] || [ ! -h "`readlink $drupal`" ]; then
         echo "Processing $drupal..."
-        drush -l $drupal $update
+        drush -l $drupal $*
       fi
     done
   
@@ -75,6 +52,25 @@ function drupal_update {
   done
 }
 
+# Deploy a fresh drupal tree
+function drupal_deploy {
+  if [ "$#" != "1" ]; then
+    echo "Usage: `basename $0` deploy <version>"
+    exit 1
+  fi
+
+  # Setup
+  new="$1"
+  cd $BASE
+  drupal_check_existing $new
+
+  # Deploy a fresh drupal tree
+  wget http://ftp.drupal.org/files/projects/drupal-$new.tar.gz
+  tar zxvf drupal-$new.tar.gz && rm drupal-$new.tar.gz
+  chown -R root.root drupal-$new/
+  cd drupal-$new && rm -rf sites
+}
+
 # Upgrade a drupal instance using upstream source.
 function drupal_upgrade {
   if [ "$#" != "2" ]; then
@@ -150,18 +146,19 @@ function drupal_upgrade {
 
 # Main procedure
 if [ -z "$1" ]; then
-  echo "Usage: `basename $0` <deploy|update|upgrade> [arguments]"
+  echo "Usage: `basename $0` <cron|deploy|update|updatedb|upgrade> [arguments]"
   exit 1
+elif [ "$1" == "cron" ]; then
+  drupal_iterate cron
 elif [ "$1" == "deploy" ]; then
   shift
   drupal_deploy $*
 elif [ "$1" == "update" ]; then
   shift
-  drupal_update $*
+  drupal_iterate update $*
 elif [ "$1" == "updatedb" ]; then
   shift
-  update="updatedb"
-  drupal_update $*
+  drupal_iterate updatedb $*
 elif [ "$1" == "upgrade" ]; then
   shift
   drupal_upgrade $*