diff --git a/adm/dbupgrade.php b/adm/dbupgrade.php index 48394b6ba..aa69f2add 100644 --- a/adm/dbupgrade.php +++ b/adm/dbupgrade.php @@ -269,6 +269,26 @@ while ($row = sql_fetch_array($result)){ } } +// SMS5 테이블 G5_TABLE_PREFIX 적용 +if($g5['sms5_prefix'] != 'sms5_' && sql_num_rows(sql_query("show tables like 'sms5_config'"))) +{ + $tables = array('config','write','history','book','book_group','form','form_group'); + + foreach($tables as $name){ + $old_table = 'sms5_' . $name; + $new_table = $g5['sms5_prefix'] . $name; + + // 기존 테이블이 있고, G5_TABLE_PREFIX 적용 테이블이 없을 경우 → 테이블명 변경 + if(sql_num_rows(sql_query("SHOW TABLES LIKE '{$old_table}' "))){ + if(!sql_num_rows(sql_query("SHOW TABLES LIKE '{$new_table}' "))){ + sql_query("RENAME TABLE {$old_table} TO {$new_table}", false); + } + } + } + + $is_check = true; +} + $is_check = run_replace('admin_dbupgrade', $is_check); $db_upgrade_msg = $is_check ? 'DB 업그레이드가 완료되었습니다.' : '더 이상 업그레이드 할 내용이 없습니다.
현재 DB 업그레이드가 완료된 상태입니다.'; diff --git a/adm/sms_admin/_common.php b/adm/sms_admin/_common.php index e295daf97..8c13c71a9 100644 --- a/adm/sms_admin/_common.php +++ b/adm/sms_admin/_common.php @@ -5,6 +5,16 @@ include_once(G5_ADMIN_PATH.'/admin.lib.php'); include_once(G5_SMS5_PATH.'/sms5.lib.php'); if (!strstr($_SERVER['SCRIPT_NAME'], 'install.php')) { + // SMS5 테이블 G5_TABLE_PREFIX 적용 + if($g5['sms5_prefix'] != 'sms5_' && sql_num_rows(sql_query("show tables like 'sms5_config'"))) + { + echo ''; + exit; + } + if(!sql_num_rows(sql_query(" show tables like '{$g5['sms5_config_table']}' "))) goto_url('install.php'); diff --git a/extend/sms5.extend.php b/extend/sms5.extend.php index 3c0212d42..a31d43f28 100644 --- a/extend/sms5.extend.php +++ b/extend/sms5.extend.php @@ -20,7 +20,7 @@ define('G5_ICODE_LMS_MAX_LENGTH', 1500); // 구버전 LMS 최대길이 define('G5_ICODE_JSON_MAX_LENGTH', 2000); // JSON 버전 LMS 최대길이 // SMS 테이블명 -$g5['sms5_prefix'] = 'sms5_'; +$g5['sms5_prefix'] = G5_TABLE_PREFIX.'sms5_'; $g5['sms5_config_table'] = $g5['sms5_prefix'] . 'config'; $g5['sms5_write_table'] = $g5['sms5_prefix'] . 'write'; $g5['sms5_history_table'] = $g5['sms5_prefix'] . 'history';