Scripts et taches planifiees » Historique » Version 62
Julien Enselme, 05/08/2013 18:47
d7-all-dump-individual.sh : add . scripts-utils.sh
1 | 1 | Julien Enselme | Afin de gagner du temps et d'éviter les erreurs humaines, des scripts ont été écrits tout au long du projet. Certains sont même exécutés automatiquement toutes les semaines. |
---|---|---|---|
2 | |||
3 | 13 | Florent Torregrosa | {{>toc}} |
4 | 1 | Julien Enselme | |
5 | h1. Les tâches planifiées |
||
6 | |||
7 | 26 | Florent Torregrosa | h2. Crontab |
8 | |||
9 | 3 | Julien Enselme | Pour exécuter ces tâches régulièrement, on utilise le "crontab":http://fr.wikipedia.org/wiki/Crontab. Il s'agit d'un programme installé sur notre serveur. |
10 | 1 | Julien Enselme | |
11 | 3 | Julien Enselme | Pour voir et modifier la liste des actions : |
12 | # se connecter au serveur : <code>ssh assos@sas1.centrale-marseille</code> |
||
13 | # taper la commande pour voir le crontab <code>crontab -l</code> |
||
14 | 47 | Julien Enselme | # taper la commande pour modifier le crontab <code>crontab -e</code>. |
15 | 1 | Julien Enselme | |
16 | 47 | Julien Enselme | {{important(Ne pas effectuer cette opération avant de s'être renseigné sur "vi":http://fr.wikipedia.org/wiki/Vi (l'éditeur de texte utilisé qui n'est pas vraiment intuitif :p) et sur "la syntaxe du crontab":http://fr.wikipedia.org/wiki/Crontab#Modification ! |
17 | Les scripts doivent si possible s’exécuter avant le club Drupal pour que les problèmes éventuels y soient réglés)}} |
||
18 | |||
19 | 52 | Julien Enselme | {{tip(Pour utiliser un autre éditeur que vi taper : export EDITOR=editor_name exemple : vim, nano |
20 | d7-all-update-contrib.sh fait des sauvegardes automatiques individuelles pour les sites drupal)}} |
||
21 | 26 | Florent Torregrosa | |
22 | <pre> |
||
23 | <code class="php"> |
||
24 | 42 | Florent Torregrosa | ######## How to use |
25 | # mm hh jj MMM JJJ task |
||
26 | # minutes hour day_month month day_week |
||
27 | # for more informations : https://fr.wikipedia.org/wiki/Crontab#Notation |
||
28 | ######## End how to |
||
29 | |||
30 | 43 | Florent Torregrosa | ### Traqu-heure |
31 | 43 6 * * * /users/guest/assos/bin/traqu_heure/script-restitution.sh > /dev/null 2>&1 |
||
32 | 0 * * * * /users/guest/assos/bin/traqu_heure/script-traque.sh > /dev/null 2>&1 |
||
33 | 1 | Julien Enselme | |
34 | |||
35 | 43 | Florent Torregrosa | ### Cleaning |
36 | 00 22 * * * /users/guest/assos/bin/all-reset-permissions.sh > /dev/null 2>&1 |
||
37 | 00 23 * * * /users/guest/assos/bin/delete-temporary-files.sh > /dev/null 2>&1 |
||
38 | 1 | Julien Enselme | |
39 | |||
40 | 43 | Florent Torregrosa | ### Databases |
41 | # Create backup |
||
42 | 00 21 * * 1 /users/guest/assos/bin/d7-all-dump-full.sh > /dev/null 2>&1 |
||
43 | 00 1 * * 2 /users/guest/assos/bin/d6-all-dump-full.sh > /dev/null 2>&1 |
||
44 | 42 | Florent Torregrosa | |
45 | 43 | Florent Torregrosa | # flush backup |
46 | 00 21 * * 2 /users/guest/assos/bin/flush-full-databases-backups.sh d7 > /dev/null 2>&1 |
||
47 | 00 22 * * 2 /users/guest/assos/bin/flush-full-databases-backups.sh d6 > /dev/null 2>&1 |
||
48 | 00 23 * * 2 /users/guest/assos/bin/flush-individual-databases-backups.sh auto d7 > /dev/null 2>&1 |
||
49 | 00 1 * * 3 /users/guest/assos/bin/flush-individual-databases-backups.sh manual d7 > /dev/null 2>&1 |
||
50 | 42 | Florent Torregrosa | |
51 | |||
52 | 43 | Florent Torregrosa | ### Updates for drupal 7 |
53 | 00 22 * * 3 /users/guest/assos/bin/d7-all-update-contrib.sh | mail -s "d7-all-update-contrib.sh" assos |
||
54 | 56 | Julien Enselme | 00 1 * * 3 /users/guest/assos/bin/d7-all-update-localisation.sh | mail -s "d7-all-update-localisation.sh" assos |
55 | 43 | Florent Torregrosa | 00 3 * * 3 /users/guest/assos/bin/d7-all-reset-variables.sh > /dev/null 2>&1 |
56 | 42 | Florent Torregrosa | |
57 | 44 | Florent Torregrosa | 00 5 * * 3 /users/guest/assos/bin/d7-all-releases-info.sh | mail -s "d7-all-releases-info.sh" assos |
58 | 43 | Florent Torregrosa | 00 23 * * 4 /users/guest/assos/bin/d7-all-security-review.sh |
59 | 42 | Florent Torregrosa | |
60 | |||
61 | 43 | Florent Torregrosa | # Updates for drupal 6 |
62 | 00 22 * * 6 /users/guest/assos/bin/d6-all-update-contrib.sh > /dev/null 2>&1 |
||
63 | 00 23 * * 6 /users/guest/assos/bin/d6-all-reset-variables.sh > /dev/null 2>&1 |
||
64 | 42 | Florent Torregrosa | |
65 | 43 | Florent Torregrosa | # Launch drush cron on fellowings |
66 | 45 17 * * * /users/guest/assos/bin/drushcronone assos.centrale-marseille.fr.ginfo > /dev/null 2>&1 |
||
67 | */15 * * * * /users/guest/assos/bin/drushcronone assos.centrale-marseille.fr.clubfinance > /dev/null 2>&1 |
||
68 | 45 3 * * * /users/guest/assos/bin/drushcronone default > /dev/null 2>&1 |
||
69 | 35 00 * * * /users/guest/assos/bin/drushcronone assos.centrale-marseille.fr.cac13 > /dev/null 2>&1 |
||
70 | */45 * * * * /users/guest/assos/bin/drushcronone assos.centrale-marseille.fr.expat > /dev/null 2>&1 |
||
71 | 1 | Julien Enselme | */10 * * * * /users/guest/assos/bin/drushcronone forum.centrale-marseille.fr > /dev/null 2>&1 |
72 | 44 | Florent Torregrosa | |
73 | 00 22 * * 7 /users/guest/assos/bin/disk-usage.sh | mail -s "disk-usage.sh" assos |
||
74 | 1 | Julien Enselme | |
75 | </code> |
||
76 | 25 | Florent Torregrosa | </pre> |
77 | 1 | Julien Enselme | |
78 | 25 | Florent Torregrosa | Voici la liste des tâches effectuées régulièrement. |
79 | 3 | Julien Enselme | |
80 | 25 | Florent Torregrosa | h2. La réinitialisation des variables |
81 | |||
82 | 1 | Julien Enselme | Cette tâche consiste à réinitialiser certaines variables qui donnent des droits considérés comme trop permissifs donc dangereux aux administrateurs des sites ou nécessaire pour d'autres scripts tels que piwik ou security_review. |
83 | |||
84 | 25 | Florent Torregrosa | En voici quelques exemples : |
85 | 1 | Julien Enselme | |
86 | <pre> |
||
87 | <code class="bash"> |
||
88 | 25 | Florent Torregrosa | drush -y vset error_level 0 |
89 | </code> |
||
90 | 1 | Julien Enselme | </pre> |
91 | 21 | Florent Torregrosa | |
92 | 25 | Florent Torregrosa | Cette commande permet de ne pas afficher les messages d'erreurs. En effet, ils contiennent parfois des informations sensibles sur l'installation et ne doivent donc pas être divulgués à n'importe qui. |
93 | |||
94 | 3 | Julien Enselme | <pre> |
95 | 1 | Julien Enselme | <code class="php"> |
96 | drush -y vset --always-set reverse_proxy TRUE |
||
97 | 25 | Florent Torregrosa | drush -y vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]' |
98 | 1 | Julien Enselme | </code> |
99 | 3 | Julien Enselme | </pre> |
100 | 1 | Julien Enselme | |
101 | 3 | Julien Enselme | Ces commandes permettent de déclarer à Drupal les serveurs proxy du CRI afin d'éviter qu'il ne répertorie tous les visiteurs comme ayant l'adresse des serveurs sus-cités. **Pas fini : voir http://assos.centrale-marseille.fr/content/t%C3%A2che/d%C3%A9clarer-les-proxy-du-cri-%C3%A0-drupal** |
102 | 1 | Julien Enselme | |
103 | 6 | Julien Enselme | h2. La sauvegarde des bases de données |
104 | 1 | Julien Enselme | |
105 | 3 | Julien Enselme | Sur les installations d6 et d7 : une fois par semaine |
106 | 1 | Julien Enselme | |
107 | 3 | Julien Enselme | On utilise les [[Scripts_et_taches_planifiees#Tout-sauvegarder|scripts de sauvegarde créés par le club Drupal]]. |
108 | 1 | Julien Enselme | |
109 | 3 | Julien Enselme | h2. La purge des sauvegardes de bdd |
110 | 1 | Julien Enselme | |
111 | Sur les installations d6 et d7 : toutes les semaines |
||
112 | |||
113 | Cette tâche utilise le script de [[Scripts_et_taches_planifiees#purge_des_sauvegardes.sh|purge des sauvegardes]] afin de libérer de l'espace disque en supprimant les sauvegardes de bdd les plus vieilles. |
||
114 | |||
115 | h1. Liste des scripts à disposition |
||
116 | 21 | Florent Torregrosa | |
117 | Les scripts utilisés sont hébergés dans le répertoire bin du compte assos. |
||
118 | |||
119 | 53 | Julien Enselme | h2. Configuration et utilitaires |
120 | 1 | Julien Enselme | |
121 | 53 | Julien Enselme | h3. scripts-config-site.sh |
122 | |||
123 | 21 | Florent Torregrosa | <pre> |
124 | <code class="php"> |
||
125 | #!/bin/sh |
||
126 | 1 | Julien Enselme | |
127 | 53 | Julien Enselme | # Sets useful variables of a site. |
128 | # ARGS: site_name |
||
129 | # Requires scripts-config.sh |
||
130 | |||
131 | # Check if scripts-config.sh is imported. |
||
132 | if [ -z $scripts_config ] ; then |
||
133 | echo "Import of scripts-config.sh required." |
||
134 | exit 1 |
||
135 | fi |
||
136 | |||
137 | if [ -z $1 ] ; then |
||
138 | echo "This script needs a site name as argument." |
||
139 | exit 1 |
||
140 | fi |
||
141 | |||
142 | scripts_config_site='imported' |
||
143 | |||
144 | d7_site_name=$1 |
||
145 | d7_site_dir="$d7_dir_sites/assos.centrale-marseille.fr.$d7_site_name" |
||
146 | d7_site_settings="$d7_site_dir/settings.php" |
||
147 | </code> |
||
148 | </pre> |
||
149 | |||
150 | h3. scripts-config.sh |
||
151 | |||
152 | <pre> |
||
153 | <code class="php"> |
||
154 | #!/bin/sh |
||
155 | |||
156 | PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/users/guest/assos/bin |
||
157 | PATH=$PATH:/usr/guest/assos/bin |
||
158 | |||
159 | scripts_config='imported' |
||
160 | |||
161 | email_multi_assos="assos@centrale-marseille.fr" |
||
162 | |||
163 | dir_multi_assos='/users/guest/assos' |
||
164 | dir_scripts="$dir_multi_assos/bin" |
||
165 | dir_template="$dir_multi_assos/template" |
||
166 | |||
167 | ###### Database |
||
168 | db_server="myassos.serv.int" |
||
169 | db_user="assos" |
||
170 | dir_log="$dir_multi_assos/log" |
||
171 | |||
172 | ###### Backup |
||
173 | db_full_backup_number=3 |
||
174 | db_individual_manual_backup_number=3 |
||
175 | db_individual_auto_backup_number=3 |
||
176 | |||
177 | dir_backup="$dir_multi_assos/backup" |
||
178 | dir_full_backup="$dir_backup/full" |
||
179 | dir_individual_backup="$dir_backup/individual" |
||
180 | dir_individual_manual_backup="$dir_individual_backup/manual" |
||
181 | dir_individual_auto_backup="$dir_individual_backup/auto" |
||
182 | |||
183 | |||
184 | ###### D7 variables |
||
185 | d7_dir="$dir_multi_assos/htmltest" |
||
186 | d7_dir_sites="$d7_dir/sites" |
||
187 | |||
188 | ### Log |
||
189 | d7_dir_log="$dir_log/d7" |
||
190 | |||
191 | ### Backup |
||
192 | d7_dir_full_backup="$dir_full_backup/d7" |
||
193 | d7_dir_individual_manual_backup="$dir_individual_manual_backup/d7" |
||
194 | d7_dir_individual_auto_backup="$dir_individual_auto_backup/d7" |
||
195 | |||
196 | ### Template |
||
197 | d7_settings_template_name="settings-D7-bddinde-template.php" |
||
198 | d7_settings_template="$dir_template/$d7_settings_template_name" |
||
199 | |||
200 | |||
201 | ###### D6 variables |
||
202 | d6_dir="$dir_multi_assos/html" |
||
203 | d6_dir_sites="$d6_dir/sites" |
||
204 | |||
205 | ### Backup |
||
206 | d6_dir_full_backup="$dir_full_backup/d6" |
||
207 | d6_dir_individual_manual_backup="$dir_individual_manual_backup/d6" |
||
208 | d6_dir_individual_auto_backup="$dir_individual_auto_backup/d6" |
||
209 | </code> |
||
210 | </pre> |
||
211 | |||
212 | h3. scripts-utils.sh |
||
213 | |||
214 | <pre> |
||
215 | <code class="php"> |
||
216 | #!/bin/sh |
||
217 | |||
218 | # This script contains useful functions for other scripts. |
||
219 | |||
220 | # Check if scripts-config.sh is imported. |
||
221 | if [ -z $scripts_config ] ; then |
||
222 | echo "Import of scripts-config.sh required." |
||
223 | 58 | Julien Enselme | . scripts-config.sh |
224 | 53 | Julien Enselme | fi |
225 | |||
226 | scripts_utils='imported' |
||
227 | |||
228 | ask_password() { |
||
229 | # read -s doesn't work with sh. |
||
230 | # usage: pass=`ask_password "password please:"` |
||
231 | echo $1 >&2 |
||
232 | echo -n ">" >&2 |
||
233 | stty_avant=`stty -g` |
||
234 | stty -echo |
||
235 | read password |
||
236 | stty $stty_avant |
||
237 | echo "$password" |
||
238 | unset password |
||
239 | } |
||
240 | |||
241 | ask_password_db() { |
||
242 | # ARGS: server_name, user_name |
||
243 | local db_password="pour_boucler" |
||
244 | # empty db request to validate password |
||
245 | while ! mysql -h $1 -u $2 -p$db_password -e "" 2>/dev/null ; do |
||
246 | db_password=`ask_password "database password:"` |
||
247 | done |
||
248 | echo $db_password |
||
249 | } |
||
250 | |||
251 | generate_password(){ |
||
252 | # ARGS: [password_length] |
||
253 | # The password contains special characters. '/' must be excluded to avoid sed malfunction. |
||
254 | |||
255 | local site_password='/' |
||
256 | |||
257 | if [ -z $1 ] ; then |
||
258 | local password_length=20 |
||
259 | else |
||
260 | local password_length=$1 |
||
261 | fi |
||
262 | |||
263 | while echo "$site_password" | grep -Fq '/' ; do |
||
264 | site_password=`dd if=/dev/urandom count=1 | uuencode -m - | head -n 2 | tail -n 1 | cut -c-$password_length` |
||
265 | done |
||
266 | |||
267 | echo $site_password |
||
268 | } |
||
269 | |||
270 | count_d7_sites(){ |
||
271 | find $d7_dir_sites -type d ! -name all -maxdepth 1 | wc -l |
||
272 | } |
||
273 | |||
274 | check_arguments() { |
||
275 | # ARGS: number of arguments passed to script, number of arguments required |
||
276 | if [ $1 -lt $2 ] ; then |
||
277 | echo "Number of arguments insuffisant." |
||
278 | exit 1 |
||
279 | fi |
||
280 | } |
||
281 | </code> |
||
282 | </pre> |
||
283 | |||
284 | h2. Scripts généraux |
||
285 | |||
286 | h3. all-reset-permissions.sh |
||
287 | |||
288 | <pre> |
||
289 | <code class="php"> |
||
290 | #!/bin/sh |
||
291 | |||
292 | 21 | Florent Torregrosa | . scripts-config.sh |
293 | |||
294 | # This script puts the correct permissions to sites folders, settings.php and scripts. |
||
295 | |||
296 | ######### drupal 6 |
||
297 | for dir in `find $d6_dir_sites -type d -maxdepth 1 -mindepth 1 ! -name all ! -name images ! -name languages` ; do |
||
298 | chmod 755 $dir |
||
299 | chmod 400 $dir/settings.php |
||
300 | 35 | Florent Torregrosa | done |
301 | |||
302 | ######### drupal 7 |
||
303 | for dir in `find $d7_dir_sites -type d -maxdepth 1 -mindepth 1 ! -name all` ; do |
||
304 | chmod 755 $dir |
||
305 | chmod 400 $dir/settings.php |
||
306 | 21 | Florent Torregrosa | done |
307 | |||
308 | 1 | Julien Enselme | ####### bin |
309 | 21 | Florent Torregrosa | chmod -R 700 $dir_scripts |
310 | |||
311 | ####### backup |
||
312 | chmod -R 700 $dir_backup |
||
313 | |||
314 | ####### log |
||
315 | chmod -R 700 $dir_log |
||
316 | </code> |
||
317 | 1 | Julien Enselme | </pre> |
318 | 21 | Florent Torregrosa | |
319 | 53 | Julien Enselme | h3. contrib-usage.sh |
320 | 29 | Florent Torregrosa | |
321 | 21 | Florent Torregrosa | <pre> |
322 | <code class="php"> |
||
323 | #!/bin/sh |
||
324 | |||
325 | . scripts-config.sh |
||
326 | . scripts-utils.sh |
||
327 | |||
328 | # ARGS: Drupal_version, project_status, project_name |
||
329 | # List sites that have the project_name with the corresponding project_status. |
||
330 | 41 | Florent Torregrosa | # project status: enabled or disabled |
331 | 21 | Florent Torregrosa | |
332 | check_arguments $# 3 |
||
333 | |||
334 | if [ $1 = d6 ] ; then |
||
335 | cd $d6_dir_sites |
||
336 | else |
||
337 | cd $d7_dir_sites |
||
338 | fi |
||
339 | 29 | Florent Torregrosa | |
340 | 21 | Florent Torregrosa | for dir in `find . -maxdepth 1 -mindepth 1 -type d ! -name all ! -name languages ! -name images | sort ` ; do |
341 | # List non-core projects that correspond to the status. |
||
342 | # Keep project_name if listed. |
||
343 | # Count line result. 0 if not listed or 1 if listed. |
||
344 | 1 | Julien Enselme | # Print site_dir if listed. |
345 | 21 | Florent Torregrosa | |
346 | cd $dir; |
||
347 | if [ 1 -eq `drush pml --no-core --status=$2 | grep $3 | wc -l` ] ; then |
||
348 | echo $dir; |
||
349 | fi |
||
350 | cd - |
||
351 | done |
||
352 | 1 | Julien Enselme | </code> |
353 | 21 | Florent Torregrosa | </pre> |
354 | |||
355 | 53 | Julien Enselme | h3. delete-temporary-files.sh |
356 | 21 | Florent Torregrosa | |
357 | 41 | Florent Torregrosa | <pre> |
358 | 21 | Florent Torregrosa | <code class="php"> |
359 | 1 | Julien Enselme | #!/bin/sh |
360 | |||
361 | . scripts-config.sh |
||
362 | 53 | Julien Enselme | |
363 | find $dir_multi_assos -name '*~' -delete |
||
364 | </code> |
||
365 | </pre> |
||
366 | |||
367 | h3. disk-usage.sh |
||
368 | |||
369 | <pre> |
||
370 | <code class="php"> |
||
371 | #!/bin/sh |
||
372 | |||
373 | . scripts-config.sh |
||
374 | |||
375 | echo -e "Quotas: 9.1 GB\n" |
||
376 | |||
377 | echo "Assos:" |
||
378 | du -hcs $dir_multi_assos | grep total |
||
379 | echo -e "\n" |
||
380 | |||
381 | echo "D6:" |
||
382 | cd $d6_dir_sites |
||
383 | du -h -d 1 |
||
384 | echo -e "\n" |
||
385 | |||
386 | echo "D7:" |
||
387 | cd $d7_dir_sites |
||
388 | du -h -d 1 |
||
389 | echo -e "\n" |
||
390 | |||
391 | echo "Logs:" |
||
392 | du -hcs $dir_log | grep total |
||
393 | echo -e "\n" |
||
394 | |||
395 | echo "Backups:" |
||
396 | cd $dir_backup |
||
397 | du -h -d 2 |
||
398 | </code> |
||
399 | </pre> |
||
400 | |||
401 | h3. drushcronone |
||
402 | |||
403 | <pre> |
||
404 | <code class="php"> |
||
405 | #!/bin/sh |
||
406 | |||
407 | . scripts-config.sh |
||
408 | |||
409 | if [ $# -lt 1 ]; then |
||
410 | echo "usage: $0 <site's folder name>" |
||
411 | exit 1 |
||
412 | fi |
||
413 | |||
414 | cd "$d6_sites_dir/$*" |
||
415 | pwd; |
||
416 | drush cron; |
||
417 | </code> |
||
418 | </pre> |
||
419 | |||
420 | h3. flush-files.sh |
||
421 | |||
422 | <pre> |
||
423 | <code class="php"> |
||
424 | #!/bin/sh |
||
425 | |||
426 | 60 | Julien Enselme | # ARGS: number of files to keep, [email address] |
427 | 53 | Julien Enselme | # usage: flush files from a folder except a number equal to argument. |
428 | |||
429 | # Check if scripts-config.sh is imported. |
||
430 | if [ -z $scripts_utils ] ; then |
||
431 | echo "Import of scripts-utils.sh required." |
||
432 | 57 | Julien Enselme | . scripts-utils.sh |
433 | 53 | Julien Enselme | fi |
434 | |||
435 | 60 | Julien Enselme | check_arguments $# 1 |
436 | 53 | Julien Enselme | |
437 | backups_number=`ls | wc -l` |
||
438 | 60 | Julien Enselme | let "number_of_backups_to_delete = backups_number - $1" > /dev/null |
439 | 53 | Julien Enselme | |
440 | 1 | Julien Enselme | if [ $number_of_backups_to_delete -gt 0 ] ; then |
441 | ls | head -$number_of_backups_to_delete | xargs rm |
||
442 | 53 | Julien Enselme | else |
443 | 60 | Julien Enselme | if [ ! -z $2 ] ; then |
444 | dir=`pwd` |
||
445 | echo "There are not enough files in $dir to Flush it. Check if backup script works fine." | mail -s "[db] $dir has a backup problem" $2 |
||
446 | fi |
||
447 | 53 | Julien Enselme | fi |
448 | </code> |
||
449 | </pre> |
||
450 | |||
451 | h3. flush-full-databases-backups.sh |
||
452 | |||
453 | <pre> |
||
454 | <code class="php"> |
||
455 | #!/bin/sh |
||
456 | |||
457 | . scripts-config.sh |
||
458 | |||
459 | # ARGS: Drupal version |
||
460 | |||
461 | cd $dir_full_backup/$1 |
||
462 | |||
463 | for dir in `ls` ; do |
||
464 | cd $dir |
||
465 | flush-files.sh $db_full_backup_number $email_multi_assos |
||
466 | cd - |
||
467 | done |
||
468 | </code> |
||
469 | </pre> |
||
470 | |||
471 | h3. flush-individual-databases-backups.sh |
||
472 | |||
473 | <pre> |
||
474 | <code class="php"> |
||
475 | #!/bin/sh |
||
476 | |||
477 | . scripts-config.sh |
||
478 | |||
479 | # ARGS: manual or auto, Drupal version |
||
480 | |||
481 | cd $dir_individual_backup/$1/$2 |
||
482 | |||
483 | for dir in `ls` ; do |
||
484 | cd $dir |
||
485 | if [ $1 = 'auto' ] ; then |
||
486 | flush-files.sh $db_individual_auto_backup_number $email_multi_assos |
||
487 | else |
||
488 | 61 | Julien Enselme | flush-files.sh $db_individual_manual_backup_number |
489 | 53 | Julien Enselme | fi |
490 | cd - |
||
491 | done |
||
492 | </code> |
||
493 | </pre> |
||
494 | |||
495 | h2. Scripts Drupal 6 |
||
496 | |||
497 | h3. d6-all-drush.sh |
||
498 | |||
499 | <pre> |
||
500 | <code class="php"> |
||
501 | #!/bin/sh |
||
502 | |||
503 | . scripts-config.sh |
||
504 | 21 | Florent Torregrosa | . scripts-utils.sh |
505 | |||
506 | # ARGS: drush_command |
||
507 | |||
508 | check_arguments $# 1 |
||
509 | |||
510 | for dir in `find $d6_dir_sites -maxdepth 1 -mindepth 1 -type d ! -name all ! -name languages ! -name images | sort` ; do |
||
511 | cd $dir |
||
512 | echo $dir |
||
513 | drush $* |
||
514 | 1 | Julien Enselme | done |
515 | 21 | Florent Torregrosa | </code> |
516 | 45 | Florent Torregrosa | </pre> |
517 | 21 | Florent Torregrosa | |
518 | 53 | Julien Enselme | h3. d6-all-dump-full.sh |
519 | 45 | Florent Torregrosa | |
520 | 37 | Florent Torregrosa | <pre> |
521 | <code class="php"> |
||
522 | #!/bin/sh |
||
523 | |||
524 | . scripts-config.sh |
||
525 | |||
526 | current_date=`date "+%Y-%m-%d-%Hh%Mm%Ss"` |
||
527 | |||
528 | # Dump D6 database with webassos user. |
||
529 | mysqldump --single-transaction webassos -h myweb.serv.int -u webassos --password=password > $d6_dir_full_backup/webassos/$current_date.webassos.sql |
||
530 | 41 | Florent Torregrosa | |
531 | 1 | Julien Enselme | # Dump D6 form database with forum user. |
532 | 37 | Florent Torregrosa | mysqldump forum -h myweb.serv.int -u forum --password=password > $d6_dir_full_backup/forum/$current_date.forum.sql |
533 | </code> |
||
534 | 39 | Florent Torregrosa | </pre> |
535 | 1 | Julien Enselme | |
536 | 53 | Julien Enselme | h3. d6-all-reset-variables.sh |
537 | 21 | Florent Torregrosa | |
538 | <pre> |
||
539 | <code class="php"> |
||
540 | #!/bin/sh |
||
541 | |||
542 | . scripts-config.sh |
||
543 | |||
544 | cd $d6_dir_sites |
||
545 | 1 | Julien Enselme | d6-all-drush.sh vset --always-set reverse_proxy TRUE |
546 | 21 | Florent Torregrosa | d6-all-drush.sh vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]' |
547 | drush @sites -y ev "variable_set('update_notify_emails', array('@email_multi_assos'));" |
||
548 | </code> |
||
549 | </pre> |
||
550 | |||
551 | 53 | Julien Enselme | h3. d6-all-update-contrib.sh |
552 | 21 | Florent Torregrosa | |
553 | <pre> |
||
554 | <code class="php"> |
||
555 | #!/bin/sh |
||
556 | |||
557 | . scripts-config.sh |
||
558 | |||
559 | d6-all-drush.sh -y en update |
||
560 | 1 | Julien Enselme | # Launch cron to check for updates. |
561 | 21 | Florent Torregrosa | d6-all-drush.sh -q cron |
562 | |||
563 | d6-all-drush.sh cc all |
||
564 | d6-all-dump-full.sh |
||
565 | |||
566 | d6-all-drush.sh -y upc --no-core |
||
567 | 1 | Julien Enselme | d6-all-drush.sh -y updb |
568 | |||
569 | d6-all-drush.sh -y dis update |
||
570 | |||
571 | d6-all-drush.sh cron |
||
572 | </code> |
||
573 | </pre> |
||
574 | 41 | Florent Torregrosa | |
575 | 53 | Julien Enselme | h3. d6-dump-individual.sh |
576 | 41 | Florent Torregrosa | |
577 | <pre> |
||
578 | <code class="php"> |
||
579 | #!/bin/sh |
||
580 | |||
581 | . scripts-config.sh |
||
582 | 21 | Florent Torregrosa | |
583 | # ARGS: auto or manual, site_prefix |
||
584 | # WARNING : backup are regularly flushed, put your backup in a safe place. |
||
585 | |||
586 | cd $dir_individual_backup |
||
587 | 1 | Julien Enselme | |
588 | #!/bin/sh |
||
589 | |||
590 | . scripts-config.sh |
||
591 | 21 | Florent Torregrosa | |
592 | 1 | Julien Enselme | # ARGS: auto or manual, site_prefix |
593 | 21 | Florent Torregrosa | # WARNING : backup are regularly flushed, put your backup in a safe place. |
594 | |||
595 | cd $dir_individual_backup |
||
596 | |||
597 | 41 | Florent Torregrosa | #récupération des tables du site dans le fichier liste_tables.temp |
598 | tables='_%' |
||
599 | liste="$1$tables" |
||
600 | |||
601 | 21 | Florent Torregrosa | mysql -h myweb.serv.int -u webassos --password=HBVH2ljgyZCA0AP251DY -BNe "show tables like '"$liste"'" webassos | tr '\r\n' ' ' > liste_tables.temp |
602 | |||
603 | #transformation de cette liste en une variable |
||
604 | var=$(cat liste_tables.temp) |
||
605 | |||
606 | 1 | Julien Enselme | #sauvegarde de toutes ces tables |
607 | 21 | Florent Torregrosa | current_date=`date "+%Y-%m-%d-%Hh%Mm%Ss"` |
608 | suffixe="_dump$current_date.sql" |
||
609 | fichier="$1$suffixe" |
||
610 | |||
611 | 1 | Julien Enselme | if [ $1 = 'auto' ] ; then |
612 | 21 | Florent Torregrosa | mysqldump webassos -h myweb.serv.int -u webassos --password=HBVH2ljgyZCA0AP251DY $var > $d6_dir_individual_auto_backup/$fichier |
613 | else |
||
614 | 1 | Julien Enselme | mysqldump webassos -h myweb.serv.int -u webassos --password=HBVH2ljgyZCA0AP251DY $var > $d6_dir_individual_manual_backup/$fichier |
615 | 21 | Florent Torregrosa | fi |
616 | 1 | Julien Enselme | |
617 | #suppression du fichier temporaire utilisé |
||
618 | 21 | Florent Torregrosa | rm liste_tables.temp |
619 | </code> |
||
620 | </pre> |
||
621 | |||
622 | 53 | Julien Enselme | h2. Scripts Drupal 7 |
623 | 30 | Florent Torregrosa | |
624 | 53 | Julien Enselme | h3. d7-all-drush-logged.sh |
625 | |||
626 | 1 | Julien Enselme | <pre> |
627 | 30 | Florent Torregrosa | <code class="php"> |
628 | #!/bin/sh |
||
629 | |||
630 | 21 | Florent Torregrosa | . scripts-config.sh |
631 | 30 | Florent Torregrosa | . scripts-utils.sh |
632 | |||
633 | 21 | Florent Torregrosa | # ARGS: drush_command |
634 | |||
635 | check_arguments $# 1 |
||
636 | 1 | Julien Enselme | |
637 | 21 | Florent Torregrosa | cd $d7_dir_sites |
638 | 1 | Julien Enselme | |
639 | 21 | Florent Torregrosa | for dir in `find . -maxdepth 1 -mindepth 1 -type d ! -name all | sort` ; do |
640 | cd $dir |
||
641 | current_date=`date "+%Y-%m-%d_%Hh:%Mm"` |
||
642 | echo "======$current_date======" >> $d7_dir_log/$dir.log |
||
643 | 1 | Julien Enselme | echo "Arguments are: $* " >> $d7_dir_log/$dir.log |
644 | 21 | Florent Torregrosa | drush $* >> $d7_dir_log/$dir.log |
645 | #To have the same caracters limit we needed 'end' that have 4 caracters, we used the Croate language for this ! LOL |
||
646 | echo -e "=============KRAJ=============\n" >> $d7_dir_log/$dir.log |
||
647 | cd - |
||
648 | done |
||
649 | </code> |
||
650 | </pre> |
||
651 | 41 | Florent Torregrosa | |
652 | 53 | Julien Enselme | h3. d7-all-drush.sh |
653 | 21 | Florent Torregrosa | |
654 | <pre> |
||
655 | <code class="php"> |
||
656 | #!/bin/sh |
||
657 | |||
658 | . scripts-config.sh |
||
659 | 1 | Julien Enselme | . scripts-utils.sh |
660 | 21 | Florent Torregrosa | |
661 | # ARGS: drush_command |
||
662 | |||
663 | 1 | Julien Enselme | check_arguments $# 1 |
664 | 21 | Florent Torregrosa | |
665 | for dir in `find $d7_dir_sites -maxdepth 1 -mindepth 1 -type d ! -name all | sort` ; do |
||
666 | cd $dir |
||
667 | echo $dir |
||
668 | drush $* |
||
669 | done |
||
670 | </code> |
||
671 | </pre> |
||
672 | |||
673 | 53 | Julien Enselme | h3. d7-all-dump-full.sh |
674 | 21 | Florent Torregrosa | |
675 | 45 | Florent Torregrosa | <pre> |
676 | 21 | Florent Torregrosa | <code class="php"> |
677 | 1 | Julien Enselme | #!/bin/sh |
678 | 21 | Florent Torregrosa | |
679 | . scripts-config.sh |
||
680 | |||
681 | current_date=`date "+%Y-%m-%d-%Hh%Mm%Ss"` |
||
682 | |||
683 | # Dump D7 databases at once. |
||
684 | mysqldump -h $db_server -u $db_user -ppassword --all-databases > $d7_dir_full_backup/myassos/$current_date.d7_full.sql |
||
685 | 41 | Florent Torregrosa | </code> |
686 | </pre> |
||
687 | |||
688 | 53 | Julien Enselme | h3. d7-all-dump-individual.sh |
689 | 21 | Florent Torregrosa | |
690 | <pre> |
||
691 | 41 | Florent Torregrosa | <code class="php"> |
692 | #!/bin/sh |
||
693 | |||
694 | 21 | Florent Torregrosa | . scripts-config.sh |
695 | 62 | Julien Enselme | . scripts-utils.sh |
696 | 21 | Florent Torregrosa | |
697 | # ARGS: auto or manual |
||
698 | 1 | Julien Enselme | |
699 | 21 | Florent Torregrosa | check_arguments $# 1 |
700 | |||
701 | current_date=`date "+%Y-%m-%d-%Hh%Mm%Ss"` |
||
702 | |||
703 | cd $d7_dir_sites |
||
704 | |||
705 | for dir in `find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-` ; do |
||
706 | 1 | Julien Enselme | cd $dir |
707 | 21 | Florent Torregrosa | drush cc all |
708 | if [ $1 = 'auto' ] ; then |
||
709 | drush sql-dump --result-file="$d7_dir_individual_auto_backup/$dir/$current_date.$dir.sql" |
||
710 | else |
||
711 | 1 | Julien Enselme | drush sql-dump --result-file="$d7_dir_individual_manual_backup/$dir/$current_date.$dir.sql" |
712 | 21 | Florent Torregrosa | fi |
713 | cd - |
||
714 | done |
||
715 | </code> |
||
716 | </pre> |
||
717 | |||
718 | 53 | Julien Enselme | h3. d7-all-releases-info.sh |
719 | 21 | Florent Torregrosa | |
720 | <pre> |
||
721 | <code class="php"> |
||
722 | #!/bin/sh |
||
723 | 1 | Julien Enselme | |
724 | . scripts-config.sh |
||
725 | |||
726 | # List version of a module or theme that exists in sites/all/* |
||
727 | # and all versions that are available for same project on drupal.org |
||
728 | |||
729 | # modules |
||
730 | cd $d7_dir_sites/all/modules |
||
731 | for dir in `ls -1` ; do |
||
732 | if [ -d $dir ] ; then |
||
733 | drush pm-releases $dir |
||
734 | fi |
||
735 | done |
||
736 | |||
737 | # themes |
||
738 | cd $d7_dir_sites/all/themes |
||
739 | for dir in `ls -1` ; do |
||
740 | if [ -d $dir ] ; then |
||
741 | drush pm-releases $dir |
||
742 | fi |
||
743 | 21 | Florent Torregrosa | done |
744 | </code> |
||
745 | </pre> |
||
746 | 41 | Florent Torregrosa | |
747 | 53 | Julien Enselme | h3. d7-all-reset-variables.sh |
748 | 41 | Florent Torregrosa | |
749 | 1 | Julien Enselme | <pre> |
750 | 41 | Florent Torregrosa | <code class="php"> |
751 | #!/bin/sh |
||
752 | |||
753 | . scripts-config.sh |
||
754 | |||
755 | for dir in `find $d7_dir_sites -maxdepth 1 -mindepth 1 -type d ! -name all | sort` ; do |
||
756 | cd $dir |
||
757 | echo $dir |
||
758 | d7-reset-variables.sh |
||
759 | done |
||
760 | </code> |
||
761 | 1 | Julien Enselme | </pre> |
762 | 41 | Florent Torregrosa | |
763 | 53 | Julien Enselme | h3. d7-all-security-review.sh |
764 | 41 | Florent Torregrosa | |
765 | <pre> |
||
766 | <code class="php"> |
||
767 | 1 | Julien Enselme | #!/bin/sh |
768 | 21 | Florent Torregrosa | |
769 | . scripts-config.sh |
||
770 | |||
771 | # grep -v success to keep site_name and error lines. |
||
772 | 59 | Florent Torregrosa | bash -c "d7-all-drush.sh security-review --store |& grep -v success | mail -s d7-all-security-review.sh $email_multi_assos" |
773 | 21 | Florent Torregrosa | </code> |
774 | </pre> |
||
775 | |||
776 | 53 | Julien Enselme | h3. d7-all-update-contrib.sh |
777 | 21 | Florent Torregrosa | |
778 | <pre> |
||
779 | <code class="php"> |
||
780 | #!/bin/sh |
||
781 | |||
782 | . scripts-config.sh |
||
783 | 1 | Julien Enselme | |
784 | 21 | Florent Torregrosa | d7-all-drush.sh -y en update |
785 | # Launch cron to check for updates. |
||
786 | d7-all-drush.sh -q cron |
||
787 | |||
788 | d7-all-dump-individual.sh auto |
||
789 | |||
790 | 1 | Julien Enselme | d7-all-drush-logged.sh -y upc --no-core |
791 | 21 | Florent Torregrosa | d7-all-drush.sh -y updb |
792 | |||
793 | d7-all-drush.sh -y dis update |
||
794 | |||
795 | d7-all-drush.sh cron |
||
796 | </code> |
||
797 | 1 | Julien Enselme | </pre> |
798 | 21 | Florent Torregrosa | |
799 | 53 | Julien Enselme | h3. d7-all-update-localisation.sh |
800 | 21 | Florent Torregrosa | |
801 | <pre> |
||
802 | <code class="php"> |
||
803 | #!/bin/sh |
||
804 | |||
805 | . scripts-config.sh |
||
806 | |||
807 | d7-all-drush.sh -y en l10n_update |
||
808 | d7-all-drush.sh l10n-update-refresh |
||
809 | d7-all-drush.sh l10n-update |
||
810 | d7-all-drush.sh -y dis l10n_update |
||
811 | </code> |
||
812 | </pre> |
||
813 | 41 | Florent Torregrosa | |
814 | 53 | Julien Enselme | h3. d7-create-site.sh |
815 | 1 | Julien Enselme | |
816 | 21 | Florent Torregrosa | <pre> |
817 | <code class="php"> |
||
818 | #!/bin/sh |
||
819 | 1 | Julien Enselme | |
820 | 21 | Florent Torregrosa | . scripts-config.sh |
821 | . scripts-config-site.sh $1 |
||
822 | . scripts-utils.sh |
||
823 | |||
824 | # ARGS: site name |
||
825 | |||
826 | ######## Exceptions |
||
827 | check_arguments $# 1 |
||
828 | |||
829 | # "-" is forbidden because it provokes database error. |
||
830 | if [ `echo $1 | grep -` ] ; then |
||
831 | echo '"-" is forbidden in the site name' |
||
832 | exit 1 |
||
833 | fi |
||
834 | |||
835 | # Site name length must be lower or equal to 16 due to database limitations. |
||
836 | if [`echo $1 | wc -c` -gt 16 ] ; then |
||
837 | 41 | Florent Torregrosa | echo "site name can't have more than 16 characters" |
838 | 21 | Florent Torregrosa | exit 1 |
839 | fi |
||
840 | |||
841 | 1 | Julien Enselme | ###### Initialisation |
842 | 21 | Florent Torregrosa | cd $d7_dir |
843 | db_password=`ask_password_db $db_server $db_user` |
||
844 | site_password=`generate_password` |
||
845 | |||
846 | # Check if site database already exists. |
||
847 | if mysql -h $db_server -u $db_user -e "USE $d7_site_name" -p$db_password 2>/dev/null ; then |
||
848 | echo "Database $d7_site_name already exists" |
||
849 | exit 1 |
||
850 | fi |
||
851 | |||
852 | # Check if site folder already exists. |
||
853 | if [ -d $d7_site_dir ] ; then |
||
854 | echo "Folder $d7_site_dir already exists" |
||
855 | exit 1 |
||
856 | fi |
||
857 | |||
858 | ###### Main |
||
859 | mkdir $d7_site_dir |
||
860 | dir_site_name="assos.centrale-marseille.fr.$d7_site_name" |
||
861 | |||
862 | # Backup requirements |
||
863 | 1 | Julien Enselme | mkdir $d7_dir_individual_auto_backup/$dir_site_name |
864 | 21 | Florent Torregrosa | mkdir $d7_dir_individual_manual_backup/$dir_site_name |
865 | current_date=`date "+%Y-%m-%d-%Hh%Mm%Ss"` |
||
866 | |||
867 | # NB : ls sort by considering the 1st characters |
||
868 | touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql |
||
869 | touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql2 |
||
870 | touch $d7_dir_individual_auto_backup/$dir_site_name/$current_date.$dir_site_name.sql3 |
||
871 | 1 | Julien Enselme | |
872 | 21 | Florent Torregrosa | # Create and grant privileges on database |
873 | mysql -h $db_server -u $db_user -e "CREATE DATABASE $d7_site_name" -p$db_password |
||
874 | mysql -h $db_server -u $db_user -e "GRANT ALL PRIVILEGES ON $d7_site_name.* TO '$d7_site_name'@'%' IDENTIFIED BY '$site_password'" -p$db_password |
||
875 | |||
876 | # Create settings.php |
||
877 | sed "s/\%\%DBUSER\%\%/$d7_site_name/ ; s/\%\%DBNAME\%\%/$d7_site_name/ ; s/\%\%DBPASS\%\%/$site_password/ ; s/\%\%nomsite\%\%/$d7_site_name/" < $d7_settings_template > $d7_site_settings |
||
878 | |||
879 | # Create symbolic link |
||
880 | cd $d7_dir |
||
881 | ln -s . $d7_site_name |
||
882 | |||
883 | # Next Instructions |
||
884 | echo "Go to http://assos.centrale-marseille.fr/$d7_site_name/install.php to continue." |
||
885 | echo "Press enter when ready to go on." |
||
886 | 1 | Julien Enselme | read key |
887 | 41 | Florent Torregrosa | |
888 | 21 | Florent Torregrosa | # Init variables |
889 | d7-reset-variables.sh $d7_site_name |
||
890 | |||
891 | # Permissions |
||
892 | chmod -R 755 $d7_site_dir |
||
893 | chmod 400 $d7_site_settings |
||
894 | |||
895 | # Last instructions |
||
896 | echo "Last instructions:" |
||
897 | echo "- Advice the webmaster to close account creation on the website" |
||
898 | echo "- Give the webmaster a link to the club Drupal's tutorials " |
||
899 | echo "- Create a node of type \"Site\" on default" |
||
900 | echo "- Register the webmaster on webmasters@listes.centrale-marseille.fr" |
||
901 | </code> |
||
902 | </pre> |
||
903 | |||
904 | 53 | Julien Enselme | h3. d7-delete-site.sh |
905 | 21 | Florent Torregrosa | |
906 | <pre> |
||
907 | <code class="php"> |
||
908 | #!/bin/sh |
||
909 | |||
910 | . scripts-config.sh |
||
911 | . scripts-config-site.sh $1 |
||
912 | . scripts-utils.sh |
||
913 | |||
914 | # ARGS: site name. |
||
915 | |||
916 | check_arguments $# 1 |
||
917 | |||
918 | db_password=`ask_password_db $db_server $db_user` |
||
919 | |||
920 | # Delete database. |
||
921 | mysql -h $db_server -u $db_user -p$db_password -e "DROP DATABASE $d7_site_name" |
||
922 | |||
923 | # Delete MYSQL user. |
||
924 | 1 | Julien Enselme | mysql -h $db_server -u $db_user -p$db_password -e "DROP USER '$d7_site_name'@'%'" |
925 | 21 | Florent Torregrosa | |
926 | # Delete site's folder. |
||
927 | chmod -R 700 $d7_site_dir |
||
928 | rm -r $d7_site_dir |
||
929 | |||
930 | 1 | Julien Enselme | # Delete symbolic link. |
931 | 21 | Florent Torregrosa | rm $d7_dir/$d7_site_name |
932 | |||
933 | # Delete database backups. |
||
934 | 1 | Julien Enselme | rm -r $d7_dir_individual_auto_backup/assos.centrale-marseille.fr.$d7_site_name |
935 | rm -r $d7_dir_individual_manual_backup/assos.centrale-marseille.fr.$d7_site_name |
||
936 | 21 | Florent Torregrosa | |
937 | echo "Don't forget to:" |
||
938 | echo "- Refresh node site on default" |
||
939 | echo "- Check particular behavior (normally detailed on site node)" |
||
940 | </code> |
||
941 | </pre> |
||
942 | |||
943 | 53 | Julien Enselme | h3. d7-reset-variables.sh |
944 | 1 | Julien Enselme | |
945 | 21 | Florent Torregrosa | <pre> |
946 | <code class="php"> |
||
947 | #!/bin/sh |
||
948 | |||
949 | . scripts-config.sh |
||
950 | |||
951 | # ARGS: [site_name] |
||
952 | |||
953 | if [ ! -z $1 ] ; then |
||
954 | . scripts-config-site.sh $1 |
||
955 | cd $d7_site_dir |
||
956 | fi |
||
957 | 1 | Julien Enselme | |
958 | 41 | Florent Torregrosa | current_timestamp=`date "+%s"` |
959 | 21 | Florent Torregrosa | |
960 | 41 | Florent Torregrosa | random_1=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "` |
961 | random_2=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "` |
||
962 | 21 | Florent Torregrosa | |
963 | ####### General variables |
||
964 | drush -y vset --always-set reverse_proxy TRUE |
||
965 | drush -y vset --always-set --format=json reverse_proxy_addresses '["147.94.19.16","147.94.19.17"]' |
||
966 | drush -y ev "variable_set('update_notify_emails', array('@email_multi_assos'));" |
||
967 | drush -y vset error_level 0 |
||
968 | drush -y vset dblog_row_limit 1000 |
||
969 | |||
970 | 1 | Julien Enselme | ###### Hidden captcha |
971 | 41 | Florent Torregrosa | drush -y en hidden_captcha |
972 | 21 | Florent Torregrosa | # Log wrong answers. |
973 | drush -y vset captcha_log_wrong_responses 1 |
||
974 | # Use hidden captcha for all forms. |
||
975 | drush -y sqlq --db-prefix "UPDATE {captcha_points} SET module = 'hidden_captcha', captcha_type = 'Hidden CAPTCHA' WHERE module is NULL;" |
||
976 | # Flush captcha cache. |
||
977 | drush -y vdel captcha_placement_map_cache |
||
978 | # Randomely generate a math question as the label of the hidden captcha field. |
||
979 | drush -y vset hidden_captcha_label "$random_1 + $random_2" |
||
980 | |||
981 | |||
982 | ####### Piwik |
||
983 | drush -y en piwik |
||
984 | drush -y vset piwik_site_id "101" |
||
985 | 41 | Florent Torregrosa | drush -y vset piwik_url_http "http://piwik.centrale-marseille.fr/" |
986 | 21 | Florent Torregrosa | drush -y vset piwik_url_https "https://piwik.centrale-marseille.fr/" |
987 | # Piwik cache. |
||
988 | drush -y vset piwik_cache 1 |
||
989 | drush -y vset piwik_visibility_roles "1" |
||
990 | # Piwik is enable for everyone except the administrator |
||
991 | drush -y vset --format=json piwik_roles '[3]' |
||
992 | drush -y vset piwik_page_title_hierarchy 1 |
||
993 | # Activate local search. |
||
994 | drush -y vset piwik_site_search 1 |
||
995 | |||
996 | |||
997 | ###### Security review |
||
998 | # For untrusted roles: |
||
999 | 41 | Florent Torregrosa | # 1: anonymous user |
1000 | 21 | Florent Torregrosa | # 2: authenticated user |
1001 | # 3: administrator |
||
1002 | drush -y en security_review |
||
1003 | 11 | Julien Enselme | drush -y ev "variable_set('security_review_untrusted_roles', array('1'));" |
1004 | 54 | Florent Torregrosa | # Used to initialise entries in the database schema. |
1005 | drush security-review --store |
||
1006 | # Security review can't check for files permissions on multi_assos if launched within the web interface. |
||
1007 | drush -y sqlq --db-prefix "UPDATE {security_review} SET skip = '1', skiptime = $current_timestamp, skipuid = '1' WHERE reviewcheck IN ('file_perms');" |
||
1008 | drush -y sqlq --db-prefix "UPDATE {security_review} SET skip = '0', skiptime = '0', skipuid = NULL WHERE reviewcheck NOT IN ('file_perms');" |
||
1009 | 1 | Julien Enselme | </code> |
1010 | </pre> |