Project

General

Profile

Revision d4c4525a

Added by Julien Enselme almost 9 years ago

Use drush aliases to loop on all sites instead of sites.

Close #535

View differences:

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

  
10
if [ -n "$1" ] ; then
11
    param="$1" . /home/assos/bin/scripts-config-site.sh
12
    if [ "$1" = 'default' ] ; then
13
	cd "${d7_dir_sites}/default"
14
    else
15
	cd "${d7_site_dir}"
16
    fi
17
fi
10
site="$1"
18 11

  
19 12
current_timestamp=$(date "+%s")
20 13

  
......
22 15
random_2=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
23 16

  
24 17
####### General variables
25
drush -yq vset --always-set reverse_proxy TRUE
26
drush -yq vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]'
27
drush -yq ev "variable_set('update_notify_emails', array('$email_multi_assos_update'));"
28
drush -yq vset error_level 0
29
drush -yq vset dblog_row_limit 1000
30
drush -yq vset cron_safe_threshold 0
31
drush -yq vset file_temporary_path /var/tmp/assos/tmp
18
drush @"${site}" -yq vset --always-set reverse_proxy TRUE
19
drush @"${site}" -yq vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]'
20
drush @"${site}" -yq ev "variable_set('update_notify_emails', array('$email_multi_assos_update'));"
21
drush @"${site}" -yq vset error_level 0
22
drush @"${site}" -yq vset dblog_row_limit 1000
23
drush @"${site}" -yq vset cron_safe_threshold 0
24
drush @"${site}" -yq vset file_temporary_path /var/tmp/assos/tmp
32 25

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

  
45 38

  
46 39
####### Piwik
47
d7-reset-piwik-variables.sh "${d7_site_name}"
40
d7-reset-piwik-variables.sh "${site}"
48 41

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

  
65 58
###### Performance
66 59
# Active cache
67
drush -yq vset cache 1
68
drush -yq vset block_cache 1
60
drush @"${site}" -yq vset cache 1
61
drush @"${site}" -yq vset block_cache 1
69 62
# Lifetime : 0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200
70
drush -yq vset cache_lifetime 0
71
drush -yq vset page_cache_maximum_age 300
63
drush @"${site}" -yq vset cache_lifetime 0
64
drush @"${site}" -yq vset page_cache_maximum_age 300
72 65
# Compression
73
drush -yq vset page_compression 1
74
drush -yq vset preprocess_css 1
75
drush -yq vset preprocess_js 1
66
drush @"${site}" -yq vset page_compression 1
67
drush @"${site}" -yq vset preprocess_css 1
68
drush @"${site}" -yq vset preprocess_js 1

Also available in: Unified diff