summaryrefslogtreecommitdiff
path: root/FunnyQuestion.conf.php.sh
blob: 1ca39d1a2e0ac63245b77e5d454d8ee2d18d9eb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash

IP=$(realpath "$(dirname "$0")")

cmd="date -u +%V\`uname\`|sha256sum|sed 's/\W//g'"
answer="$(eval "$cmd")"

declare -A prompts
prompts[en]='What is the output of the command <tt>%s</tt>?'

{
	echo '<?php'
	echo -n '$wgFunnyQuestions = array('

	nl='\n'
	for lang in "${!prompts[@]}"; do
		printf "${nl}\t\"${lang}\" => array(\"${prompts[$lang]}\" => \"%s\")" "$cmd" "$answer"
		nl=',\n'
	done

	echo
	echo ');'
} > "$IP/FunnyQuestion.conf.php"

touch "$IP/extensions/FunnyQuestion/FunnyQuestion.i18n.php"