/** * This file is a part of MyWebSQL package * * @file: modules/dbbatch.php * @author Samnan ur Rehman * @copyright (c) 2008-2014 Samnan ur Rehman * @web http://mywebsql.net * @license http://mywebsql.net/license */ function processRequest(&$db) { if (v($_REQUEST["id"]) == 'batch') { $stats = array(); $commands = array(); if (v($_POST['skip_fkey']) == "on") { $db->set_constraint('fkey', false); } // generate commands first before doing drop operations if (v($_POST['command']) != '') { $commands = generate_commands($db, v($_POST['command'])); } if (v($_POST['dropcmd']) == 'on') { $stats['drop'] = drop_objects($db); } else { if (v($_POST['old_prefix']) != '') { $stats['delprefix'] = remove_prefix($db, v($_POST['old_prefix'])); } if (v($_POST['new_prefix']) != '') { $stats['addprefix'] = add_prefix($db, v($_POST['new_prefix'])); } } $replace = array(); $data = array('stats' => $stats, 'queries' => $commands); echo view('dbbatch_results', $replace, $data); } else { $object_list = $db->getObjectList(); $replace = array(); $folder = $db->name(); echo view(array($folder . '/dbbatch', 'dbbatch'), $replace, $object_list); } }
function recv_wait() { global $WAIT_SOCK; $ret = trim(stream_get_contents($WAIT_SOCK)); $ret = preg_replace('/^((Last-Modified|Expires): )[^\\r\\n]+/m', '$1***', $ret); $ret = preg_replace('/(: )"(\\d\\d\\d\\d\\d+\\.\\d\\d+)"/s', '${1}<cursor>', $ret); echo add_prefix($ret, 'WA -->') . "\n"; disconnect_wait(true); }