* remove clearData function.
This commit is contained in:
@@ -138,39 +138,4 @@ class adminModel extends model
|
||||
$register->email = $this->app->user->email;
|
||||
return $register;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear data.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function clearData()
|
||||
{
|
||||
$result = $this->dbh->query('SHOW TABLES')->fetchAll();
|
||||
if(!isset($this->config->global->showDemoUsers)) return false;
|
||||
|
||||
foreach($result as $item)
|
||||
{
|
||||
$table = current((array)$item);
|
||||
if(strpos($table, $this->config->db->prefix) === false) continue;
|
||||
if($table == $this->config->db->prefix . 'company') continue;
|
||||
if($table == $this->config->db->prefix . 'group') continue;
|
||||
if($table == $this->config->db->prefix . 'user')
|
||||
{
|
||||
$deleteUsers = array('productManager', 'projectManager', 'testManager', 'dev1', 'dev2', 'dev3', 'tester1', 'tester2', 'tester3');
|
||||
$this->dao->delete()->from($table)->where('account')->in($deleteUsers)->exec();
|
||||
if(dao::isError()) return false;
|
||||
continue;
|
||||
}
|
||||
if($table == $this->config->db->prefix . 'config')
|
||||
{
|
||||
$this->loadModel('setting')->deleteItems('key=showDemoUsers');
|
||||
if(dao::isError()) return false;
|
||||
continue;
|
||||
}
|
||||
if(!$this->dbh->query("TRUNCATE TABLE `$table`")) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user