Drupal System Upgrade
Drupal ist ein grandioses Programm, um eine größere Webseite ins Internet zu stellen. Es ist sicher kein Einsteigersystem. Dafür sind den Möglichkeiten dann kaum Grenzen gesetzt. Der Einstieg in Drupal war nie ganz leicht, die Versionierung und Modulpolitik hat mich jedoch immer verwundert. Als ich angefangen habe, stellte sich noch die Frage, ob ich mit Drupal 6 oder 7 starten sollte. Version 6 wurde als reifer und stabiler beschrieben. Version 8 war jedoch auch bereits in Entwicklung. Gerade für Neueinsteiger wäre es sicherlich sinnvoller gewesen zu sagen. Hier nimm 7 und das funktioniert dann auch. Jedoch waren noch nicht alle Module auf v7 portiert, dementsprechend war dieser Rat schwer zu geben.
Ich betreibe unter SCRMBlog noch ein Forschungs-Blog aus der Zeit während meiner Promotion. Ich bin dann doch auf v7 eingestiegen und habe es nie bereut. Ich weiß nicht bei welcher Unterversion ich eingestiegen bin. Die ersten Artikel müssten noch aus 2010 sein, also ziemlich früh. Aktuell ist Version 7.34. Das bedeutet seit 7.1 33 kleinere und größere Updates. Meinem Gefühl nach mindestens jedes zweite beinhaltet die Behebung schwerer Sicherheitslücken. Ich möchte gar nicht darüber diskutieren, ob das viel ist oder nicht. Aber es ist auf jeden Fall ärderlich, dass es (zumindest für solche Aktualisierungen) keine bessere Automatisierung der Updates gibt.
Insbesondere weil der Standard-Prozess für .-Versionsnummern immer dem folgenden Muster folgt:
- Log in as a user with the permission “Administer software updates”.
- Go to Administration > Configuration > Development > Maintenance mode. Enable the “Put site into maintenance mode” checkbox and save the configuration.
- Remove all old core files and directories, except for the ‘sites’ directory and any custom files you added elsewhere. If you made modifications to files like .htaccess or robots.txt, you will need to re-apply them from your backup, after the new files are in place.
- Download the latest Drupal 7.x release from http://drupal.org to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
- Re-apply any modifications to files such as .htaccess or robots.txt.
- Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your domain name). This will update the core database tables.
- Go to Administration > Reports > Status report. Verify that everything is working as expected.
- Ensure that $update_free_access is FALSE in settings.php.
- Go to Administration > Configuration > Development > Maintenance mode. Disable the “Put site into maintenance mode” checkbox and save the configuration. Daher habe ich mich entschlossen den Updateprozess endlich mittels eines Bash-Skripts zu automatisieren.
Die folgende Version habe ich entsprechend der Kommandos des letzte Updates geschrieben.
#!/bin/bash
cd […]/html/[domain.com]/
echo “RM everything but sites, .htacces, temp, robots.txt, humans.txt, ok?”
ls | grep -v ’(sites|human.txt|robots.txt|.htaccess)’
read
ls | grep -v ’(sites|human.txt|robots.txt|.htaccess)’ | xargs rm
echo “Move .htaccess to htaccess.old.txt”
mv .htaccess htaccess.old.txt
cd […]/html
wget http://drupal.org/files/projects/drupal-7.34.tar.gz
tar -zxvf drupal-7.34.tar.gz
cp -R drupal-7.34/* drupal-7.34/.htaccess scrmblog.com/
echo “Copy new .htaccess to htaccess.new.txt”
cd […]/html/[domain.com]/
cp .htaccess htaccess.new.txt
echo “Please go to http://[domain.com]/update.php, to finalize the update”
Das Skript ist noch nicht einmal getestet. Also bitte mit Vorsicht verwenden. Im nächsten Schritt muss es noch weiter parametrisiert werden.