Projet

Général

Profil

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

root / bin / d7-delete-site.sh @ 95df3862

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
db_password=`ask_password_db $db_server $db_user`
12

    
13
# Delete database.
14
mysql -h $db_server -u $db_user -p$db_password -e "DROP DATABASE $d7_site_name"
15

    
16
# Delete MYSQL user.
17
mysql -h $db_server -u $db_user -p$db_password -e "DROP USER '$d7_site_name'@'%'"
18

    
19
# Delete site's folder.
20
chmod -R 700 $d7_site_dir
21
rm -r $d7_site_dir
22

    
23
# Delete symbolic link.
24
rm $d7_dir/$d7_site_name
25

    
26
# Remove site line from sites.php
27
echo '<?php' > $d7_dir_sites/sites.tmp.php
28
while read line ; do
29
    grep -sv "^\$.*$d7_site_name';$" $line >> $d7_dir_sites/sites.tmp.php
30
done < $sites_php
31
chmod +w $sites_php
32
rm $sites_php
33
mv $d7_dir_sites/sites.tmp.php $sites_php
34
chmod 400 $sites_php
35

    
36
# Remove site alias from aliases.drushrc.php
37
grep -sv "$d7_site_name'" $aliases_drushrc_php > $aliases_drushrc_php
38

    
39
# 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)"