Project

General

Profile

Paste
Download (1.41 KB) Statistics
| Branch: | Revision:

root / bin / d7-all-update-core.sh @ master

1
#!/bin/sh
2

    
3
usage() {
4
    printf "This script is intended to help you update drupal core. It follows steps described here: https://forge.centrale-marseille.fr/projects/clubdrupal/wiki/Utilisation_de_Drupal_multi-site#Mise-à-jour-du-noyau-de-Drupal
5
Please do not launch in cron.\n"
6
}
7
. /home/assos/bin/print-help-if-required.sh
8

    
9

    
10
. /home/assos/bin/scripts-config.sh
11

    
12
if ! tty -s ; then
13
    echo "${help}"
14
    exit 1
15
fi
16

    
17
set -e # Exit immediatly if a command exits with a non zero value
18

    
19
# Backup translations
20
translations_backupdir=/var/tmp
21
cp "${translations_fr}" "${translations_backupdir}"
22

    
23
d7-all-dump-individual.sh -m manual
24

    
25
d7-all-drush.sh -y en update
26

    
27
cd "${d7_dir}"
28
drush -y upc drupal
29

    
30
d7-all-drush.sh -y updb
31

    
32
d7-all-drush.sh -y dis update
33

    
34
# Get the new subversion number:
35
# cd to $d7_dir, filter drush status to get the drupal version line,
36
# remove end line whitespaces, and get the 2 last caracters of the string.
37
drupal_version=$(cd "${d7_dir}" && drush status | grep "Drupal version" | tr -d ' ' | tail -c 3)
38

    
39
# Try to download new translation. If it fails, restore the old one.
40
if ! curl -f "http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.${drupal_version}.fr.po" -o "${translations_fr}" ; then
41
    cp "${translations_backupdir}/fr.po" "${translations_fr}"
42
fi
43

    
44
echo "Check for settings.php update."
45
echo "If everything is fine, run:"
46
echo -e "\tgit add -A drupal7 && git commit -m 'Udpate to 7.${drupal_version}'"