Projet

Général

Profil

Paste
Télécharger (1,29 ko) Statistiques
| Branche: | Révision:

root / bin / d7-delete-site.sh @ 6c38d829

1 d52a5b2f jenselme
#!/bin/sh
2
3
. /users/guest/assos/bin/scripts-config.sh
4
. scripts-config-site.sh $1
5
. scripts-utils.sh
6
7
help="# ARGS: site name."
8
9
check_arguments $# 1 "$help"
10
11 6d91f38e Julien Enselme
if ! `work_tree_clean` ; then
12 1c1c5a42 Julien Enselme
    echo "Your work tree is not clean. Solve this before $0 can continue."
13
    exit 2
14
fi
15
16 d9dbe09c Julien Enselme
echo 'Delete database.'
17 e0225b3a Julien Enselme
mysql --defaults-extra-file=$myassos_cnf -e "DROP DATABASE $d7_site_name"
18 d52a5b2f jenselme
19 d9dbe09c Julien Enselme
echo 'Delete MYSQL user.'
20 6a0d836b Enselme Julien
mysql --defaults-extra-file=$myassos_cnf -e "DROP USER '$d7_site_name'@'%'"
21 d52a5b2f jenselme
22 d9dbe09c Julien Enselme
echo "Delete site's folder."
23 d52a5b2f jenselme
chmod -R 700 $d7_site_dir
24
rm -r $d7_site_dir
25
26
# Delete symbolic link.
27
rm $d7_dir/$d7_site_name
28
29 d9dbe09c Julien Enselme
echo 'Remove site line from sites.php'
30 593e9a63 Julien Enselme
chmod +w $sites_php
31 364f9fdd Julien Enselme
grep -sv "^\$.*$d7_site_name';$" $sites_php > $dir_tmp/sites.php
32
mv $dir_tmp/sites.php $sites_php
33 593e9a63 Julien Enselme
chmod 400 $sites_php
34
35 d9dbe09c Julien Enselme
echo 'Remove site alias from aliases.drushrc.php'
36 364f9fdd Julien Enselme
grep -sv "$d7_site_name'" $aliases_drushrc_php > $dir_tmp/aliases.php
37
mv $dir_tmp/aliases.php $aliases_drushrc_php
38 0e4152d9 Julien Enselme
39 d9dbe09c Julien Enselme
echo 'Delete database backups.'
40 d52a5b2f jenselme
rm -r $d7_dir_individual_auto_backup/assos.centrale-marseille.fr.$d7_site_name
41
rm -r $d7_dir_individual_manual_backup/assos.centrale-marseille.fr.$d7_site_name
42
43
echo "Don't forget to:"
44
echo "- Refresh node site on default"
45
echo "- Check particular behavior (normally detailed on site node)"
46 1c1c5a42 Julien Enselme
47
commit "Deletion of site: $d7_site_name"