* code for task #2470.

This commit is contained in:
wangyidong
2016-02-24 13:06:59 +08:00
parent a261867468
commit 997f691665
5 changed files with 125 additions and 6 deletions
+34
View File
@@ -152,4 +152,38 @@ class misc extends control
$this->app->loadClass('qrcode');
QRcode::png($loginAPI . $session, false, 4, 9);
}
/**
* Check and repair database table.
*
* @param string $type
* @access public
* @return void
*/
public function checkTable($type = 'check')
{
if($type != 'check' and $type != 'repair') die();
if(!isset($_SESSION['checkFileName']))
{
$checkFileName = $this->app->getBasePath() . 'www' . DS . uniqid('repair_') . '.txt';
$this->session->set('checkFileName', $checkFileName);
}
$checkFileName = $this->session->checkFileName;
$this->view->title = $this->lang->misc->checkTable;
$status = '';
if(!file_exists($checkFileName) or (time() - filemtime($checkFileName)) > 60 * 10) $status = 'createFile';
if($status == 'createFile')
{
$this->app->loadLang('user');
$this->view->status = $status;
die($this->display());
}
$this->view->tables = $this->misc->getTableAndStatus($type);
$this->view->status = 'check';
$this->display();
}
}