Projet

Général

Profil

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

root / bin / d7-delete-site.sh @ 4127f213

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