Projet

Général

Profil

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

root / bin / d7-delete-site.sh @ cf6a035a

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
echo 'Delete database.'
17
mysql --defaults-extra-file=$myassos_cnf -e "DROP DATABASE $d7_site_name"
18

    
19
echo 'Delete MYSQL user.'
20
mysql --defaults-extra-file=$myassos_cnf -e "DROP USER '$d7_site_name'@'%'"
21

    
22
echo "Delete site's folder."
23
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
echo 'Remove site line from sites.php'
30
chmod +w $sites_php
31
grep -sv "^\$.*$d7_site_name';$" $sites_php > $dir_tmp/sites.php
32
mv $dir_tmp/sites.php $sites_php
33
chmod 400 $sites_php
34

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

    
39
echo 'Delete database backups.'
40
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

    
47
commit "Deletion of site: $d7_site_name"