Projet

Général

Profil

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

root / bin / d7-reset-variables.sh @ 8550e097

1
#!/bin/sh
2

    
3
. /home/assos/bin/scripts-config.sh
4

    
5
# ARGS: [site_name]
6

    
7
if [ -n "$1" ] ; then
8
    . scripts-config-site.sh "$1"
9
    # default is an exception to the rule
10
    if echo "$1" | grep default > /dev/null ; then
11
	    cd "${d7_dir_sites}/default"
12
    else
13
	cd "${d7_site_dir}"
14
    fi
15
fi
16

    
17
current_timestamp=$(date "+%s")
18

    
19
random_1=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
20
random_2=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
21

    
22
####### General variables
23
drush -yq vset --always-set reverse_proxy TRUE
24
drush -yq vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]'
25
drush -yq ev "variable_set('update_notify_emails', array('$email_multi_assos_update'));"
26
drush -yq vset error_level 0
27
drush -yq vset dblog_row_limit 1000
28
drush -yq vset cron_safe_threshold 0
29

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

    
42

    
43
####### Piwik
44
d7-reset-piwik-variables.sh "${d7_site_name}"
45

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

    
62
###### Performance
63
# Active cache
64
drush -yq vset cache 1
65
drush -yq vset block_cache 1
66
# Lifetime : 0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200
67
drush -yq vset cache_lifetime 0
68
drush -yq vset page_cache_maximum_age 300
69
# Compression
70
drush -yq vset page_compression 1
71
drush -yq vset preprocess_css 1
72
drush -yq vset preprocess_js 1