function copyTable($oldtable, $newtable)
{
global $DB;
if (!TableExists($newtable) && TableExists($oldtable)) {
// Try to do a flush tables if RELOAD privileges available
// $query = "FLUSH TABLES `$oldtable`, `$newtable`";
// $DB->query($query);
$query = "CREATE TABLE `{$newtable}` LIKE `{$oldtable}`";
$DB->queryOrDie($query, $this->version . " create {$newtable}");
$query = "INSERT INTO `{$newtable}`\n (SELECT *\n FROM `{$oldtable}`)";
$DB->queryOrDie($query, $this->version . " copy from {$oldtable} to {$newtable}");
}
}