@@ -207,6 +207,32 @@ is_drupal_root() {
207
207
return 0
208
208
}
209
209
210
+ # Writes a drushrc.php file to /tmp
211
+ write_drushrc () {
212
+ echo " <?php" > ' /tmp/drushrc.php'
213
+ echo " // Drush commands should always be run in en." >> ' /tmp/drushrc.php'
214
+ echo " \$ options['variables']['language_default'] = (object) array(" >> ' /tmp/drushrc.php'
215
+ echo " 'language' => 'en'," >> ' /tmp/drushrc.php'
216
+ echo " 'name' => 'English'," >> ' /tmp/drushrc.php'
217
+ echo " 'native' => 'English'," >> ' /tmp/drushrc.php'
218
+ echo " 'direction' => '0'," >> ' /tmp/drushrc.php'
219
+ echo " 'enabled' => 1," >> ' /tmp/drushrc.php'
220
+ echo " 'plurals' => '0'," >> ' /tmp/drushrc.php'
221
+ echo " 'formula' => ''," >> ' /tmp/drushrc.php'
222
+ echo " 'domain' => ''," >> ' /tmp/drushrc.php'
223
+ echo " 'prefix' => 'en'," >> ' /tmp/drushrc.php'
224
+ echo " 'weight' => '0'," >> ' /tmp/drushrc.php'
225
+ echo " 'javascript' => ''," >> ' /tmp/drushrc.php'
226
+ echo " );" >> ' /tmp/drushrc.php'
227
+ }
228
+
229
+ # Removes the drushrc.php file from /tmp if it exists
230
+ remove_drushrc () {
231
+ if [ -f ' /tmp/drushrc.php' ]; then
232
+ rm -f ' /tmp/drushrc.php'
233
+ fi
234
+ }
235
+
210
236
211
237
# ###########################################################
212
238
# Drush check functions
@@ -363,9 +389,8 @@ check_core_warnings() {
363
389
return $EXIT_UNKNOWN
364
390
fi
365
391
366
- # Only keep "Warnung", "Warning", ... TODO: Other languages or make it outut always in english
367
- # But how???
368
- _core_warnings=" $( echo " ${_core_warnings} " | grep -E ' Warning|Warnung' ) "
392
+ # Only keep "Warning"
393
+ _core_warnings=" $( echo " ${_core_warnings} " | grep -E ' Warning' ) "
369
394
370
395
# Trim the string
371
396
_core_warnings=" $( trim_lines " ${_core_warnings} " ) "
@@ -696,6 +721,10 @@ while test -n "$1"; do
696
721
shift
697
722
done
698
723
724
+ # Use a drushrc.php file to set the language to english
725
+ write_drushrc
726
+ DRUSH=" ${DRUSH} --config=/tmp/drushrc.php"
727
+
699
728
700
729
# ###########################################################
701
730
# Validate arguments
@@ -1005,5 +1034,7 @@ else
1005
1034
exit " $NAGIOS_EXIT "
1006
1035
fi
1007
1036
1037
+ remove_drushrc
1038
+
1008
1039
# " vim: set ts=4:
1009
1040
0 commit comments