* finish task #8701.
This commit is contained in:
@@ -727,6 +727,37 @@ class baseHelper
|
||||
session_id($sessionID);
|
||||
session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check DB to repair table.
|
||||
*
|
||||
* @param object $exception
|
||||
* @static
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public static function checkDB2Repair($exception)
|
||||
{
|
||||
global $config, $lang;
|
||||
|
||||
$repairCode = '|1034|1035|1194|1195|1459|';
|
||||
$errorInfo = $exception->errorInfo;
|
||||
$errorCode = $errorInfo[1];
|
||||
$errorMsg = $errorInfo[2];
|
||||
$message = $exception->getMessage();
|
||||
|
||||
if(strpos($repairCode, "|$errorCode|") !== false or ($errorCode == '1016' and strpos($errorMsg, 'errno: 145') !== false) or strpos($message, 'repair') !== false)
|
||||
{
|
||||
if(isset($config->framework->autoRepairTable) and $config->framework->autoRepairTable)
|
||||
{
|
||||
header("location: " . $config->webRoot . 'checktable.php');
|
||||
exit;
|
||||
}
|
||||
return $lang->repairTable;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------- 常用函数。Some tool functions.-------------------------------//
|
||||
|
||||
@@ -130,20 +130,7 @@ class router extends baseRouter
|
||||
}
|
||||
catch (PDOException $exception)
|
||||
{
|
||||
$repairCode = '|1034|1035|1194|1195|1459|';
|
||||
$errorInfo = $exception->errorInfo;
|
||||
$errorCode = $errorInfo[1];
|
||||
$errorMsg = $errorInfo[2];
|
||||
$message = $exception->getMessage();
|
||||
|
||||
if(strpos($repairCode, "|$errorCode|") !== false or ($errorCode == '1016' and strpos($errorMsg, 'errno: 145') !== false) or strpos($message, 'repair') !== false)
|
||||
{
|
||||
if(isset($config->framework->autoRepairTable) and $config->framework->autoRepairTable)
|
||||
{
|
||||
header("location: " . $config->webRoot . 'checktable.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
helper::checkDB2Repair($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,15 +136,6 @@ class baseDAO
|
||||
*/
|
||||
public $autoLang;
|
||||
|
||||
/**
|
||||
* 需要修复表的错误代码
|
||||
* The sql code of need repair table.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $repairCode = '|1034|1035|1194|1195|1459|';
|
||||
|
||||
/**
|
||||
* 执行的请求,所有的查询都保存在该数组。
|
||||
* The queries executed. Every query will be saved in this array.
|
||||
@@ -1383,16 +1374,9 @@ class baseDAO
|
||||
*/
|
||||
public function sqlError($exception)
|
||||
{
|
||||
$errorInfo = $exception->errorInfo;
|
||||
$errorCode = $errorInfo[1];
|
||||
$errorMsg = $errorInfo[2];
|
||||
$message = $exception->getMessage();
|
||||
if(strpos($this->repairCode, "|$errorCode|") !== false or ($errorCode == '1016' and strpos($errorMsg, 'errno: 145') !== false) or strpos($message, 'repair') !== false)
|
||||
{
|
||||
global $config;
|
||||
if(isset($config->framework->autoRepairTable) and $config->framework->autoRepairTable) die(js::locate($config->webRoot . 'checktable.php', 'top'));
|
||||
$message .= ' ' . $this->lang->repairTable;
|
||||
}
|
||||
$message = $exception->getMessage();
|
||||
$message .= ' ' . helper::checkDB2Repair($exception);
|
||||
|
||||
$sql = $this->sqlobj->get();
|
||||
$this->app->triggerError($message . "<p>The sql is: $sql</p>", __FILE__, __LINE__, $exit = true);
|
||||
}
|
||||
|
||||
+10
-5
@@ -61,11 +61,16 @@ if(!file_exists($checkFileName) or (time() - filemtime($checkFileName)) > 60 * 1
|
||||
|
||||
$lang = new stdclass();
|
||||
$lang->misc = new stdclass();
|
||||
$lang->storyCommon = '';
|
||||
$lang->productCommon = '';
|
||||
$lang->projectCommon = '';
|
||||
$lang->URCommon = '';
|
||||
$lang->SRCommon = '';
|
||||
$lang->storyCommon = '';
|
||||
$lang->productCommon = '';
|
||||
$lang->projectCommon = '';
|
||||
$lang->URCommon = '';
|
||||
$lang->SRCommon = '';
|
||||
$lang->productURCommon = '';
|
||||
$lang->productSRCommon = '';
|
||||
$lang->planCommon = '';
|
||||
$lang->projectSRCommon = '';
|
||||
$lang->projectURCommon = '';
|
||||
include "../module/common/lang/{$clientLang}.php";
|
||||
include "../module/misc/lang/{$clientLang}.php";
|
||||
if($status == 'createFile')
|
||||
|
||||
Reference in New Issue
Block a user