Scripts (Drupal): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
(Nieuwe pagina aangemaakt met 'Ik werk graag met ''scripts'': * '''Herhaalbaarheid & uitbreidbaarheid:''' Als een procedure eenmaal in een script is vastgelegd, kan het - binnen bepaalde grenzen...')
 
Regel 4: Regel 4:
 
* '''Consistentie:''' Gerelateereed aan ''herhaalbaarheid'': Als eens script het eenmaal doet, kan ik er min-of-meer op vertrouwen dat het de volgende keer op dezelfde manier werkt
 
* '''Consistentie:''' Gerelateereed aan ''herhaalbaarheid'': Als eens script het eenmaal doet, kan ik er min-of-meer op vertrouwen dat het de volgende keer op dezelfde manier werkt
 
* '''Zelfdocumenterend:''' Na een kwartiertje muizen weet ik doorgaans al niet meer wat ik precies heb gedaan. Met scripts heb ik dat probleem niet. Als ik vervolgens de discipline kan opbrengen om steeds met bestaande scripten verder te werken, in plaats van elke keer het wiel opnieuw uit te vinden, dan bevat zo'n script in de loop der tijd een enorme hoeveelheid informatie omtrent de oplossing van een bepaald probleem. Dat is trouwens het belangrijkste argument tegen 'rewrite from scratch' zoals [http://www.joelonsoftware.com/articles/fog0000000069.html in dit bekende artikel] wordt uitgelegd.
 
* '''Zelfdocumenterend:''' Na een kwartiertje muizen weet ik doorgaans al niet meer wat ik precies heb gedaan. Met scripts heb ik dat probleem niet. Als ik vervolgens de discipline kan opbrengen om steeds met bestaande scripten verder te werken, in plaats van elke keer het wiel opnieuw uit te vinden, dan bevat zo'n script in de loop der tijd een enorme hoeveelheid informatie omtrent de oplossing van een bepaald probleem. Dat is trouwens het belangrijkste argument tegen 'rewrite from scratch' zoals [http://www.joelonsoftware.com/articles/fog0000000069.html in dit bekende artikel] wordt uitgelegd.
 +
 +
Momenteel (januari 2016) heb ik zo'n beetje alles in één script staan. Of dat wijsheid is, weet ik trouwens nog niet. Er wordt geen gebruik gemaakt van input-argumenten: Alle argumenten staan in het script (met name onder ''Switches'' en ''Variabelen'') en ook daarvan weet ik niet of het de beste oplossing:
 +
 +
<pre>
 +
#!/bin/sh
 +
 +
# Installatie- & configuratiescript voor Drupal 7 & 8
 +
# Strompf - Okt. 2015 - Jan. 2016
 +
#
 +
echo "*** Drupal installatie- & configuratiescript... **********************"
 +
 +
####################################################################
 +
# Switches
 +
####################################################################
 +
#
 +
# opruimen=true
 +
# InstantieerDatabase=true
 +
# download_drupal_7=true
 +
# download_drupal_8=true
 +
# installeer_drupal_7=true
 +
# installeer_drupal_8=true
 +
# modules_7=true
 +
# modules_7_taal=true
 +
# bestandsrechten_fixen=true # Regel 143
 +
# modules_8=true # Regel 540
 +
# drupalcommerce_7=true
 +
# drupalcommerce_8=true # Regel 680
 +
# theme_7=true
 +
theme_8=true
 +
# blokken=true
 +
 +
####################################################################
 +
# Variabelen
 +
####################################################################
 +
#
 +
domeinnaam="example.com"
 +
 +
# Database
 +
#
 +
database_naam="example"
 +
database_gebruiker="example"
 +
database_wachtwoord="example-wachtwoord"
 +
 +
account_name="Jeroen Strompf"
 +
account_pass="Mijn wachtwoord"
 +
account_mail="info@example.com"
 +
 +
site_name="Example.com website"
 +
site_mail="info@example.com"
 +
 +
####################################################################
 +
# Constantes initialiseren
 +
####################################################################
 +
#
 +
wortel="/var/www/"$domeinnaam
 +
eigenaar="wheel"
 +
 +
if [ "$opruimen" = true ]; then
 +
 +
####################################################################
 +
# Opruimen
 +
####################################################################
 +
#
 +
echo "Opruimen..."
 +
 +
# Verwijder de database
 +
#
 +
i="drop database if exists $database_naam;"
 +
mysql -e "$i"
 +
 +
# Verwijder alle bestanden uit de servermap
 +
#
 +
rm -rf $wortel/*
 +
 +
fi
 +
 +
if [ "$InstantieerDatabase" = true ]; then
 +
 +
####################################################################
 +
# Maak database aan
 +
####################################################################
 +
#
 +
# Deze functie NIET gebruiken als je drush si gebruikt:
 +
# Drush si geeft een foutmelding als de database al bestaat
 +
#
 +
database_regel1="create database $database_naam;"
 +
database_regel2="grant all on $database_naam.* to '$database_gebruiker'@'localhost' identified by '$database_wachtwoord';"
 +
 +
mysql -e "$database_regel1"
 +
mysql -e "$database_regel2"
 +
 +
fi
 +
 +
if [ "$download_drupal_7" = true ]; then
 +
 +
####################################################################
 +
# Download Drupal 7
 +
####################################################################
 +
#
 +
# Eventuele bestaande download verwijderen
 +
#
 +
rm -rf /tmp/drupal/*
 +
 +
# Download naar /tmp en hernoem naar "drupal"
 +
#
 +
drush -y dl drupal-7 --destination=/tmp --drupal-project-rename
 +
 +
# Drupal-bestanden overfietsen naar $wortel
 +
# dot-bestanden naderder specificeren:
 +
# cp -r /tmp/drupal/.* $wortel werkt namelijk niet
 +
#
 +
cp -r /tmp/drupal/* $wortel
 +
cp /tmp/drupal/.g* $wortel # .gitattributes
 +
cp /tmp/drupal/.h* $wortel # .htaccess
 +
 +
fi
 +
 +
if [ "$download_drupal_8" = true ]; then
 +
 +
####################################################################
 +
# Download Drupal 8
 +
####################################################################
 +
#
 +
# * Download de laatste versie van Drupal 8
 +
# * Verplaats deze versie naar $wortel
 +
#
 +
# Eventuele bestaande download verwijderen
 +
#
 +
rm -rf /tmp/drupal/*
 +
 +
# Download naar /tmp en hernoem naar "drupal"
 +
#
 +
drush -y dl drupal-8 --destination=/tmp --drupal-project-rename
 +
 +
# Drupal-bestanden overfietsen naar $wortel
 +
# dot-bestanden naderder specificeren:
 +
# cp -r /tmp/drupal/.* $wortel werkt namelijk niet
 +
#
 +
cp -r /tmp/drupal/* $wortel
 +
cp /tmp/drupal/.c* $wortel # .csslintrc
 +
cp /tmp/drupal/.e* $wortel # .editorconfig, etc.
 +
cp /tmp/drupal/.g* $wortel # .gitattributes
 +
cp /tmp/drupal/.h* $wortel # .htaccess
 +
 +
fi
 +
 +
 +
if [ "$bestandsrechten_fixen" = true ]; then
 +
 +
####################################################################
 +
# Bestandsrechten fixen
 +
####################################################################
 +
#
 +
# Dit script is geschikt voor Drupal 7 & 8
 +
#
 +
# Drupal 8: Er moet iets gefixet worden na 'drush si', want het theme
 +
# komt niet uit de verf, en af en toe verschijnt er een foutmelding
 +
# zoals:
 +
#
 +
#    The specified file temporary://fileFZanvi could not be copied because
 +
#    the destination directory is not properly configured. This may be
 +
#    caused by a problem with file or directory permissions. More
 +
#    information is available in the system log.
 +
 +
# Eigenaar bijwerken
 +
######################################################################
 +
#
 +
sudo chown -R $eigenaar $wortel/*
 +
sudo chgrp -R $eigenaar $wortel/*
 +
sudo chown -R $eigenaar $wortel/.*
 +
sudo chgrp -R $eigenaar $wortel/.*
 +
 +
# Mappen (algemeen)
 +
######################################################################
 +
# 'Other' moeten mappen kunnen executeren, anders werkt 'cd' niet
 +
#
 +
# * Eigenaar: mag alles (7)
 +
# * Group: mag nix
 +
# * Other: Lezen & executeren (x-x - 5)
 +
#
 +
sudo chmod -R 705 $(find $wortel -type d)
 +
 +
# Bestanden (algemeen)
 +
######################################################################
 +
# * Eigenaar: Lezen & schrijven. Uitvoeren niet nodig
 +
# * Groep: Mag niets
 +
# * Other: Lezen. Niet schrijven of uitvoeren want veiligheidsprobleem
 +
#
 +
# Dit geldt ook voor .htaccess
 +
#
 +
# Dit geeft foutmeldingen, omdat chmod niet overweg kan met spaties:
 +
# Die belanden op een aparte regel.
 +
# Moet ik escapen op een of andere manier
 +
#
 +
sudo chmod -R 604 $(find $wortel -type f)
 +
 +
# Map 'files'
 +
######################################################################
 +
#
 +
# Drupal/webserver gebruikt deze map om bestanden te plaatsen
 +
#
 +
# * Mappen - Other: Lezen, schrijven, executeren → 707
 +
# * Bestanden - Other: Lezen, schrijven → 606
 +
#
 +
sudo chmod -R 707 $(find $wortel/sites/default/files -type d)
 +
sudo chmod -R 606 $(find $wortel/sites/default/files -type f)
 +
 +
# Map 'sites/all/translations'
 +
######################################################################
 +
#
 +
# Hier plaatst Drupal gedownloade vertalingen
 +
#
 +
# * Mappen - Other: Lezen, schrijven, executeren → 707
 +
# * Bestanden - Other: Lezen, schrijven → 606
 +
#
 +
sudo chmod -R 707 $(find $wortel/sites/all/translations -type d)
 +
sudo chmod -R 606 $(find $wortel/sites/all/translations -type f)
 +
 +
# .drush-map fixen
 +
######################################################################
 +
# Om de haverklap wordt deze map niet-schrijfbaar voor Drush,
 +
# misschien door gebruik van 'sudo drush'.
 +
#
 +
sudo chown -R $eigenaar /home/$eigenaar/.drush
 +
sudo chgrp -R $eigenaar /home/$eigenaar/.drush
 +
sudo chmod -R 705 /home/$eigenaar/.drush
 +
 +
fi
 +
 +
if [ "$installeer_drupal_7" = true ]; then
 +
 +
####################################################################
 +
# Installeer Drupal 7
 +
####################################################################
 +
#
 +
cd $wortel
 +
 +
#
 +
# 1. drush si met database-credentials
 +
#########################################################################
 +
#
 +
# Backslash geeft continuering op de volgende regel aan
 +
#
 +
drush -y si \
 +
--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam
 +
 +
#
 +
# 2. Met database-credentials + gebruiker 1 + site-naam + site-emailadres
 +
#########################################################################
 +
#
 +
# * Variabelen zoals $account_name staan tussen dubbele aanhalingstekens:
 +
#  Anders worden eventuele spaties niet goed verwerkt
 +
# * Met succes gebruikt: Dec. 2015
 +
#
 +
# drush -y si \
 +
# --db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam \
 +
# --account-name="$account_name" \
 +
# --account-pass="$account_pass" \
 +
# --account-mail="$account_mail" \
 +
# --site-mail="$site_mail" \
 +
# --site-name="$site_name"
 +
 +
fi
 +
 +
if [ "$installeer_drupal_8" = true ]; then
 +
 +
####################################################################
 +
# Installeer Drupal 8
 +
####################################################################
 +
#
 +
# * Installeer Drupal 8 middels 'drush si'
 +
# * Hiervoor moeten alle installatiebestanden op de doellocatie staan
 +
 +
# Geschiedenis
 +
####################################################################
 +
#
 +
# * Half december 2015: Deze routine werkte prima
 +
# * 28 December 2015: Foutmelding:
 +
#  exception 'PDOException' with message 'SQLSTATE[HY000]: General error:
 +
#  23 Out of resources when opening file './dc8/' (Errcode: 24)' in
 +
#  /var/www/dc8.dvb/core/lib/Drupal/Core/Database/Statement.php:64
 +
#  Online geen oplossingen gevonden
 +
 +
# Ga naar de servermap. Daar moeten alle bestanden staan
 +
#
 +
cd $wortel
 +
 +
# 1. drush si met database-credentials
 +
#########################################################################
 +
#
 +
# * Backslash geeft continuering op de volgende regel aan
 +
#
 +
# drush -y si \
 +
# --db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam
 +
 +
# 2. Met database-credentials + gebruiker 1 + site-naam + site-emailadres
 +
#########################################################################
 +
#
 +
# * Variabelen zoals $account_name staan tussen dubbele aanhalingstekens:
 +
#  Anders worden eventuele spaties niet goed verwerkt
 +
#
 +
drush -y si \
 +
--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam \
 +
--account-name="$account_name" \
 +
--account-pass="$account_pass" \
 +
--account-mail="$account_mail" \
 +
--site-mail="$site_mail" \
 +
--site-name="$site_name"
 +
 +
#
 +
# Deze twee commando's zijn nodig om het theme te laten functioneren!
 +
#
 +
chmod -R 707 $wortel/sites/default/files # Specifiek Drupal 8
 +
drush cache-rebuild # Specifiek Drupal 8
 +
 +
fi
 +
 +
 +
if [ "$modules_7" = true ]; then
 +
 +
####################################################################
 +
# Modules Drupal 7
 +
####################################################################
 +
#
 +
# Gebruik 'drush pml' om de namen van submodules te achterhalen
 +
#
 +
cd $wortel
 +
 +
# Core
 +
#################################################################
 +
#
 +
# drush -y dis color    # Afhankelijk van het theme
 +
# drush -y dis comment
 +
# drush -y en contact
 +
# drush -y en dblog # Logs and records system events to the database.
 +
# drush -y en help
 +
# drush -y dis overlay  # Altijd uitzetten
 +
# drush -y en path # Allows users to rename URLs
 +
# drush -y dis php # Gebruik ik dat nog? Liever niet
 +
# drush -y en search
 +
# drush -y en shortcut # Allows users to manage customizable lists of shortcut links.
 +
# drush -y en statistics # Logs access statistics for your site.
 +
# drush -y dis syslog # Logs doorzetten naar systeemlog? Da's vrij exotisch
 +
# drush -y en taxonomy
 +
# drush -y dis toolbar  # Altijd uit
 +
# drush -y en update
 +
 +
# Admin Menu
 +
#################################################################
 +
# Dit betreft het admin-menu
 +
# Admin-taalwissel → Taal
 +
#
 +
        # drush -y en admin_menu
 +
        # drush -y en admin_menu_toolbar
 +
 +
# Backup & Migrate
 +
#################################################################
 +
        #
 +
# Deze kun je vaak direct al installeren: Ivm. migratie van
 +
# ontwikkel- naar testomgeving, heb je 'm hopelijk snel nodig
 +
#
 +
        # drush -y en backup_migrate
 +
 +
# Context
 +
#################################################################
 +
#
 +
# * 'Context' is een alternatief op Blocks.
 +
# * http://wiki.devliegendebrigade.nl/Context-module_%28Drupal%29
 +
#
 +
        # drush -y en context
 +
        # drush -y en context_ui
 +
 +
# Display Suite
 +
#################################################################
 +
        #
 +
# * Oa. voor aangepaste view modes
 +
# * http://wiki.devliegendebrigade.nl/Display_Suite-module_%28Drupal%29
 +
#
 +
drush -y en ds_ui
 +
drush -y en ds
 +
# drush -y en ds_extras
 +
# drush -y en ds_forms
 +
# drush -y en ds_format
 +
# drush -y en ds_search
 +
# drush -y en ds_devel
 +
 +
# Drush Extras
 +
#################################################################
 +
#
 +
# * Zie http://cgit.drupalcode.org/drush_extras/tree/README.txt?id=HEAD
 +
# * Nodig?
 +
#
 +
# drush -y en drush_extras #
 +
 +
# Empty front page
 +
#################################################################
 +
        # drush -y dis empty_front_page
 +
 +
# Google AdWords Remarketing
 +
#################################################################
 +
# Hier heb ik geen goede alternatieve oplossing voor gevonden!
 +
# Handmatig code in een custom block zetten, werkt bv. niet
 +
#
 +
# drush -y en google_adwords_remarketing
 +
 +
# Google Analytics
 +
#################################################################
 +
# Vaak handig om wel te downloaden, maar nog niet te activeren,
 +
# want anders zinloze waarschuwing in Drupal Reports
 +
#
 +
# drush -y dis google_analytics
 +
 +
# Google AdSense
 +
#################################################################
 +
#
 +
# * Downloaden, maar nog niet activeren. Weinig relevante module
 +
# * Nodig?
 +
#
 +
# drush -y en adsense           
 +
 +
# Pathauto
 +
#################################################################
 +
        #
 +
# drush -y en pathauto
 +
 +
# SEO-gerelateerd
 +
#################################################################
 +
#
 +
# drush en -y seo_checker # SEO Compliance checker-https://www.drupal.org/project/seo_checker
 +
# drush en seo_cheklist # SEO Checklist - https://www.drupal.org/project/seo_checklist
 +
# drush en seo_cheklist # SEO Checklist - https://www.drupal.org/project/seo_checklist
 +
# drush en page_title # Page Title - https://www.drupal.org/project/page_title
 +
# drush en path_redirect # Path redirect - https://www.drupal.org/project/Path_Redirect
 +
# drush en global_redirect # Global redirect - https://www.drupal.org/project/globalredirect
 +
# drush en metatag # Meta tags - https://www.drupal.org/project/metatag
 +
# drush en search404 # Search 404 - https://www.drupal.org/project/search404
 +
# drush en xmlsitemap # XML Sitemap - https://www.drupal.org/project/xmlsitemap
 +
# drush en taxonomy_title # Taxonomy title - https://www.drupal.org/project/taxonomy_title
 +
 +
# Spam-gerelateerd
 +
#################################################################
 +
# Voor een site die extern gehost is (bv. VPS), direct activeren:
 +
# Het is verbazend hoe snel spam optreedt
 +
#
 +
# drush -y en captcha            # Captcha
 +
# drush -y en image_captcha      # Image-captcha
 +
# drush -y en honeypot          # Honeypot
 +
 +
        # Taxonomy Manager
 +
#################################################################
 +
        #
 +
# drush -y dis taxonomy_manager
 +
 +
# User interface
 +
#################################################################
 +
#
 +
        # drush en ckeditor
 +
        # drush -y en compact_forms # ?
 +
 +
# Views
 +
################################
 +
#
 +
# * Views is vereist voor Drupal Commerce
 +
# * Views_UI is daarnaast al snel onmisbaar,
 +
#  omdat je veel dingen zelf moet bouwen mbv. Views
 +
 +
# drush -y en views
 +
# drush -y en views_ui
 +
 +
  # Webform
 +
#################################################################
 +
        #
 +
        # drush -y en webform
 +
 +
fi
 +
 +
 +
if [ "$modules_7_taal" = true ]; then
 +
 +
####################################################################
 +
# Modules Drupal 7 - Taal
 +
####################################################################
 +
#
 +
cd $wortel
 +
 +
# Taal - Algemeen
 +
#################################################################
 +
#
 +
drush -y en locale            # Hoofdmodule voor gebruik andere ta(a)l(en) dan EN
 +
  drush -y en l10n_update        # Language updates voor modules. Superhandig
 +
drush -y en admin_language  # Onontbeerlijk voor een niet-NL-site
 +
 +
# Internationalization Module (i18n): Voor meertalige sites
 +
#################################################################
 +
#
 +
    drush -y en i18n              # Basis-module 'Internationaliasation'
 +
  drush -y en i18n_block # Enables language selector for blocks
 +
  drush -y en i18n_contact # Makes contact categories and replies translatable
 +
  drush -y en i18n_field # Translate field properties
 +
  drush -y en i18n_menu # Supports translatable custom menu items.
 +
  drush -y en i18n_node # Extended node options for multilingual content
 +
# drush -y en i18n_forum # Enables multilingual forum, translates names and containers.
 +
  drush -y en i18n_select # API module for multilingual content selection
 +
  drush -y en i18n_path # Define translations for generic paths
 +
  drush -y en i18n_string # Benodigde ondersteunende module
 +
  drush -y en i18n_sync # Synchronizes taxonomy and fields
 +
  drush -y en i18n_taxonomy # Enables multilingual taxonomy.
 +
  drush -y en i18n_redirect # Translation redirect
 +
  drush -y en i18n_translation         # Ondersteunende module. nodig Soms
 +
  drush -y en i18n_user # Translate emails sent from the User module.
 +
  drush -y en i18n_variable # Benodigd voor i18n_user
 +
# drush -y en rules_i18n # Rules translation. Aparte module?
 +
 +
# Drush_language
 +
#################################################################
 +
#
 +
# * Verschaft een paar handige commando's
 +
# * https://www.drupal.org/project/drush_language
 +
# * Deze module heeft last van de drush-loop:
 +
# * http://wiki.devliegendebrigade.nl/Drush_vicieuze_circel#Mogelijke_oorzaken
 +
# * Apart downloaden & installeren biedt helaas ook geen soulaas
 +
# * Daarom overslaan, want niet al te belangrijk
 +
#
 +
        # drush -y en drush_language # Drush-loop
 +
#
 +
# drush dl drush_language # Apart downloaden is geen probleem
 +
# drush en drush_language # Bij activeren treedt weer de drush-loop op
 +
#
 +
        # drush -y language-add nl # Dit is een drush_language-commando
 +
        # drush -y language_enable nl
 +
        # drush -y language_default nl
 +
#
 +
        # drush -y language-add de # Dit is een drush_language-commando
 +
        # drush -y language_enable de
 +
        # drush -y language_default de
 +
fi
 +
 +
 +
 +
if [ "$modules_8" = true ]; then
 +
 +
####################################################################
 +
# Modules Drupal 8
 +
####################################################################
 +
 +
echo "  Configuratie modules Drupal 8..."
 +
cd $wortel
 +
 +
# Core
 +
######################
 +
#
 +
drush en -y statistics
 +
drush en -y path # Standaard aan. Onmisbaar vom URL's te hernoemen
 +
 +
# Admin Menu
 +
######################
 +
#
 +
# * Werkt niet! Niet gebruiken!
 +
# * http://wiki.devliegendebrigade.nl/Admin_Menu-module_%28Drupal%29
 +
#
 +
# drush -y pmu admin_menu        # Niet gebruiken
 +
 +
# Admin Toolbar
 +
################################
 +
#
 +
# Uitbreiding op de standaard Drupal 8-toolbar om 'm dynamischer te maken
 +
#
 +
# drush en -y admin_toolbar # Basis-module
 +
# drush en -y admin_toolbar_tools # Extra menu-items zijn handig
 +
 +
# Captcha
 +
################################
 +
#
 +
# Module doet moeilijk - Komt nog!
 +
#
 +
# drush -y pmu image_captcha
 +
# drush -y pmu captcha
 +
 +
# Multilingual
 +
######################
 +
#
 +
drush en -y locale # Interface Translation
 +
drush en -y language # Allows users to configure languages and apply them to content.
 +
 +
# Views
 +
################################
 +
#
 +
drush -y en views
 +
drush -y en views_ui
 +
 +
# Overig (alfabetisch)
 +
################################
 +
#
 +
# drush -y en adsense            # Downloaden, maar nog niet activeren
 +
# drush -y en backup_migrate    # Downloaden, maar nog niet activeren
 +
# drush -y en image_captcha      # Image-captcha
 +
# drush -y en drush_extras    # http://cgit.drupalcode.org/drush_extras/tree/README.txt?id=HEAD
 +
# drush -y en google_analytics  # Google Analytics. Downloaden maar nog niet activeren
 +
# drush -y en honeypot          # Honeypot
 +
 +
fi
 +
 +
if [ "$drupalcommerce_7" = true ]; then
 +
 +
####################################################################
 +
# Drupal Commerce voor Drupal 7
 +
####################################################################
 +
#
 +
 +
cd $wortel
 +
 +
# Benodigde ondersteunende modules
 +
#################################################################
 +
#
 +
# * Handig om deze modules eerst expliciet te installeren
 +
# * Bron: https://www.drupal.org/project/commerce
 +
# * Loop-vrij!
 +
#
 +
# drush -y en ctools
 +
# drush -y en views
 +
# drush -y en entity
 +
# drush -y en rules
 +
# drush -y en addressfield
 +
  drush -y en inline_entity_form # Product-display-referentie
 +
 +
# Eigenlijke modules
 +
#################################################################
 +
#
 +
# * Onduidelijk welke modules ik precies nodig heb
 +
# * Een aantal modules kunnen naderhand uitgeschakeld worden,
 +
#  wo. enkele ui-modules
 +
# * Geen drush-loops
 +
#
 +
# drush en -y commerce
 +
# drush en -y commerce_cart
 +
# drush en -y commerce_checkout
 +
# drush en -y commerce_customer
 +
# drush en -y commerce_customer_ui
 +
# drush en -y commerce_line_item
 +
# drush en -y commerce_line_item_ui
 +
# drush en -y commerce_customer_ui
 +
# drush en -y commerce_order
 +
# drush en -y commerce_order_ui
 +
# drush en -y commerce_payment
 +
# drush dis -y commerce_payment_example
 +
# drush en -y commerce_payment_ui
 +
# drush en -y commerce_price
 +
# drush en -y commerce_product
 +
# drush en -y commerce_product_pricing
 +
# drush en -y commerce_product_pricing_ui
 +
# drush en -y commerce_product_reference
 +
# drush en -y commerce_product_ui
 +
# drush en -y commerce_tax
 +
# drush en -y commerce_tax_ui
 +
# drush en -y commerce_ui
 +
 +
# Commerce (contrib)
 +
#################################################################
 +
#
 +
# Commerce Backoffice - Zie Kolibrie
 +
# Commerce Search API? - Zie Kolibrie
 +
# Commerce Billy? - Zie Kolibrie
 +
#
 +
# drush -y en commerce_bank_transfer
 +
# drush -y en commerce_flat_rate
 +
# drush -y en commerce_shipping
 +
# drush -y en commerce_shipping_example # Doe maar niet
 +
# drush -y en commerce_shipping_ui
 +
 +
# commerce_drush
 +
#################################################################
 +
#
 +
# Integratie voorraadstatus & orders
 +
# http://wiki.devliegendebrigade.nl/Drupal_Commerce_Drush
 +
#
 +
# drush -y dis commerce_drush
 +
 +
fi
 +
 +
if [ "$drupalcommerce_8" = true ]; then
 +
 +
####################################################################
 +
# Drupal Commerce voor Drupal 8
 +
####################################################################
 +
#
 +
# Installatie Drupal Commerce for Drupal 8 heeft nogal wat voeten in de aarde.
 +
# Daarom hier als aparte subroutine
 +
# Benodigde ondersteunende modules worden hier eveneens geïnstalleerd
 +
#
 +
echo "  Installatie Drupal Commerce voor Drupal 8..."
 +
cd $wortel
 +
 +
# Composer bijwerken
 +
###################################################################
 +
#
 +
# Hoeft niet elke keer
 +
#
 +
# sudo /usr/local/bin/composer/composer self-update
 +
 +
# composer_manager
 +
###########################################################################################
 +
#
 +
# * Benodigd voor afhandelen php-libraries
 +
# * Heeft last van de Drush-loop
 +
#
 +
# drush en -y composer_manager
 +
# php modules/composer_manager/scripts/init.php
 +
 +
# composer drupal-update
 +
###########################################################################################
 +
#
 +
# Foutmelding "Permission denied"? Dan eerst bestandsrechten bijwerken!
 +
#
 +
# * Begin 2016: Probleem jcalderonzumba-nog-wat
 +
# * 11 jan. 2016: Succesvol doorlopen
 +
# * 19. jan. 2016: Probleem + uplossing:
 +
#  http://wiki.devliegendebrigade.nl/Drupal_Commerce_2.x_-_Installatie#Bronnen
 +
#
 +
# composer drupal-update
 +
 +
# Benodigde ondersteunende modules
 +
############################################################################################
 +
#
 +
# Handig om die eerst expliciet te installeren,
 +
# ivm. eeuwige foutmeldingen Drush, die in een circeltje beweeg
 +
#
 +
# drush en -y entity
 +
# drush en -y state_machine
 +
# drush en -y address
 +
# drush en -y inline_entity_form
 +
# drush en -y profile
 +
 +
  # Views
 +
################################
 +
#
 +
# Onmisbaar voor Drupal Commerce, omdat je veel dingen zelf moet bouwen mbv. Views
 +
 +
# drush -y en views
 +
# drush -y en views_ui
 +
 +
# Eigenlijke modules
 +
############################################################################################
 +
#
 +
# drush en -y commerce
 +
# drush en -y commerce_cart
 +
# drush en -y commerce_order
 +
# drush en -y commerce_price
 +
# drush en -y commerce_product
 +
# drush en -y commerce_store
 +
# drush en -y commerce_tax
 +
 +
fi
 +
 +
if [ "$blokken" = true ]; then
 +
 +
####################################################################
 +
### Blocks
 +
####################################################################
 +
#
 +
# * Uitzetten van blokken, vereist geen additionele Drupal-module
 +
# * Zie http://wiki.devliegendebrigade.nl/Drush_block-disable
 +
# * Identiek voor Drupal 7 & 8?
 +
# * Moet deze subroutine twee keer uitgevoerd worden?
 +
#
 +
 +
cd $wortel
 +
 +
drush block-disable system powered-by
 +
drush block-disable user login
 +
drush block-disable node recent
 +
drush block-disable comment recent
 +
drush block-disable node recent
 +
drush block-disable node syndicate
 +
drush block-disable user new
 +
drush block-disable user online
 +
 +
fi
 +
 +
if [ "$theme_7" = true ]; then
 +
 +
####################################################################
 +
### Theme Drupal 7
 +
####################################################################
 +
#
 +
# * Begin 2016 (Drupal 7): Werkt perfect
 +
#
 +
# drush en -y adaptivetheme # Nodig voor at_commerce
 +
drush en -y at_commerce # Subtheme van adaptivetheme
 +
drush vset theme_default at_commerce
 +
drush pm-disable -y bartik
 +
drush pm-disable -y adaptivetheme
 +
drush vset admin_theme -y seven
 +
 +
# Fetch fresh.css
 +
############################################################################################
 +
#
 +
# * Aanname dat 'Seven' het standaard admin-theme is
 +
# * Vergeet niet om een regel toe te voegen aan seven.info om fresh.css te activeren
 +
# * En evt.: drush cc all
 +
#
 +
wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/themes/seven/fresh.css
 +
wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/sites/all/themes/at_commerce/css/fresh.css
 +
 +
fi
 +
 +
if [ "$theme_8" = true ]; then
 +
 +
####################################################################
 +
### Theme Drupal 8
 +
####################################################################
 +
#
 +
# * at_commerce bestaat niet voor Drupal 8!
 +
#
 +
# * 19 jan. 2016: Drush-loop. Oplossing: Installatieregel adaptivetheme uitcommentariseren
 +
#
 +
# drush en -y adaptivetheme # Nodig voor at_commerce
 +
drush en -y at_commerce # Subtheme van adaptivetheme
 +
drush vset theme_default at_commerce
 +
drush pm-uninstall -y bartik
 +
drush pm-uninstall -y adaptivetheme
 +
drush vset admin_theme -y seven
 +
 +
# Fetch fresh.css
 +
############################################################################################
 +
#
 +
# * Aanname dat 'Seven' het standaard admin-theme is
 +
# * Vergeet niet om een regel toe te voegen aan seven.info om fresh.css te activeren
 +
# * En evt.: drush cc all
 +
#
 +
wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/themes/seven/fresh.css
 +
wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/sites/all/themes/at_commerce/css/fresh.css
 +
 +
fi
 +
####################################################################
 +
### Klaar
 +
####################################################################
 +
#
 +
echo "...Klaar!"
 +
</pre>

Versie van 23 jan 2016 11:26

Ik werk graag met scripts:

  • Herhaalbaarheid & uitbreidbaarheid: Als een procedure eenmaal in een script is vastgelegd, kan het - binnen bepaalde grenzen - moeiteloos herhaald worden, en uitgebreid worden
  • Consistentie: Gerelateereed aan herhaalbaarheid: Als eens script het eenmaal doet, kan ik er min-of-meer op vertrouwen dat het de volgende keer op dezelfde manier werkt
  • Zelfdocumenterend: Na een kwartiertje muizen weet ik doorgaans al niet meer wat ik precies heb gedaan. Met scripts heb ik dat probleem niet. Als ik vervolgens de discipline kan opbrengen om steeds met bestaande scripten verder te werken, in plaats van elke keer het wiel opnieuw uit te vinden, dan bevat zo'n script in de loop der tijd een enorme hoeveelheid informatie omtrent de oplossing van een bepaald probleem. Dat is trouwens het belangrijkste argument tegen 'rewrite from scratch' zoals in dit bekende artikel wordt uitgelegd.

Momenteel (januari 2016) heb ik zo'n beetje alles in één script staan. Of dat wijsheid is, weet ik trouwens nog niet. Er wordt geen gebruik gemaakt van input-argumenten: Alle argumenten staan in het script (met name onder Switches en Variabelen) en ook daarvan weet ik niet of het de beste oplossing:

#!/bin/sh 

# Installatie- & configuratiescript voor Drupal 7 & 8
# Strompf - Okt. 2015 - Jan. 2016
#
echo "*** Drupal installatie- & configuratiescript... **********************"

####################################################################
# Switches
####################################################################
#
# opruimen=true
# InstantieerDatabase=true
# download_drupal_7=true
# download_drupal_8=true
# installeer_drupal_7=true
# installeer_drupal_8=true
# modules_7=true
# modules_7_taal=true
# bestandsrechten_fixen=true			# Regel 143
# modules_8=true						# Regel 540
# drupalcommerce_7=true
# drupalcommerce_8=true				# Regel 680
# theme_7=true
theme_8=true
# blokken=true

####################################################################
# Variabelen
####################################################################
#
domeinnaam="example.com"

# Database
#
 database_naam="example"
 database_gebruiker="example"
 database_wachtwoord="example-wachtwoord"

 account_name="Jeroen Strompf"
 account_pass="Mijn wachtwoord"
 account_mail="info@example.com"

 site_name="Example.com website"
 site_mail="info@example.com"

####################################################################
# Constantes initialiseren
####################################################################
#
wortel="/var/www/"$domeinnaam
eigenaar="wheel"

if [ "$opruimen" = true ]; then

	####################################################################
	# Opruimen
	####################################################################
	#
	echo "Opruimen..."

	# Verwijder de database
	#
	i="drop database if exists $database_naam;"
	mysql -e "$i"

	# Verwijder alle bestanden uit de servermap
	#
	rm -rf $wortel/*

fi

if [ "$InstantieerDatabase" = true ]; then

	####################################################################
	# Maak database aan
	####################################################################
	#
	# Deze functie NIET gebruiken als je drush si gebruikt:
	# Drush si geeft een foutmelding als de database al bestaat
	#
	database_regel1="create database $database_naam;"
	database_regel2="grant all on $database_naam.* to '$database_gebruiker'@'localhost' identified by '$database_wachtwoord';"

	mysql -e "$database_regel1"
	mysql -e "$database_regel2"

fi

if [ "$download_drupal_7" = true ]; then

	####################################################################
	# Download Drupal 7
	####################################################################
	#
	# Eventuele bestaande download verwijderen
	#
	rm -rf /tmp/drupal/*

	# Download naar /tmp en hernoem naar "drupal"
	#
	drush -y dl drupal-7 --destination=/tmp --drupal-project-rename

	# Drupal-bestanden overfietsen naar $wortel
	# dot-bestanden naderder specificeren: 
	# cp -r /tmp/drupal/.* $wortel werkt namelijk niet
	#
	cp -r /tmp/drupal/* $wortel
	cp /tmp/drupal/.g* $wortel		# .gitattributes
	cp /tmp/drupal/.h* $wortel		# .htaccess

fi

if [ "$download_drupal_8" = true ]; then

	####################################################################
	# Download Drupal 8
	####################################################################
	#
	# * Download de laatste versie van Drupal 8
	# * Verplaats deze versie naar $wortel
	#
	# Eventuele bestaande download verwijderen
	#
	rm -rf /tmp/drupal/*

	# Download naar /tmp en hernoem naar "drupal"
	#
	drush -y dl drupal-8 --destination=/tmp --drupal-project-rename

	# Drupal-bestanden overfietsen naar $wortel
	# dot-bestanden naderder specificeren: 
	# cp -r /tmp/drupal/.* $wortel werkt namelijk niet
	#
	cp -r /tmp/drupal/* $wortel
	cp /tmp/drupal/.c* $wortel		# .csslintrc
	cp /tmp/drupal/.e* $wortel		# .editorconfig, etc.
	cp /tmp/drupal/.g* $wortel		# .gitattributes
	cp /tmp/drupal/.h* $wortel		# .htaccess

fi


if [ "$bestandsrechten_fixen" = true ]; then

	####################################################################
	# Bestandsrechten fixen
	####################################################################
	#
	# Dit script is geschikt voor Drupal 7 & 8
	# 
	# Drupal 8: Er moet iets gefixet worden na 'drush si', want het theme 
	# komt niet uit de verf, en af en toe verschijnt er een foutmelding 
	# zoals:
	#
	#    The specified file temporary://fileFZanvi could not be copied because 
	#    the destination directory is not properly configured. This may be 
	#    caused by a problem with file or directory permissions. More 
	#    information is available in the system log.

	# Eigenaar bijwerken
	######################################################################
	#
	sudo chown -R $eigenaar $wortel/*
	sudo chgrp -R $eigenaar $wortel/*
	sudo chown -R $eigenaar $wortel/.*
	sudo chgrp -R $eigenaar $wortel/.*

	# Mappen (algemeen)
	######################################################################
	# 'Other' moeten mappen kunnen executeren, anders werkt 'cd' niet
	#
	# * Eigenaar: mag alles (7)
	# * Group: mag nix
	# * Other: Lezen & executeren (x-x - 5)
	#
	sudo chmod -R 705 $(find $wortel -type d)

	# Bestanden (algemeen)
	######################################################################
	# * Eigenaar: Lezen & schrijven. Uitvoeren niet nodig
	# * Groep: Mag niets
	# * Other: Lezen. Niet schrijven of uitvoeren want veiligheidsprobleem
	#
	# Dit geldt ook voor .htaccess
	#
	# Dit geeft foutmeldingen, omdat chmod niet overweg kan met spaties:
	# Die belanden op een aparte regel.
	# Moet ik escapen op een of andere manier
	#
 	sudo chmod -R 604 $(find $wortel -type f)

	# Map 'files'
	######################################################################
	#
	# Drupal/webserver gebruikt deze map om bestanden te plaatsen
	#
	# * Mappen - Other: Lezen, schrijven, executeren → 707
	# * Bestanden - Other: Lezen, schrijven → 606
	#
	sudo chmod -R 707 $(find $wortel/sites/default/files -type d)
	sudo chmod -R 606 $(find $wortel/sites/default/files -type f)

	# Map 'sites/all/translations'
	######################################################################
	#
	# Hier plaatst Drupal gedownloade vertalingen
	#
	# * Mappen - Other: Lezen, schrijven, executeren → 707
	# * Bestanden - Other: Lezen, schrijven → 606
	#
	sudo chmod -R 707 $(find $wortel/sites/all/translations -type d)
	sudo chmod -R 606 $(find $wortel/sites/all/translations -type f)

	# .drush-map fixen
	######################################################################
	# Om de haverklap wordt deze map niet-schrijfbaar voor Drush,
	# misschien door gebruik van 'sudo drush'.
	#
	sudo chown -R $eigenaar /home/$eigenaar/.drush
	sudo chgrp -R $eigenaar /home/$eigenaar/.drush
	sudo chmod -R 705 /home/$eigenaar/.drush

fi

if [ "$installeer_drupal_7" = true ]; then

	####################################################################
	# Installeer Drupal 7
	####################################################################
	#
	cd $wortel

	#
	# 1. drush si met database-credentials
	#########################################################################
	#
	# Backslash geeft continuering op de volgende regel aan
	#
	drush -y si \
		--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam

	#
	# 2. Met database-credentials + gebruiker 1 + site-naam + site-emailadres
	#########################################################################
	#
	# * Variabelen zoals $account_name staan tussen dubbele aanhalingstekens:
	#   Anders worden eventuele spaties niet goed verwerkt
	# * Met succes gebruikt: Dec. 2015
	#
#	drush -y si \
#		--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam \
#		--account-name="$account_name" \
#		--account-pass="$account_pass" \
#		--account-mail="$account_mail" \
#		--site-mail="$site_mail" \
#		--site-name="$site_name"

fi

if [ "$installeer_drupal_8" = true ]; then

	####################################################################
	# Installeer Drupal 8
	####################################################################
	#
	# * Installeer Drupal 8 middels 'drush si'
	# * Hiervoor moeten alle installatiebestanden op de doellocatie staan
	
	# Geschiedenis
	####################################################################
	#
	# * Half december 2015: Deze routine werkte prima
	# * 28 December 2015: Foutmelding:
 	#   exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 
	#   23 Out of resources when opening file './dc8/' (Errcode: 24)' in
	#   /var/www/dc8.dvb/core/lib/Drupal/Core/Database/Statement.php:64
	#   Online geen oplossingen gevonden

	# Ga naar de servermap. Daar moeten alle bestanden staan
	#
	cd $wortel

	# 1. drush si met database-credentials
	#########################################################################
	#
	# * Backslash geeft continuering op de volgende regel aan
	#
	# drush -y si \
	#	--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam

	# 2. Met database-credentials + gebruiker 1 + site-naam + site-emailadres
	#########################################################################
	#
	# * Variabelen zoals $account_name staan tussen dubbele aanhalingstekens:
	#   Anders worden eventuele spaties niet goed verwerkt
	#
	drush -y si \
		--db-url=mysql://$database_gebruiker:$database_wachtwoord@localhost/$database_naam \
		--account-name="$account_name" \
		--account-pass="$account_pass" \
		--account-mail="$account_mail" \
		--site-mail="$site_mail" \
		--site-name="$site_name"

	#
	# Deze twee commando's zijn nodig om het theme te laten functioneren!
	#
	chmod -R 707 $wortel/sites/default/files	# Specifiek Drupal 8
	drush cache-rebuild				# Specifiek Drupal 8

fi


if [ "$modules_7" = true ]; then

	####################################################################
	# Modules Drupal 7
	####################################################################
	#
	# Gebruik 'drush pml' om de namen van submodules te achterhalen
	#
	cd $wortel

	# Core
	#################################################################
	#
	#	drush -y dis color    	# Afhankelijk van het theme
	#	drush -y dis comment
	#	drush -y en contact
	#	drush -y en dblog	# Logs and records system events to the database.
	#	drush -y en help
	#	drush -y dis overlay  	# Altijd uitzetten
	#	drush -y en path	# Allows users to rename URLs
	#	drush -y dis php	# Gebruik ik dat nog? Liever niet
	#	drush -y en search
	#	drush -y en shortcut	# Allows users to manage customizable lists of shortcut links.
	#	drush -y en statistics	# Logs access statistics for your site.
	#	drush -y dis syslog	# Logs doorzetten naar systeemlog? Da's vrij exotisch
	#	drush -y en taxonomy
	#	drush -y dis toolbar  	# Altijd uit
	#	drush -y en update
	
	# Admin Menu
	#################################################################
	# Dit betreft het admin-menu
	# Admin-taalwissel → Taal
	#
        # drush -y en admin_menu
        # drush -y en admin_menu_toolbar

	# Backup & Migrate
	#################################################################
        #
	# Deze kun je vaak direct al installeren: Ivm. migratie van
	# ontwikkel- naar testomgeving, heb je 'm hopelijk snel nodig
	#
        # drush -y en backup_migrate

	# Context
	#################################################################
	#
	# * 'Context' is een alternatief op Blocks.
	# * http://wiki.devliegendebrigade.nl/Context-module_%28Drupal%29
	#
        # drush -y en context
        # drush -y en context_ui

	# Display Suite
	#################################################################
        #
	# * Oa. voor aangepaste view modes
	# * http://wiki.devliegendebrigade.nl/Display_Suite-module_%28Drupal%29
	#
	drush -y en ds_ui
	drush -y en ds
	# drush -y en ds_extras
	# drush -y en ds_forms
	# drush -y en ds_format
	# drush -y en ds_search
	# drush -y en ds_devel

	# Drush Extras
	#################################################################
	#
	# * Zie http://cgit.drupalcode.org/drush_extras/tree/README.txt?id=HEAD
	# * Nodig?
	#
	# drush -y en drush_extras	# 

	# Empty front page
	#################################################################
        # drush -y dis empty_front_page

	# Google AdWords Remarketing
	#################################################################
	# Hier heb ik geen goede alternatieve oplossing voor gevonden!
	# Handmatig code in een custom block zetten, werkt bv. niet
	#
	# drush -y en google_adwords_remarketing	

	# Google Analytics
	#################################################################
	# Vaak handig om wel te downloaden, maar nog niet te activeren,
	# want anders zinloze waarschuwing in Drupal Reports
	#
	# drush -y dis google_analytics

	# Google AdSense
	#################################################################
	#
	# * Downloaden, maar nog niet activeren. Weinig relevante module 
	# * Nodig?
	#
	# drush -y en adsense            

	# Pathauto
	#################################################################
        #
 	# drush -y en pathauto
	
	# SEO-gerelateerd
	#################################################################
	#
	# drush en -y seo_checker	# SEO Compliance checker-https://www.drupal.org/project/seo_checker
	# drush en seo_cheklist		# SEO Checklist - https://www.drupal.org/project/seo_checklist
	# drush en seo_cheklist		# SEO Checklist - https://www.drupal.org/project/seo_checklist
	# drush en page_title		# Page Title - https://www.drupal.org/project/page_title
	# drush en path_redirect	# Path redirect - https://www.drupal.org/project/Path_Redirect
	# drush en global_redirect	# Global redirect - https://www.drupal.org/project/globalredirect
	# drush en metatag		# Meta tags - https://www.drupal.org/project/metatag
	# drush en search404		# Search 404 - https://www.drupal.org/project/search404
	# drush en xmlsitemap		# XML Sitemap - https://www.drupal.org/project/xmlsitemap
	# drush en taxonomy_title	# Taxonomy title - https://www.drupal.org/project/taxonomy_title

	# Spam-gerelateerd
	#################################################################
	# Voor een site die extern gehost is (bv. VPS), direct activeren:
	# Het is verbazend hoe snel spam optreedt
	#
	# drush -y en captcha            # Captcha
	# drush -y en image_captcha      # Image-captcha
	# drush -y en honeypot           # Honeypot

        # Taxonomy Manager
	#################################################################
        # 
	# drush -y dis taxonomy_manager

	# User interface
	#################################################################
	#
        # drush en ckeditor
        # drush -y en compact_forms	# ?

	# Views
	################################
	#
	# * Views is vereist voor Drupal Commerce
	# * Views_UI is daarnaast al snel onmisbaar, 
	#   omdat je veel dingen zelf moet bouwen mbv. Views
	#  
	#	drush -y en views
	#	drush -y en views_ui

  	# Webform
	#################################################################
        #
        # drush -y en webform

fi


if [ "$modules_7_taal" = true ]; then

	####################################################################
	# Modules Drupal 7 - Taal
	####################################################################
	#
	cd $wortel

	# Taal - Algemeen
	#################################################################
	#
	drush -y en locale            	# Hoofdmodule voor gebruik andere ta(a)l(en) dan EN
  	drush -y en l10n_update        # Language updates voor modules. Superhandig
	drush -y en admin_language   	# Onontbeerlijk voor een niet-NL-site

	# Internationalization Module (i18n): Voor meertalige sites
	#################################################################
	#
  	  drush -y en i18n              	# Basis-module 'Internationaliasation'
	  drush -y en i18n_block		# Enables language selector for blocks
	  drush -y en i18n_contact		# Makes contact categories and replies translatable
	  drush -y en i18n_field		# Translate field properties
	  drush -y en i18n_menu			# Supports translatable custom menu items.
	  drush -y en i18n_node			# Extended node options for multilingual content
	# drush -y en i18n_forum		# Enables multilingual forum, translates names and containers.
	  drush -y en i18n_select		# API module for multilingual content selection
	  drush -y en i18n_path			# Define translations for generic paths
	  drush -y en i18n_string		# Benodigde ondersteunende module
	  drush -y en i18n_sync			# Synchronizes taxonomy and fields
	  drush -y en i18n_taxonomy		# Enables multilingual taxonomy.
	  drush -y en i18n_redirect		# Translation redirect
	  drush -y en i18n_translation	        # Ondersteunende module. nodig Soms
	  drush -y en i18n_user			# Translate emails sent from the User module.
	  drush -y en i18n_variable		# Benodigd voor i18n_user
	# drush -y en rules_i18n		# Rules translation. Aparte module?

	# Drush_language
	#################################################################
	#
	# * Verschaft een paar handige commando's
	# * https://www.drupal.org/project/drush_language
	# * Deze module heeft last van de drush-loop:
	# * http://wiki.devliegendebrigade.nl/Drush_vicieuze_circel#Mogelijke_oorzaken
	# * Apart downloaden & installeren biedt helaas ook geen soulaas
	# * Daarom overslaan, want niet al te belangrijk
	#
        # drush -y en drush_language	# Drush-loop
	#
	# drush dl drush_language		# Apart downloaden is geen probleem
	# drush en drush_language		# Bij activeren treedt weer de drush-loop op
	#
        # drush -y language-add nl		# Dit is een drush_language-commando
        # drush -y language_enable nl
        # drush -y language_default nl
	#
        # drush -y language-add de		# Dit is een drush_language-commando
        # drush -y language_enable de
        # drush -y language_default de
fi



if [ "$modules_8" = true ]; then

	####################################################################
	# Modules Drupal 8
	####################################################################

	echo "   Configuratie modules Drupal 8..."
	cd $wortel

	# Core
	######################
	#
	drush en -y statistics
	drush en -y path			# Standaard aan. Onmisbaar vom URL's te hernoemen

	# Admin Menu
	######################
	#
	# * Werkt niet! Niet gebruiken!
	# * http://wiki.devliegendebrigade.nl/Admin_Menu-module_%28Drupal%29
	#
	# drush -y pmu admin_menu         # Niet gebruiken

	# Admin Toolbar
	################################
	#
	# Uitbreiding op de standaard Drupal 8-toolbar om 'm dynamischer te maken
	#
	# drush en -y admin_toolbar			# Basis-module
	# drush en -y admin_toolbar_tools	# Extra menu-items zijn handig

	# Captcha
	################################
	#
	# Module doet moeilijk - Komt nog!
	#
	# drush -y pmu image_captcha
	# drush -y pmu captcha	

	# Multilingual
	######################
	#
	drush en -y locale		# Interface Translation
	drush en -y language		# Allows users to configure languages and apply them to content.

	# Views
	################################
	#
	drush -y en views
	drush -y en views_ui

	# Overig (alfabetisch)
	################################
	#
	# drush -y en adsense            # Downloaden, maar nog niet activeren
	# drush -y en backup_migrate     # Downloaden, maar nog niet activeren
	# drush -y en image_captcha      # Image-captcha
	# drush -y en drush_extras    	# http://cgit.drupalcode.org/drush_extras/tree/README.txt?id=HEAD
	# drush -y en google_analytics   # Google Analytics. Downloaden maar nog niet activeren
	# drush -y en honeypot           # Honeypot

fi

if [ "$drupalcommerce_7" = true ]; then

	####################################################################
	# Drupal Commerce voor Drupal 7
	####################################################################
	#

	cd $wortel

	# Benodigde ondersteunende modules
	#################################################################
	#
	# * Handig om deze modules eerst expliciet te installeren
	# * Bron: https://www.drupal.org/project/commerce
	# * Loop-vrij!
	#
	# drush -y en ctools
	# drush -y en views
	# drush -y en entity
	# drush -y en rules
	# drush -y en addressfield
	  drush -y en inline_entity_form		# Product-display-referentie

	# Eigenlijke modules
	#################################################################
	#
	# * Onduidelijk welke modules ik precies nodig heb
	# * Een aantal modules kunnen naderhand uitgeschakeld worden,
	#   wo. enkele ui-modules
	# * Geen drush-loops
	#
	# drush en -y commerce
	# drush en -y commerce_cart
	# drush en -y commerce_checkout
	# drush en -y commerce_customer
	# drush en -y commerce_customer_ui
	# drush en -y commerce_line_item
	# drush en -y commerce_line_item_ui
	# drush en -y commerce_customer_ui
	# drush en -y commerce_order
	# drush en -y commerce_order_ui
	# drush en -y commerce_payment
	# drush dis -y commerce_payment_example
	# drush en -y commerce_payment_ui
	# drush en -y commerce_price
	# drush en -y commerce_product
	# drush en -y commerce_product_pricing
	# drush en -y commerce_product_pricing_ui
	# drush en -y commerce_product_reference
	# drush en -y commerce_product_ui
	# drush en -y commerce_tax
	# drush en -y commerce_tax_ui
	# drush en -y commerce_ui

	# Commerce (contrib)
	#################################################################
	# 
	# Commerce Backoffice - Zie Kolibrie
	# Commerce Search API? - Zie Kolibrie
	# Commerce Billy? - Zie Kolibrie
	#
	# drush -y en commerce_bank_transfer	
	# drush -y en commerce_flat_rate
	# drush -y en commerce_shipping
	# drush -y en commerce_shipping_example	# Doe maar niet	
	# drush -y en commerce_shipping_ui

	# commerce_drush
	#################################################################
	#
	# Integratie voorraadstatus & orders
	# http://wiki.devliegendebrigade.nl/Drupal_Commerce_Drush
	#
	# drush -y dis commerce_drush	

fi

if [ "$drupalcommerce_8" = true ]; then

	####################################################################
	# Drupal Commerce voor Drupal 8
	####################################################################
	#
	# Installatie Drupal Commerce for Drupal 8 heeft nogal wat voeten in de aarde.
	# Daarom hier als aparte subroutine
	# Benodigde ondersteunende modules worden hier eveneens geïnstalleerd
	#
	echo "   Installatie Drupal Commerce voor Drupal 8..."
	cd $wortel

	# Composer bijwerken
	###################################################################
	#
	# Hoeft niet elke keer
	#
	# sudo /usr/local/bin/composer/composer self-update

	# composer_manager
	###########################################################################################
	#
	# * Benodigd voor afhandelen php-libraries
	# * Heeft last van de Drush-loop
	#
	# drush en -y composer_manager
	# php modules/composer_manager/scripts/init.php

	# composer drupal-update
	###########################################################################################
	#
	# Foutmelding "Permission denied"? Dan eerst bestandsrechten bijwerken!
	#
	# * Begin 2016: Probleem jcalderonzumba-nog-wat
	# * 11 jan. 2016: Succesvol doorlopen
	# * 19. jan. 2016: Probleem + uplossing: 
	#   http://wiki.devliegendebrigade.nl/Drupal_Commerce_2.x_-_Installatie#Bronnen
	#
	# composer drupal-update

	# Benodigde ondersteunende modules
	############################################################################################
	#
	# Handig om die eerst expliciet te installeren,
	# ivm. eeuwige foutmeldingen Drush, die in een circeltje beweeg
	#
	# drush en -y entity
	# drush en -y state_machine
	# drush en -y address
	# drush en -y inline_entity_form
	# drush en -y profile

  	# Views
	################################
	#
	# Onmisbaar voor Drupal Commerce, omdat je veel dingen zelf moet bouwen mbv. Views
	#  
	# drush -y en views
	# drush -y en views_ui

	# Eigenlijke modules
	############################################################################################
	#
	# drush en -y commerce
	# drush en -y commerce_cart
	# drush en -y commerce_order
	# drush en -y commerce_price
	# drush en -y commerce_product
	# drush en -y commerce_store
	# drush en -y commerce_tax

fi

if [ "$blokken" = true ]; then

	####################################################################
	### Blocks
	####################################################################
	#
	# * Uitzetten van blokken, vereist geen additionele Drupal-module
	# * Zie http://wiki.devliegendebrigade.nl/Drush_block-disable
	# * Identiek voor Drupal 7 & 8?
	# * Moet deze subroutine twee keer uitgevoerd worden?
	#

	cd $wortel

	drush block-disable system powered-by
	drush block-disable user login
	drush block-disable node recent
	drush block-disable comment recent
	drush block-disable node recent
	drush block-disable node syndicate		
	drush block-disable user new
	drush block-disable user online

fi

if [ "$theme_7" = true ]; then

	####################################################################
	### Theme Drupal 7
	####################################################################
	#
	# * Begin 2016 (Drupal 7): Werkt perfect
	#
	# drush en -y adaptivetheme					# Nodig voor at_commerce
	 drush en -y at_commerce						# Subtheme van adaptivetheme
	 drush vset theme_default at_commerce
	 drush pm-disable -y bartik
	 drush pm-disable -y adaptivetheme
	 drush vset admin_theme -y seven

	# Fetch fresh.css
	############################################################################################
	#
	# * Aanname dat 'Seven' het standaard admin-theme is
	# * Vergeet niet om een regel toe te voegen aan seven.info om fresh.css te activeren
	# * En evt.: drush cc all
	#
	wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/themes/seven/fresh.css
	wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/sites/all/themes/at_commerce/css/fresh.css

fi

if [ "$theme_8" = true ]; then

	####################################################################
	### Theme Drupal 8
	####################################################################
	#
	# * at_commerce bestaat niet voor Drupal 8!
	#
	# * 19 jan. 2016: Drush-loop. Oplossing: Installatieregel adaptivetheme uitcommentariseren
	#
	# drush en -y adaptivetheme					# Nodig voor at_commerce
	 drush en -y at_commerce					# Subtheme van adaptivetheme
	 drush vset theme_default at_commerce
	 drush pm-uninstall -y bartik
	 drush pm-uninstall -y adaptivetheme
	 drush vset admin_theme -y seven

	# Fetch fresh.css
	############################################################################################
	#
	# * Aanname dat 'Seven' het standaard admin-theme is
	# * Vergeet niet om een regel toe te voegen aan seven.info om fresh.css te activeren
	# * En evt.: drush cc all
	#
	wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/themes/seven/fresh.css
	wget http://media.devliegendebrigade.nl/fresh.css -O $wortel/sites/all/themes/at_commerce/css/fresh.css

fi
####################################################################
### Klaar
####################################################################
#
echo "...Klaar!"