Projet

Général

Profil

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

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

1
#!/bin/sh
2

    
3
. /home/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
echo 'Awaiting for git status. (may take a while)'
12
if ! work_tree_clean ; then
13
    echo "Your work tree is not clean. Solve this before $0 can continue."
14
    exit 2
15
fi
16

    
17
echo 'Delete database.'
18
mysql --defaults-extra-file=$myassos_cnf -e "DROP DATABASE $d7_site_name"
19

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

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

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

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

    
48
commit "Deletion of site: $d7_site_name"