]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Cleanup and adapt to drupal 8
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 4 Jan 2016 18:51:12 +0000 (16:51 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 4 Jan 2016 18:51:12 +0000 (16:51 -0200)
files/drupal

index b2587fbddd8734c8b7ba7f55b057860954719797..8b69c842070ccbe343fb7d79751c41b9e7fee7c5 100755 (executable)
@@ -5,7 +5,7 @@
 
 BASE=${BASE:="/var/www/data"}
 SITES=${SITES:="$BASE/drupal"}
-SERIES="5 6 7"
+SERIES="6 7 8"
 
 # Ensure we have a proper path, useful when called through cron
 export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
@@ -99,6 +99,8 @@ function drupal_iterate {
     done
   
     # Fix permissions
+    chown -R root.root $base/modules
+    chown -R root.root $base/themes
     if [ -e "$base/sites/all/modules" ]; then
       chown -R root.root $base/sites/all/modules
     fi
@@ -178,6 +180,7 @@ function drupal_upgrade {
   old_major="`drupal_get_major $old`"
   new_major="`drupal_get_major $new`"
   extra_folders=""
+  drupal_series="$new_major"
   
   if [ "$old_major" != "$new_major" ]; then
     echo "Major versions doesn't match"
@@ -187,21 +190,6 @@ function drupal_upgrade {
   drupal_check_existing $new
   drupal_check_not_existing $old
   
-  # Set drupal series
-  if [ "$new_major" == "4" ]; then
-    # Get minor versions
-    new_minor="`echo $new | sed -e "s/^$new_major\.//"`"
-    old_minor="`echo $old | sed -e "s/^$old_major\.//"`"
-  
-    if [ "$old_minor" != "$new_minor" ]; then
-      echo "Minor versions doesn't match"
-      exit 1
-    fi
-    drupal_series="$new_major.$new_minor"
-  else
-    drupal_series="$new_major"
-  fi
-  
   cd $BASE
   
   # Deploy a fresh drupal tree
@@ -211,7 +199,7 @@ function drupal_upgrade {
   cd $BASE/drupal-$new
 
   # Copy files
-  for file in .htaccess favicon.ico files sites; do
+  for file in .htaccess sites; do
     if [ ! -h "../drupal-$old/$file" ]; then
       cp -a ../drupal-$old/$file . &> /dev/null
     else
@@ -227,31 +215,15 @@ function drupal_upgrade {
     fi
   done
   
-  # Legacy stuff for Drupal 4.x.x
-  if [ "$new_major" == "4" ]; then
-    rsync -av ../drupal-$old/themes/ themes/
-    for module in `ls ../drupal-$old/modules`; do
-      if [ -d "../drupal-$old/modules/$module" ]; then
-        cp -Rp ../drupal-$old/modules/$module modules/
-      fi
-    done
-  fi
-  
-  # Copy installation profiles for Drupal 5.x or newer
-  if [ "$new_major" != "4" ]; then
-    rsync -av --exclude=default ../drupal-$old/profiles/ profiles/
-  fi
+  # Copy installation profiles
+  rsync -av --exclude=default ../drupal-$old/profiles/ profiles/
 
-  # Misc: copy image.imagemagick.inc to includes/ folder
-  if [ -e "../drupal-$old/sites/all/modules/image/image.imagemagick.inc" ]; then
-    cp ../drupal-$old/sites/all/modules/image/image.imagemagick.inc includes/
+  # Copy installation themes and modules for Drupal 8 or newer
+  if [ "$new_major" != "5" ] && [ "$new_major" != "6" ] && [ "$new_major" != "7" ]; then
+    rsync -av ../drupal-$old/modules/ modules/
+    rsync -av ../drupal-$old/themes/  themes/
   fi
 
-  # Modules that need stuff in the root folder
-  if [ -d "sites/all/modules/chatroom" ]; then
-    ln -s sites/all/modules/chatroom/chatroomread.php
-  fi
-  
   # Change symlink to point to the new location
   cd $BASE ; rm -rf drupal-$drupal_series && ln -s drupal-$new drupal-$drupal_series
 
@@ -287,24 +259,6 @@ function drupal_make {
   fi
 }
 
-# Run the video scheduler
-function drupal_video_scheduler {
-  if [ -z "$2" ]; then
-    echo "Usage: `basename $0` video-scheduler <site> <series>"
-    exit 1
-  fi
-
-  site="$1"
-  version="$2"
-  drupal_folder="$BASE/drupal-$version"
-  scheduler="$drupal_folder/sites/all/modules/video/video_scheduler.php"
-  site_folder="$drupal_folder/sites/$site"
-
-  if [ -f "$scheduler" ] && [ -e "$site" ]; then
-    php $scheduler -r $drupal_folder -s $site
-  fi
-}
-
 # Install a new instance
 function drupal_install {
   if [ -z "$2" ]; then
@@ -413,7 +367,7 @@ EOF
 
 # Main procedure
 if [ -z "$1" ]; then
-  echo "Usage: `basename $0` <cron|download|update|updatedb|upgrade|run|make|video-scheduler|install> [arguments]"
+  echo "Usage: `basename $0` <cron|download|update|updatedb|upgrade|run|make|install> [arguments]"
   exit 1
 elif [ "$1" == "cron" ]; then
   drupal_iterate cron
@@ -444,9 +398,6 @@ elif [ "$1" == "run" ]; then
 elif [ "$1" == "make" ]; then
   shift
   drupal_make $*
-elif [ "$1" == "video-scheduler" ]; then
-  shift
-  drupal_video_scheduler $*
 elif [ "$1" == "install" ]; then
   shift
   drupal_install $*