Automating sql_upgrade.php script, take 2