* fix a bug for upgrade.

* change zt_custom to zt_lang.
This commit is contained in:
wyd621
2013-08-12 08:56:09 +08:00
parent b26370d6cb
commit ddfa3d8d66
6 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ define('TABLE_FILE', '`' . $config->db->prefix . 'file`');
define('TABLE_HISTORY', '`' . $config->db->prefix . 'history`');
define('TABLE_EXTENSION', '`' . $config->db->prefix . 'extension`');
define('TABLE_WEBAPP', '`' . $config->db->prefix . 'webapp`');
define('TABLE_CUSTOM', '`' . $config->db->prefix . 'custom`');
define('TABLE_LANG', '`' . $config->db->prefix . 'lang`');
$config->objectTables['product'] = TABLE_PRODUCT;
$config->objectTables['story'] = TABLE_STORY;
+1 -1
View File
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS `zt_custom` (
CREATE TABLE IF NOT EXISTS `zt_lang` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`lang` varchar(30) NOT NULL,
`module` varchar(30) NOT NULL,
+2 -2
View File
@@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS `zt_config` (
PRIMARY KEY (`id`),
UNIQUE KEY `unique` (`owner`,`module`,`section`,`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_custom`;
CREATE TABLE IF NOT EXISTS `zt_custom` (
-- DROP TABLE IF EXISTS `zt_lang`;
CREATE TABLE IF NOT EXISTS `zt_lang` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`lang` varchar(30) NOT NULL,
`module` varchar(30) NOT NULL,
+1
View File
@@ -126,6 +126,7 @@ class commonModel extends model
*/
public function loadCustomFromDB()
{
if(defined('IN_UPGRADE')) return;
if(!$this->config->db->name) return;
$records = $this->loadModel('custom')->getAll();
if(!$records) return;
+3 -3
View File
@@ -19,7 +19,7 @@ class customModel extends model
*/
public function getAll()
{
$allCustomLang = $this->dao->select('*')->from(TABLE_CUSTOM)->orderBy('lang,id')->fetchAll('id');
$allCustomLang = $this->dao->select('*')->from(TABLE_LANG)->orderBy('lang,id')->fetchAll('id');
$currentLang = $this->app->getClientLang();
$processedLang = array();
@@ -59,7 +59,7 @@ class customModel extends model
$item->value = $value;
$item->system = $system;
$this->dao->replace(TABLE_CUSTOM)->data($item)->exec();
$this->dao->replace(TABLE_LANG)->data($item)->exec();
}
/**
@@ -116,7 +116,7 @@ class customModel extends model
*/
public function createDAO($params, $method = 'select')
{
return $this->dao->$method('*')->from(TABLE_CUSTOM)->where('1 = 1')
return $this->dao->$method('*')->from(TABLE_LANG)->where('1 = 1')
->beginIF($params['lang'])->andWhere('lang')->in($params['lang'])->fi()
->beginIF($params['module'])->andWhere('module')->in($params['module'])->fi()
->beginIF($params['section'])->andWhere('section')->in($params['section'])->fi()
+1
View File
@@ -10,6 +10,7 @@
* @link http://www.zentao.net
*/
/* Judge my.php exists or not. */
define('IN_UPGRADE', true);
$myConfig = dirname(dirname(__FILE__)) . '/config/my.php';
if(!file_exists($myConfig))
{