From ca9a0aef25043c753314b41a4282302975d14cc7 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 8 Feb 2017 16:16:31 +0900 Subject: [PATCH] Update autologin table with more columns --- classes/db/DBCubrid.class.php | 23 +++++++++++++++++++++ classes/db/DBMssql.class.php | 23 +++++++++++++++++++++ classes/db/DBMysql.class.php | 23 +++++++++++++++++++++ modules/member/member.class.php | 10 +++++++++ modules/member/schemas/member_autologin.xml | 10 +++++++-- 5 files changed, 87 insertions(+), 2 deletions(-) diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 1491eb73b..7963ae620 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -956,6 +956,29 @@ class DBCubrid extends DB } } + /** + * Drop table + * + * @param string $name + * @return bool + */ + function dropTable($table_name) + { + // Generate the drop query + $query = sprintf('drop class "%s"', $this->addQuotes($this->prefix . $table_name)); + + // Execute the drop query + $output = $this->_query($query); + if($output) + { + return true; + } + else + { + return false; + } + } + /** * Handles insertAct * @param Object $queryObject diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index a1473ac73..b0ffa4bd2 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -748,6 +748,29 @@ class DBMssql extends DB } } + /** + * Drop table + * + * @param string $name + * @return bool + */ + function dropTable($table_name) + { + // Generate the drop query + $query = sprintf('DROP TABLE %s', $this->addQuotes($this->prefix . $table_name)); + + // Execute the drop query + $output = $this->_query($query); + if($output) + { + return true; + } + else + { + return false; + } + } + /** * Handles insertAct * @todo Lookup _filterNumber against sql injection - see if it is still needed and how to integrate diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 27e16b315..5ec68cc04 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -682,6 +682,29 @@ class DBMysql extends DB } } + /** + * Drop table + * + * @param string $name + * @return bool + */ + function dropTable($table_name) + { + // Generate the drop query + $query = sprintf('DROP TABLE `%s`', $this->addQuotes($this->prefix . $table_name)); + + // Execute the drop query + $output = $this->_query($query); + if($output) + { + return true; + } + else + { + return false; + } + } + /** * Handles insertAct * @param Object $queryObject diff --git a/modules/member/member.class.php b/modules/member/member.class.php index c2a59818e..31ae1df4e 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -204,6 +204,9 @@ class member extends ModuleObject { if(!$oDB->isColumnExists("member", "list_order")) return true; if(!$oDB->isIndexExists("member","idx_list_order")) return true; + + // Check autologin table + if(!$oDB->isColumnExists("member_autologin", "security_key")) return true; $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('member'); @@ -314,6 +317,13 @@ class member extends ModuleObject { { $oDB->addIndex("member","idx_list_order", array("list_order")); } + + // Check autologin table + if(!$oDB->isColumnExists("member_autologin", "security_key")) + { + $oDB->dropTable('member_autologin'); + $oDB->createTableByXmlFile($this->module_path . '/schemas/member_autologin.xml'); + } $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('member'); diff --git a/modules/member/schemas/member_autologin.xml b/modules/member/schemas/member_autologin.xml index c4bc326fe..2ec17e1d6 100644 --- a/modules/member/schemas/member_autologin.xml +++ b/modules/member/schemas/member_autologin.xml @@ -1,4 +1,10 @@ - - + + + + + + + +