Projet

Général

Profil

Paste
Télécharger (867 octets) Statistiques
| Branche: | Révision:

root / bin / captcha.sh @ e253ff2a

1
#!/bin/sh
2
PATH=/usr/local/bin:/usr/bin:/bin
3
##############
4
# Sets hidden captcha configuration for all D7 websites.
5
##############
6

    
7
init_scripts.sh
8

    
9
cd $d7_sites_dir
10

    
11
for dir in $(ls)
12
do
13
  if [ -d $dir -a ! -L $dir ]
14
  then
15
      cd $dir;
16
      echo "Configuration hidden captcha pour $x"
17
      # Enable hidden_captcha module.
18
      drush -y en hidden_captcha
19
      # Log wrong answers.
20
      drush -y vset captcha_log_wrong_responses 1
21
      # Use hidden captcha for all forms.
22
      drush -y sqlq --db-prefix "UPDATE {captcha_points} SET module = 'hidden_captcha', captcha_type = 'Hidden CAPTCHA' WHERE module is NULL;"
23
      # Flush captcha cache.
24
      drush -y vdel captcha_placement_map_cache
25
      # Randomely generate a math question as the label of the hidden captcha field.
26
      drush -y vset hidden_captcha_label "$RANDOM + $RANDOM"
27
      cd -;
28
  fi
29
done