From a8b4b5b0d1037a649f391df812635ecf21b8f21b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 4 Jan 2016 16:51:12 -0200 Subject: Cleanup and adapt to drupal 8 --- files/drupal | 73 ++++++++++-------------------------------------------------- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/files/drupal b/files/drupal index b2587fb..8b69c84 100755 --- a/files/drupal +++ b/files/drupal @@ -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 " - 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` [arguments]" + echo "Usage: `basename $0` [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 $* -- cgit v1.2.3