* remove clearData function.
This commit is contained in:
@@ -120,32 +120,4 @@ class admin extends control
|
||||
echo "Repairing TABLE: " . $result->Table . "\t" . $result->Msg_type . ":" . $result->Msg_text . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm clear data.
|
||||
*
|
||||
* @param string $confirm ''|no|yes
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function clearData($confirm = '')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->admin->confirmClearData, inlink('clearData', "confirm=yes")));
|
||||
}
|
||||
elseif($confirm == 'yes')
|
||||
{
|
||||
$result = $this->admin->clearData();
|
||||
|
||||
if(!$result) die(js::alert($this->lang->admin->clearDataFailed));
|
||||
|
||||
echo js::alert($this->lang->admin->clearDataSuccessfully);
|
||||
die(js::locate(inLink('index'), 'parent'));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->admin->clearData;
|
||||
$this->view->position[] = $this->lang->admin->clearData;
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,6 @@ $lang->admin->welcome = 'Welcome to ZenTaoPMS.';
|
||||
|
||||
$lang->admin->browseCompany = 'Browse Company';
|
||||
|
||||
$lang->admin->clearData = 'Reset';
|
||||
$lang->admin->pleaseInputYes = "Input 'yes' to reset zentao:";
|
||||
$lang->admin->confirmClearData = 'Are you sure to reset zentao?';
|
||||
$lang->admin->clearDataFailed = 'Failed to reset zentao!';
|
||||
$lang->admin->clearDataSuccessfully = 'Successfully reset zentao';
|
||||
$lang->admin->clearDataDesc = <<<EOT
|
||||
When you finish testing zentao, you can reset data inf zentao by using the reset feature. All data in database will be cleared except the data of company, department, user, group and priviledge. <br />
|
||||
<strong class='text-danger'>This action is very dangerous, think over before you do it!</strong>
|
||||
EOT;
|
||||
|
||||
$lang->admin->info = new stdclass();
|
||||
$lang->admin->info->caption = 'zentao information';
|
||||
$lang->admin->info->version = 'The current version of the system is %s,';
|
||||
|
||||
@@ -19,16 +19,6 @@ $lang->admin->welcome = '欢迎使用禅道管理软件后台管理系统';
|
||||
|
||||
$lang->admin->browseCompany = '浏览公司';
|
||||
|
||||
$lang->admin->clearData = '重置禅道';
|
||||
$lang->admin->pleaseInputYes = '确认重置禅道数据请输入yes:';
|
||||
$lang->admin->confirmClearData = '您确认要重置禅道数据吗?';
|
||||
$lang->admin->clearDataFailed = '禅道重置失败!';
|
||||
$lang->admin->clearDataSuccessfully = '禅道重置成功!';
|
||||
$lang->admin->clearDataDesc = <<<EOT
|
||||
当您测试禅道完毕之后,可以使用重置功能清除测试数据。该操作会保留公司、部门、用户和权限分组的数据,其他的数据会被清空。<br />
|
||||
<strong class='text-danger f-14px'>该功能存在极大的风险,执行之前务必三思!</strong>
|
||||
EOT;
|
||||
|
||||
$lang->admin->info = new stdclass();
|
||||
$lang->admin->info->caption = '禅道系统信息';
|
||||
$lang->admin->info->version = '当前系统的版本是%s,';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The view file of admin module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Congzhi Chen <congzhi@cnezsoft.com>
|
||||
* @package admin
|
||||
* @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class='container mw-700px'>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon('bolt');?></span>
|
||||
<strong><?php echo $lang->admin->clearData;?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class='alert mg-0'>
|
||||
<i class='icon-exclamation-sign text-danger'></i>
|
||||
<div class='content'>
|
||||
<?php echo nl2br($lang->admin->clearDataDesc);?>
|
||||
<hr>
|
||||
<div class='text-center'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo inLink('clearData', 'confirm=no')?>'>
|
||||
<div class='form-group' style='margin: 0 auto; max-width: 500px'>
|
||||
<div class='input-group w-p100' style='margin-bottom:10px'>
|
||||
<span class='input-group-addon'><?php echo $this->lang->admin->pleaseInputYes;?></span>
|
||||
<?php echo html::input('sure', '', "class='form-control' onkeyup='showClearButton()' autocomplete='off'");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo html::submitButton($lang->admin->clearData, "class='hidden btn-block btn btn-danger'");?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php $showDemoUsers = isset($this->config->global->showDemoUsers) ? true : false; js::set('showDemoUsers', $showDemoUsers);?>
|
||||
<?php if(!$bind and !$ignore and common::hasPriv('admin', 'register')):?>
|
||||
<div id="notice" class='alert alert-success'>
|
||||
<?php echo html::a(inlink('ignore'), '<i class="icon-remove"></i> ' . $lang->admin->notice->ignore, 'hiddenwin', 'class="close" data-dismiss="alert" style="font-size: 12px"');?>
|
||||
|
||||
@@ -277,7 +277,6 @@ $lang->admin->menu->index = array('link' => 'Index|admin|index');
|
||||
$lang->admin->menu->extension = array('link' => 'Extension|extension|browse', 'subModule' => 'extension,editor');
|
||||
$lang->admin->menu->custom = array('link' => 'Custom|custom|index', 'subModule' => 'custom');
|
||||
$lang->admin->menu->mail = array('link' => 'Email|mail|index', 'subModule' => 'mail');
|
||||
$lang->admin->menu->clearData = array('link' => 'Reset|admin|cleardata');
|
||||
$lang->admin->menu->convert = array('link' => 'Import|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->trashes = array('link' => 'Trash|action|trash', 'subModule' => 'action');
|
||||
|
||||
|
||||
@@ -277,7 +277,6 @@ $lang->admin->menu->index = array('link' => '首页|admin|index');
|
||||
$lang->admin->menu->extension = array('link' => '扩展|extension|browse', 'subModule' => 'extension,editor');
|
||||
$lang->admin->menu->custom = array('link' => '自定义|custom|index', 'subModule' => 'custom');
|
||||
$lang->admin->menu->mail = array('link' => '发信|mail|index', 'subModule' => 'mail');
|
||||
$lang->admin->menu->clearData = array('link' => '重置禅道|admin|cleardata');
|
||||
$lang->admin->menu->convert = array('link' => '导入|convert|index', 'subModule' => 'convert');
|
||||
$lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subModule' => 'action');
|
||||
|
||||
|
||||
@@ -446,9 +446,6 @@ class commonModel extends model
|
||||
|
||||
if(!isset($lang->$moduleName->menu)) {echo "<ul></ul>"; return;}
|
||||
|
||||
/* Unset clearData menu when the data of pms is demo. */
|
||||
if(!isset($app->config->global->showDemoUsers) or !$app->config->global->showDemoUsers) unset($lang->admin->menu->clearData);
|
||||
|
||||
/* Get the sub menus of the module, and get current module and method. */
|
||||
$submenus = $lang->$moduleName->menu;
|
||||
$currentModule = $app->getModuleName();
|
||||
|
||||
@@ -15,7 +15,6 @@ foreach(glob($moduleRoot . '/group/ext/lang/zh-cn/*.php') as $resourceFile)
|
||||
|
||||
$whiteList[] = 'api-getsessionid';
|
||||
$whiteList[] = 'admin-setflow';
|
||||
$whiteList[] = 'admin-cleardata';
|
||||
$whiteList[] = 'bug-buildtemplates';
|
||||
$whiteList[] = 'bug-sendmail';
|
||||
$whiteList[] = 'board-managechild';
|
||||
|
||||
@@ -630,17 +630,6 @@ function ajaxGetSearchForm()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the link of clearData.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function hideClearDataLink()
|
||||
{
|
||||
if(typeof showDemoUsers == 'undefined' || !showDemoUsers) $('#submenuclearData').addClass('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* add one option of a select to another select.
|
||||
*
|
||||
@@ -1186,8 +1175,6 @@ $(document).ready(function()
|
||||
autoCheck();
|
||||
toggleSearch();
|
||||
|
||||
hideClearDataLink();
|
||||
|
||||
$(window).resize(saveWindowSize); // When window resized, call it again.
|
||||
|
||||
if(needPing) setTimeout('setPing()', 1000 * 60); // After 5 minutes, begin ping.
|
||||
|
||||
Reference in New Issue
Block a user