Projet

Général

Profil

Paste
Télécharger (2,98 ko) Statistiques
| Branche: | Révision:

root / bin / d7-reset-variables.sh @ 653aeb8e

1
#!/bin/sh
2

    
3
usage() {
4
    echo "ARGS: [site_name]"
5
}
6

    
7
. /home/assos/bin/scripts-config.sh
8
. /home/assos/bin/print-help-if-required.sh
9

    
10
if [ -n "$1" ] ; then
11
    param="$1" /home/assos/bin/scripts-config-site.sh
12
    # default is an exception to the rule
13
    # find returns the name of the as the absolute path, hence the use of grep
14
    # and not =
15
    if echo "$1" | grep -q default ; then
16
	cd "${d7_dir_sites}/default"
17
    else
18
	cd "${d7_site_dir}"
19
    fi
20
fi
21

    
22
current_timestamp=$(date "+%s")
23

    
24
random_1=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
25
random_2=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
26

    
27
####### General variables
28
drush -yq vset --always-set reverse_proxy TRUE
29
drush -yq vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]'
30
drush -yq ev "variable_set('update_notify_emails', array('$email_multi_assos_update'));"
31
drush -yq vset error_level 0
32
drush -yq vset dblog_row_limit 1000
33
drush -yq vset cron_safe_threshold 0
34
drush -yq vset file_temporary_path /var/tmp/assos/tmp
35

    
36
###### Captcha
37
drush -yq en hidden_captcha
38
# Do not log wrong answers.
39
drush -yq vset captcha_enable_stats 0
40
drush -yq vset captcha_log_wrong_responses 0
41
# Use hidden captcha for all forms.
42
drush -yq sqlq --db-prefix "UPDATE {captcha_points} SET module = 'hidden_captcha', captcha_type = 'Hidden CAPTCHA' WHERE module is NULL;"
43
# Flush captcha cache.
44
drush -yq vdel captcha_placement_map_cache
45
# Randomly generate a math question as the label of the hidden captcha field.
46
drush -yq vset hidden_captcha_label "$random_1 + $random_2"
47

    
48

    
49
####### Piwik
50
d7-reset-piwik-variables.sh "${d7_site_name}"
51

    
52
###### Security review
53
# For untrusted roles:
54
# 1: anonymous user
55
# 2: authenticated user
56
# 3: administrator
57
drush -yq en security_review
58
drush -yq ev "variable_set('security_review_untrusted_roles', array('1'));"
59
# The default method to check settings.php do not work because we include a global and local settings.php
60
drush -yq vset security_review_base_url_method include
61
# Used to initialise entries in the database schema.
62
drush -yq security-review --store
63
# file_perms : Security Review can't check for files permissions on multi_assos if launched within the web interface.
64
# private_files : we have chosen a private path in the files repository and Security Review raise errors but this path is secure.
65
drush -yq sqlq --db-prefix "UPDATE {security_review} SET skip = '1', skiptime = $current_timestamp, skipuid = '1' WHERE reviewcheck IN ('file_perms', 'private_files');"
66
drush -yq sqlq --db-prefix "UPDATE {security_review} SET skip = '0', skiptime = '0', skipuid = NULL WHERE reviewcheck NOT IN ('file_perms', 'private_files');"
67

    
68
###### Performance
69
# Active cache
70
drush -yq vset cache 1
71
drush -yq vset block_cache 1
72
# Lifetime : 0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200
73
drush -yq vset cache_lifetime 0
74
drush -yq vset page_cache_maximum_age 300
75
# Compression
76
drush -yq vset page_compression 1
77
drush -yq vset preprocess_css 1
78
drush -yq vset preprocess_js 1