#!/bin/bash if [ -z $1 ];then echo "Usage: make-all-blobs []" exit 1 fi server=$1 if [ -z $2 ]; then table=blobs else table=$2 fi if hostname --domain | grep -q wmflabs ; then FILE="$MEDIAWIKI_STAGING_DIR/dblists/all-labs.dblist" else FILE="$MEDIAWIKI_STAGING_DIR/dblists/all.dblist" fi # Assumes password is the same everywhere pass=$(echo 'echo $wgDBadminpassword;' | mwscript eval.php --wiki="enwiki"); for db in `<$FILE`;do echo "CREATE DATABASE IF NOT EXISTS $db" | mysql -u wikiadmin "-p$pass" -h $server && \ sed "s/blobs\>/$table/" blobs.sql | mysql -u wikiadmin "-p$pass" -h $server $db done