game2006api/webapp/controller/ToolsController.class.php
aozhiwei 2f0cf183ff 1
2021-12-20 13:41:34 +08:00

35 lines
984 B
PHP

<?php
class ToolsController extends BaseController {
public function _handlePre()
{
parent::_handlePre();
if (SERVER_ENV == _ONLINE) {
die("can't create ToolsController");
return;
}
}
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("DROP TABLE {$tblName};",
array());
}
}
}
}