* fix a bug for upgrade.
* change zt_custom to zt_lang.
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user