Project

General

Profile

Paste
Download (2.63 KB) Statistics
| Branch: | Revision:

root / bin / d7-reset-variables.sh @ 95df3862

1
#!/bin/sh
2

    
3
. /users/guest/assos/bin/scripts-config.sh
4

    
5
# ARGS: [site_name]
6

    
7
if [ ! -z $1 ] ; then
8
    . scripts-config-site.sh $1
9
    cd $d7_site_dir
10
fi
11

    
12
current_timestamp=`date "+%s"`
13

    
14
random_1=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "`
15
random_2=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "`
16

    
17
####### General variables
18
drush -y vset --always-set reverse_proxy TRUE
19
drush -y vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]'
20
drush -y ev "variable_set('update_notify_emails', array('$email_multi_assos'));"
21
drush -y vset error_level 0
22
drush -y vset dblog_row_limit 1000
23
drush -y vset cron_safe_threshold 0
24

    
25
###### Hidden captcha
26
drush -y en hidden_captcha
27
# Log wrong answers.
28
drush -y vset captcha_log_wrong_responses 1
29
# Use hidden captcha for all forms.
30
drush -y sqlq --db-prefix "UPDATE {captcha_points} SET module = 'hidden_captcha', captcha_type = 'Hidden CAPTCHA' WHERE module is NULL;"
31
# Flush captcha cache.
32
drush -y vdel captcha_placement_map_cache
33
# Randomely generate a math question as the label of the hidden captcha field.
34
drush -y vset hidden_captcha_label "$random_1 + $random_2"
35

    
36

    
37
####### Piwik
38
drush -y en piwik
39
drush -y vset piwik_site_id "101"
40
drush -y vset piwik_url_http "http://piwik.centrale-marseille.fr/"
41
drush -y vset piwik_url_https "https://piwik.centrale-marseille.fr/"
42
# Piwik cache.
43
drush -y vset piwik_cache 1
44
drush -y vset piwik_visibility_roles "1"
45
# Piwik is enable for everyone except the administrator
46
drush -y vset --format=json piwik_roles '[3]'
47
drush -y vset piwik_page_title_hierarchy 1
48
# Activate local search.
49
drush -y vset piwik_site_search 1
50

    
51

    
52
###### Security review
53
# For untrusted roles:
54
# 1: anonymous user
55
# 2: authenticated user
56
# 3: administrator
57
drush -y en security_review
58
drush -y 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 vset security_review_base_url_method include
61
# Used to initialise entries in the database schema.
62
drush 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 -y sqlq --db-prefix "UPDATE {security_review} SET skip = '1', skiptime = $current_timestamp, skipuid = '1' WHERE reviewcheck IN ('file_perms', 'private_files');"
66
drush -y sqlq --db-prefix "UPDATE {security_review} SET skip = '0', skiptime = '0', skipuid = NULL WHERE reviewcheck NOT IN ('file_perms', 'private_files');"