clearDB ok
This commit is contained in:
parent
159d15006f
commit
b14416766d
@ -11,18 +11,6 @@ class GMController {
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedis($team_uuid)
|
||||
{
|
||||
$redis_conf = getRedisConfig(crc32($team_uuid));
|
||||
$r = new phpcommon\Redis(array(
|
||||
'host' => $redis_conf['host'],
|
||||
'port' => $redis_conf['port'],
|
||||
'passwd' => $redis_conf['passwd']
|
||||
|
||||
));
|
||||
return $r;
|
||||
}
|
||||
|
||||
protected function getMysql($account_id)
|
||||
{
|
||||
$mysql_conf = getMysqlConfig(crc32($account_id));
|
||||
@ -38,7 +26,22 @@ class GMController {
|
||||
|
||||
public function clearDB()
|
||||
{
|
||||
|
||||
global $g_conf_mysql_cluster;
|
||||
foreach ($g_conf_mysql_cluster as $mysql_conf) {
|
||||
$conn = new phpcommon\Mysql(array(
|
||||
'host' => $mysql_conf['host'],
|
||||
'port' => $mysql_conf['port'],
|
||||
'user' => $mysql_conf['user'],
|
||||
'passwd' => $mysql_conf['passwd'],
|
||||
'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id']
|
||||
));
|
||||
$tables = $conn->execQueryAsArray('show tables;');
|
||||
foreach ($tables as $table) {
|
||||
$tblName = $table[0];
|
||||
$conn->execScript("DELETE FROM {$tblName};",
|
||||
arary());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getSysTime()
|
||||
@ -67,5 +70,4 @@ class GMController {
|
||||
$r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user