* finish task #8701.

This commit is contained in:
wangyidong
2020-12-17 09:28:48 +08:00
parent 570132c5b5
commit 451ed69d38
4 changed files with 45 additions and 38 deletions
+31
View File
@@ -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.-------------------------------//