Project

General

Profile

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

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

1
#!/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
if ! `work_tree_clean` ; then
12
    echo "Your work tree is not clean. Solve this before $0 can continue."
13
    exit 2
14
fi
15

    
16
db_password=`ask_password_db $db_server $db_user`
17

    
18
echo 'Delete database.'
19
mysql -h $db_server -u $db_user -p$db_password -e "DROP DATABASE $d7_site_name"
20

    
21
echo 'Delete MYSQL user.'
22
mysql -h $db_server -u $db_user -p$db_password -e "DROP USER '$d7_site_name'@'%'"
23

    
24
echo "Delete site's folder."
25
chmod -R 700 $d7_site_dir
26
rm -r $d7_site_dir
27

    
28
# Delete symbolic link.
29
rm $d7_dir/$d7_site_name
30

    
31
echo 'Remove site line from sites.php'
32
chmod +w $sites_php
33
grep -sv "^\$.*$d7_site_name';$" $sites_php > $dir_tmp/sites.php
34
mv $dir_tmp/sites.php $sites_php
35
chmod 400 $sites_php
36

    
37
echo 'Remove site alias from aliases.drushrc.php'
38
grep -sv "$d7_site_name'" $aliases_drushrc_php > $dir_tmp/aliases.php
39
mv $dir_tmp/aliases.php $aliases_drushrc_php
40

    
41
echo 'Delete database backups.'
42
rm -r $d7_dir_individual_auto_backup/assos.centrale-marseille.fr.$d7_site_name
43
rm -r $d7_dir_individual_manual_backup/assos.centrale-marseille.fr.$d7_site_name
44

    
45
echo "Don't forget to:"
46
echo "- Refresh node site on default"
47
echo "- Check particular behavior (normally detailed on site node)"
48

    
49
commit "Deletion of site: $d7_site_name"