From 73bf63b4a4d6ba323e3701656ff3163db7a16f83 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 8 May 2017 10:48:51 +0800 Subject: [PATCH] * code for task #2993. --- module/misc/lang/en.php | 1 + module/misc/lang/zh-cn.php | 1 + www/checktable.php | 43 ++++++++++++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/module/misc/lang/en.php b/module/misc/lang/en.php index a14320e611..df3d0a3e04 100644 --- a/module/misc/lang/en.php +++ b/module/misc/lang/en.php @@ -57,6 +57,7 @@ $lang->misc->copyright = "© 2009 - 2016 misc->checkTable = "Check Data Table"; $lang->misc->needRepair = "Repair Table"; $lang->misc->repairTable = "Database table is damaged due to power outage. Please chech and repair!"; +$lang->misc->repairFail = "Failed to repair. Please go to the database data directory, try to perform myisamchk -r -f %s.MYI repair."; $lang->misc->tableName = "Table Name"; $lang->misc->tableStatus = "Status"; $lang->misc->novice = "First time to ZenTao? Do you want to start rookie mode?"; diff --git a/module/misc/lang/zh-cn.php b/module/misc/lang/zh-cn.php index d7fce0598f..a25e381e4d 100644 --- a/module/misc/lang/zh-cn.php +++ b/module/misc/lang/zh-cn.php @@ -57,6 +57,7 @@ $lang->misc->copyright = "© 2009 - 2016 misc->checkTable = "检查修复数据表"; $lang->misc->needRepair = "修复表"; $lang->misc->repairTable = "数据库表可以因为断电原因损坏,需要检查修复!!"; +$lang->misc->repairFail = "修复失败,请到该数据库的数据目录下,尝试执行myisamchk -r -f %s.MYI进行修复。"; $lang->misc->tableName = "表名"; $lang->misc->tableStatus = "状态"; $lang->misc->novice = "您可能初次使用禅道,是否进入新手模式?"; diff --git a/www/checktable.php b/www/checktable.php index aac73ddd58..9c7be086ae 100644 --- a/www/checktable.php +++ b/www/checktable.php @@ -1,10 +1,45 @@ = 10. https://www.drupal.org/node/365615. */ + if(stripos($clientLang, 'hans')) $clientLang = 'zh-cn'; + if(stripos($clientLang, 'hant')) $clientLang = 'zh-tw'; +} +if(!empty($clientLang)) +{ + $clientLang = strtolower($clientLang); + if(!isset($config->langs[$clientLang])) $clientLang = $config->default->lang; +} +else +{ + $clientLang = $config->default->lang; +} ?> webRoot; @@ -25,12 +60,12 @@ if(!file_exists($checkFileName) or (time() - filemtime($checkFileName)) > 60 * 1 $lang = new stdclass(); $lang->misc = new stdclass(); -include '../module/misc/lang/zh-cn.php'; +include "../module/misc/lang/{$clientLang}.php"; if($status == 'createFile') { $lang->user = new stdclass(); $lang->projectCommon = ''; - include '../module/user/lang/zh-cn.php'; + include "../module/user/lang/{$clientLang}.php"; } else { @@ -96,7 +131,7 @@ else '> - myisamchk -r -f {$tableName}.MYI进行修复。"?> + misc->repairFail, $tableName)?>