#/bin/bash
OUTPUT_DIR="/network/www5/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mappings/sprint"
NOW=`date +%Y%m%d-%H`
cd "$OUTPUT_DIR"
mkdir "$OUTPUT_DIR/data/$NOW"
echo "Saving dbpedia mapping sprint stats to $OUTPUT_DIR"
# TODO: don't hard-code all the languages here, get them from http://mappings.dbpedia.org/server/statistics/
# TODO: at least change the following lines to a loop: for lang in ar bg bn ... ; do ... ; done 
php update_percentage.php ar > "$OUTPUT_DIR/data/$NOW/ar.stats.json"
php update_percentage.php bg > "$OUTPUT_DIR/data/$NOW/bg.stats.json"
php update_percentage.php bn > "$OUTPUT_DIR/data/$NOW/bn.stats.json"
php update_percentage.php ca > "$OUTPUT_DIR/data/$NOW/ca.stats.json"
php update_percentage.php cs > "$OUTPUT_DIR/data/$NOW/cs.stats.json"
php update_percentage.php de > "$OUTPUT_DIR/data/$NOW/de.stats.json"
php update_percentage.php el > "$OUTPUT_DIR/data/$NOW/el.stats.json"
php update_percentage.php en > "$OUTPUT_DIR/data/$NOW/en.stats.json"
php update_percentage.php es > "$OUTPUT_DIR/data/$NOW/es.stats.json"
php update_percentage.php eu > "$OUTPUT_DIR/data/$NOW/eu.stats.json"
php update_percentage.php fr > "$OUTPUT_DIR/data/$NOW/fr.stats.json"
php update_percentage.php ga > "$OUTPUT_DIR/data/$NOW/ga.stats.json"
php update_percentage.php hi > "$OUTPUT_DIR/data/$NOW/hi.stats.json"
php update_percentage.php hr > "$OUTPUT_DIR/data/$NOW/hr.stats.json"
php update_percentage.php hu > "$OUTPUT_DIR/data/$NOW/hu.stats.json"
php update_percentage.php it > "$OUTPUT_DIR/data/$NOW/it.stats.json"
php update_percentage.php ja > "$OUTPUT_DIR/data/$NOW/ja.stats.json"
php update_percentage.php ko > "$OUTPUT_DIR/data/$NOW/ko.stats.json"
php update_percentage.php nl > "$OUTPUT_DIR/data/$NOW/nl.stats.json"
php update_percentage.php pl > "$OUTPUT_DIR/data/$NOW/pl.stats.json"
php update_percentage.php pt > "$OUTPUT_DIR/data/$NOW/pt.stats.json"
php update_percentage.php ru > "$OUTPUT_DIR/data/$NOW/ru.stats.json"
php update_percentage.php sl > "$OUTPUT_DIR/data/$NOW/sl.stats.json"
php update_percentage.php tr > "$OUTPUT_DIR/data/$NOW/tr.stats.json"
cp "$OUTPUT_DIR/data/$NOW"/* "$OUTPUT_DIR/data"
