refactor: 일반 실행 경로의 DB 변경을 버전형 마이그레이션으로 이전
과거 누적 DDL과 데이터 보정을 시점별 SQL로 분리하고 관리자·CLI 실행기를 제공한다. 실행 순서, 잠금, 체크섬, 성공·실패 이력 및 개별 실행의 선행 조건을 검증한다. 기존 스키마의 부분 적용 복구와 설치 SQL 정합성 검사를 추가하고 실행·복구 절차를 문서화한다.
This commit is contained in:
@@ -65,6 +65,18 @@ cd gnuboard5
|
|||||||
|
|
||||||
> 기존 사이트에 재설치하면 데이터가 삭제될 수 있습니다. 진행하기 전에 파일과 데이터베이스를 백업하십시오.
|
> 기존 사이트에 재설치하면 데이터가 삭제될 수 있습니다. 진행하기 전에 파일과 데이터베이스를 백업하십시오.
|
||||||
|
|
||||||
|
### 기존 설치 업데이트
|
||||||
|
|
||||||
|
소스 코드를 업데이트한 뒤 데이터베이스 변경이 포함된 버전은 관리자 메뉴의 **환경설정 → DB업그레이드**에서 변경 내용을 확인하고 명시적으로 실행합니다. 배포 자동화에서는 CLI 실행을 권장합니다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php bin/db-migrate.php status
|
||||||
|
php bin/db-migrate.php migrate
|
||||||
|
php bin/check-runtime-ddl.php
|
||||||
|
```
|
||||||
|
|
||||||
|
운영 절차와 마이그레이션 작성 규칙은 [데이터베이스 마이그레이션 문서](docs/database-migrations.md)를 확인하십시오.
|
||||||
|
|
||||||
## 문서 및 지원
|
## 문서 및 지원
|
||||||
|
|
||||||
- [그누보드5 공식 페이지](https://sir.kr/main/g5/)
|
- [그누보드5 공식 페이지](https://sir.kr/main/g5/)
|
||||||
|
|||||||
@@ -13,81 +13,20 @@ if (!$row['cnt']) {
|
|||||||
|
|
||||||
$html_title = '게시판';
|
$html_title = '게시판';
|
||||||
|
|
||||||
if (!isset($board['bo_device'])) {
|
|
||||||
// 게시판 사용 필드 추가
|
|
||||||
// both : pc, mobile 둘다 사용
|
|
||||||
// pc : pc 전용 사용
|
|
||||||
// mobile : mobile 전용 사용
|
|
||||||
// none : 사용 안함
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `bo_subject` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_mobile_skin'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_skin` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_skin` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_gallery_width'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_gallery_width` INT NOT NULL AFTER `bo_gallery_cols`, ADD `bo_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_width`, ADD `bo_mobile_gallery_width` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_height`, ADD `bo_mobile_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_mobile_gallery_width` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_mobile_subject_len'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject_len` INT(11) NOT NULL DEFAULT '0' AFTER `bo_subject_len` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_mobile_page_rows'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_page_rows` INT(11) NOT NULL DEFAULT '0' AFTER `bo_page_rows` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_mobile_content_head'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_content_head` TEXT NOT NULL AFTER `bo_content_head`, ADD `bo_mobile_content_tail` TEXT NOT NULL AFTER `bo_content_tail`", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_use_cert'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_cert` ENUM('','cert','adult') NOT NULL DEFAULT '' AFTER `bo_use_email` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_use_sns'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_sns` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_cert` ", false);
|
|
||||||
|
|
||||||
$result = sql_query(" select bo_table from `{$g5['board_table']}` ");
|
|
||||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}`
|
|
||||||
ADD `wr_facebook_user` VARCHAR(255) NOT NULL DEFAULT '' AFTER `wr_ip`,
|
|
||||||
ADD `wr_twitter_user` VARCHAR(255) NOT NULL DEFAULT '' AFTER `wr_facebook_user` ", false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['board_table']}` LIKE 'bo_use_cert' ";
|
$sql = " SHOW COLUMNS FROM `{$g5['board_table']}` LIKE 'bo_use_cert' ";
|
||||||
$row = sql_fetch($sql);
|
$row = sql_fetch($sql);
|
||||||
if (strpos($row['Type'], 'hp-') === false) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` CHANGE `bo_use_cert` `bo_use_cert` ENUM('','cert','adult','hp-cert','hp-adult') NOT NULL DEFAULT '' ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_use_list_file'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_list_file` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_list_view` ", false);
|
|
||||||
|
|
||||||
$result = sql_query(" select bo_table from `{$g5['board_table']}` ");
|
|
||||||
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}`
|
|
||||||
ADD `wr_file` TINYINT NOT NULL DEFAULT '0' AFTER `wr_datetime` ", false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_mobile_subject'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_subject` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_use_captcha'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_captcha` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_sns` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($board['bo_select_editor'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_select_editor` VARCHAR(50) NOT NULL DEFAULT '' AFTER `bo_use_dhtml_editor` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$board_default = array(
|
$board_default = array(
|
||||||
'bo_mobile_subject'=>'',
|
'bo_mobile_subject'=>'',
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ if ($w == '') {
|
|||||||
alert('제대로 된 값이 넘어오지 않았습니다.');
|
alert('제대로 된 값이 넘어오지 않았습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($group['gr_device'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['group_table']}` ADD `gr_device` ENUM('both','pc','mobile') NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 접근회원수
|
// 접근회원수
|
||||||
$sql1 = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$gr_id}' ";
|
$sql1 = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$gr_id}' ";
|
||||||
|
|||||||
@@ -4,14 +4,6 @@ require_once './_common.php';
|
|||||||
|
|
||||||
auth_check_menu($auth, $sub_menu, 'r');
|
auth_check_menu($auth, $sub_menu, 'r');
|
||||||
|
|
||||||
if (!isset($group['gr_device'])) {
|
|
||||||
// 게시판 그룹 사용 필드 추가
|
|
||||||
// both : pc, mobile 둘다 사용
|
|
||||||
// pc : pc 전용 사용
|
|
||||||
// mobile : mobile 전용 사용
|
|
||||||
// none : 사용 안함
|
|
||||||
sql_query(" ALTER TABLE `{$g5['group_table']}` ADD `gr_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql_common = " from {$g5['group_table']} ";
|
$sql_common = " from {$g5['group_table']} ";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
$sub_menu = "300200";
|
$sub_menu = "300200";
|
||||||
require_once './_common.php';
|
require_once './_common.php';
|
||||||
|
|
||||||
sql_query(" ALTER TABLE {$g5['group_member_table']} CHANGE `gm_id` `gm_id` INT( 11 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ", false);
|
|
||||||
|
|
||||||
if ($w == '') {
|
if ($w == '') {
|
||||||
auth_check_menu($auth, $sub_menu, 'w');
|
auth_check_menu($auth, $sub_menu, 'w');
|
||||||
|
|||||||
+1
-441
@@ -13,448 +13,8 @@ $sql = " select * from {$g5['config_table']} limit 1";
|
|||||||
$config = sql_fetch($sql);
|
$config = sql_fetch($sql);
|
||||||
|
|
||||||
if (!isset($config['cf_email_certify_minutes'])) {
|
if (!isset($config['cf_email_certify_minutes'])) {
|
||||||
sql_query(
|
alert('DB 업그레이드가 필요합니다.', G5_ADMIN_URL . '/dbupgrade.php');
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_email_certify_minutes` INT(11) NOT NULL DEFAULT '60' AFTER `cf_use_email_certify` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$config['cf_email_certify_minutes'] = 60;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['cf_add_script'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_admin_email_name` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_mobile_new_skin'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_mobile_new_skin` VARCHAR(255) NOT NULL AFTER `cf_memo_send_point`,
|
|
||||||
ADD `cf_mobile_search_skin` VARCHAR(255) NOT NULL AFTER `cf_mobile_new_skin`,
|
|
||||||
ADD `cf_mobile_connect_skin` VARCHAR(255) NOT NULL AFTER `cf_mobile_search_skin`,
|
|
||||||
ADD `cf_mobile_member_skin` VARCHAR(255) NOT NULL AFTER `cf_mobile_connect_skin` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($config['cf_gcaptcha_mp3'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
CHANGE `cf_gcaptcha_mp3` `cf_captcha_mp3` VARCHAR(255) NOT NULL DEFAULT '' ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} elseif (!isset($config['cf_captcha_mp3'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_captcha_mp3` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_mobile_member_skin` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_editor'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_editor` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_captcha_mp3` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_googl_shorturl_apikey'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_googl_shorturl_apikey` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_captcha_mp3` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_mobile_pages'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_mobile_pages` INT(11) NOT NULL DEFAULT '0' AFTER `cf_write_pages` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(" UPDATE `{$g5['config_table']}` SET cf_mobile_pages = '5' ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_facebook_appid'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_facebook_appid` VARCHAR(255) NOT NULL AFTER `cf_googl_shorturl_apikey`,
|
|
||||||
ADD `cf_facebook_secret` VARCHAR(255) NOT NULL AFTER `cf_facebook_appid`,
|
|
||||||
ADD `cf_twitter_key` VARCHAR(255) NOT NULL AFTER `cf_facebook_secret`,
|
|
||||||
ADD `cf_twitter_secret` VARCHAR(255) NOT NULL AFTER `cf_twitter_key` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// uniqid 테이블이 없을 경우 생성
|
|
||||||
if (!sql_query(" DESC {$g5['uniqid_table']} ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['uniqid_table']}` (
|
|
||||||
`uq_id` bigint(20) unsigned NOT NULL,
|
|
||||||
`uq_ip` varchar(255) NOT NULL,
|
|
||||||
PRIMARY KEY (`uq_id`)
|
|
||||||
) ",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sql_query(" SELECT uq_ip from {$g5['uniqid_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['uniqid_table']} ADD `uq_ip` VARCHAR(255) NOT NULL ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 임시저장 테이블이 없을 경우 생성
|
|
||||||
if (!sql_query(" DESC {$g5['autosave_table']} ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['autosave_table']}` (
|
|
||||||
`as_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`mb_id` varchar(20) NOT NULL,
|
|
||||||
`as_uid` bigint(20) unsigned NOT NULL,
|
|
||||||
`as_subject` varchar(255) NOT NULL,
|
|
||||||
`as_content` text NOT NULL,
|
|
||||||
`as_datetime` datetime NOT NULL,
|
|
||||||
PRIMARY KEY (`as_id`),
|
|
||||||
UNIQUE KEY `as_uid` (`as_uid`),
|
|
||||||
KEY `mb_id` (`mb_id`)
|
|
||||||
) ",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_admin_email'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_admin_email` VARCHAR(255) NOT NULL AFTER `cf_admin` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_admin_email_name'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_admin_email_name` VARCHAR(255) NOT NULL AFTER `cf_admin_email` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_cert_use'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_cert_use` TINYINT(4) NOT NULL DEFAULT '0' AFTER `cf_editor`,
|
|
||||||
ADD `cf_cert_ipin` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_use`,
|
|
||||||
ADD `cf_cert_hp` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_ipin`,
|
|
||||||
ADD `cf_cert_kcb_cd` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_hp`,
|
|
||||||
ADD `cf_cert_kcp_cd` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_kcb_cd`,
|
|
||||||
ADD `cf_cert_limit` INT(11) NOT NULL DEFAULT '0' AFTER `cf_cert_kcp_cd` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
CHANGE `mb_hp_certify` `mb_certify` VARCHAR(20) NOT NULL DEFAULT '' ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(" update {$g5['member_table']} set mb_certify = 'hp' where mb_certify = '1' ");
|
|
||||||
sql_query(" update {$g5['member_table']} set mb_certify = '' where mb_certify = '0' ");
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['cert_history_table']}` (
|
|
||||||
`cr_id` int(11) NOT NULL auto_increment,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cr_company` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cr_method` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cr_ip` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cr_date` date NOT NULL DEFAULT '0000-00-00',
|
|
||||||
`cr_time` time NOT NULL DEFAULT '00:00:00',
|
|
||||||
PRIMARY KEY (`cr_id`),
|
|
||||||
KEY `mb_id` (`mb_id`)
|
|
||||||
)",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_analytics'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_analytics` TEXT NOT NULL AFTER `cf_intercept_ip` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_add_meta'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_add_meta` TEXT NOT NULL AFTER `cf_analytics` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_syndi_token'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_syndi_token` VARCHAR(255) NOT NULL AFTER `cf_add_meta` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_syndi_except'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_syndi_except` TEXT NOT NULL AFTER `cf_syndi_token` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_sms_use'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_sms_use` varchar(255) NOT NULL DEFAULT '' AFTER `cf_cert_limit`,
|
|
||||||
ADD `cf_icode_id` varchar(255) NOT NULL DEFAULT '' AFTER `cf_sms_use`,
|
|
||||||
ADD `cf_icode_pw` varchar(255) NOT NULL DEFAULT '' AFTER `cf_icode_id`,
|
|
||||||
ADD `cf_icode_server_ip` varchar(255) NOT NULL DEFAULT '' AFTER `cf_icode_pw`,
|
|
||||||
ADD `cf_icode_server_port` varchar(255) NOT NULL DEFAULT '' AFTER `cf_icode_server_ip` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_mobile_page_rows'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_mobile_page_rows` int(11) NOT NULL DEFAULT '0' AFTER `cf_page_rows` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_cert_req'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_cert_req` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_cert_limit` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_faq_skin'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_faq_skin` varchar(255) NOT NULL DEFAULT '' AFTER `cf_connect_skin`,
|
|
||||||
ADD `cf_mobile_faq_skin` varchar(255) NOT NULL DEFAULT '' AFTER `cf_mobile_connect_skin` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LG유플러스 본인확인 필드 추가
|
|
||||||
if (!isset($config['cf_lg_mid'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_lg_mid` varchar(255) NOT NULL DEFAULT '' AFTER `cf_cert_kcp_cd`,
|
|
||||||
ADD `cf_lg_mert_key` varchar(255) NOT NULL DEFAULT '' AFTER `cf_lg_mid` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($config['cf_optimize_date'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_optimize_date` date NOT NULL default '0000-00-00' AFTER `cf_popular_del` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 카카오톡링크 api 키
|
|
||||||
if (!isset($config['cf_kakao_js_apikey'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_kakao_js_apikey` varchar(255) NOT NULL DEFAULT '' AFTER `cf_googl_shorturl_apikey` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SMS 전송유형 필드 추가
|
|
||||||
if (!isset($config['cf_sms_type'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_sms_type` varchar(10) NOT NULL DEFAULT '' AFTER `cf_sms_use` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 접속자 정보 필드 추가
|
|
||||||
if (!sql_query(" select vi_browser from {$g5['visit_table']} limit 1 ")) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['visit_table']}`
|
|
||||||
ADD `vi_browser` varchar(255) NOT NULL DEFAULT '' AFTER `vi_agent`,
|
|
||||||
ADD `vi_os` varchar(255) NOT NULL DEFAULT '' AFTER `vi_browser`,
|
|
||||||
ADD `vi_device` varchar(255) NOT NULL DEFAULT '' AFTER `vi_os` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//소셜 로그인 관련 필드 및 구글 리챕챠 필드 추가
|
|
||||||
if (!isset($config['cf_social_login_use'])) {
|
|
||||||
sql_query(
|
|
||||||
"ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_social_login_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_googl_shorturl_apikey`,
|
|
||||||
ADD `cf_google_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_twitter_secret`,
|
|
||||||
ADD `cf_google_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_google_clientid`,
|
|
||||||
ADD `cf_naver_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_google_secret`,
|
|
||||||
ADD `cf_naver_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_naver_clientid`,
|
|
||||||
ADD `cf_kakao_rest_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_naver_secret`,
|
|
||||||
ADD `cf_social_servicelist` varchar(255) NOT NULL DEFAULT '' AFTER `cf_social_login_use`,
|
|
||||||
ADD `cf_payco_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_social_servicelist`,
|
|
||||||
ADD `cf_payco_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_payco_clientid`,
|
|
||||||
ADD `cf_captcha` varchar(100) NOT NULL DEFAULT '' AFTER `cf_kakao_js_apikey`,
|
|
||||||
ADD `cf_recaptcha_site_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_captcha`,
|
|
||||||
ADD `cf_recaptcha_secret_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_recaptcha_site_key`
|
|
||||||
",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//소셜 로그인 관련 필드 카카오 클라이언트 시크릿 추가
|
|
||||||
if (!isset($config['cf_kakao_client_secret'])) {
|
|
||||||
sql_query(
|
|
||||||
"ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_kakao_client_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_kakao_rest_key`
|
|
||||||
",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 회원 이미지 관련 필드 추가
|
|
||||||
if (!isset($config['cf_member_img_size'])) {
|
|
||||||
sql_query(
|
|
||||||
"ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_member_img_size` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_icon_height`,
|
|
||||||
ADD `cf_member_img_width` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_img_size`,
|
|
||||||
ADD `cf_member_img_height` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_img_width`
|
|
||||||
",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$sql = " update {$g5['config_table']} set cf_member_img_size = 50000, cf_member_img_width = 60, cf_member_img_height = 60 ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
|
|
||||||
$config['cf_member_img_size'] = 50000;
|
|
||||||
$config['cf_member_img_width'] = 60;
|
|
||||||
$config['cf_member_img_height'] = 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 소셜 로그인 관리 테이블 없을 경우 생성
|
|
||||||
if (!sql_query(" DESC {$g5['social_profile_table']} ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['social_profile_table']}` (
|
|
||||||
`mp_no` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`provider` varchar(50) NOT NULL DEFAULT '',
|
|
||||||
`object_sha` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`identifier` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`profileurl` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`photourl` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`displayname` varchar(150) NOT NULL DEFAULT '',
|
|
||||||
`description` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`mp_register_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`mp_latest_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
UNIQUE KEY `mp_no` (`mp_no`),
|
|
||||||
KEY `mb_id` (`mb_id`),
|
|
||||||
KEY `provider` (`provider`)
|
|
||||||
) ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 짧은 URL 주소를 사용 여부 필드 추가
|
|
||||||
if (!isset($config['cf_bbs_rewrite'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_bbs_rewrite` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_link_target` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 읽지 않은 메모 수 칼럼 추가
|
|
||||||
if (!isset($member['mb_memo_cnt'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_memo_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_call`",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스크랩 읽은 수 추가
|
|
||||||
if (!isset($member['mb_scrap_cnt'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_scrap_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_cnt`",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 아이코드 토큰키 추가
|
|
||||||
if (!isset($config['cf_icode_token_key'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_icode_token_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_icode_server_port`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
// 아이디/비밀번호 찾기에 본인확인 사용 여부 필드 추가
|
|
||||||
if (!isset($config['cf_cert_find'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_find` TINYINT(4) NOT NULL DEFAULT '0' AFTER `cf_cert_use`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
// 간편인증 필드 추가
|
|
||||||
if (!isset($config['cf_cert_simple'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_simple` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_hp`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
if (!isset($config['cf_cert_kg_cd'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_kg_cd` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_simple`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
if (!isset($config['cf_cert_kg_mid'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_kg_mid` VARCHAR(255) NOT NULL DEFAULT '' AFTER `cf_cert_kg_cd`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
if (!isset($config['cf_cert_use_seed'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_use_seed` TINYINT(4) NOT NULL DEFAULT '1' AFTER `cf_cert_kg_mid`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
if (!isset($config['cf_cert_kcp_enckey'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_cert_kcp_enckey` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_cert_kcp_cd`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
|
|
||||||
$config['cf_cert_kcp_enckey'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 광고성 정보 수신 동의 사용 필드 추가
|
|
||||||
if (!isset($config['cf_use_promotion'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_use_promotion` tinyint(1) NOT NULL DEFAULT '0' AFTER `cf_privacy` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 광고성 정보 수신 동의 여부 필드 추가 + 메일 / SMS 수신 일자 추가
|
|
||||||
if (!isset($member['mb_marketing_agree'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_marketing_agree` tinyint(1) NOT NULL DEFAULT '0' AFTER `mb_scrap_cnt`,
|
|
||||||
ADD `mb_marketing_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_marketing_agree`,
|
|
||||||
ADD `mb_thirdparty_agree` tinyint(1) NOT NULL DEFAULT '0' AFTER `mb_marketing_date`,
|
|
||||||
ADD `mb_thirdparty_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_thirdparty_agree`,
|
|
||||||
ADD `mb_agree_log` TEXT NOT NULL AFTER `mb_thirdparty_date`,
|
|
||||||
ADD `mb_mailling_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_mailling`,
|
|
||||||
ADD `mb_sms_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_sms` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$config['cf_faq_skin']) {
|
if (!$config['cf_faq_skin']) {
|
||||||
$config['cf_faq_skin'] = "basic";
|
$config['cf_faq_skin'] = "basic";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,41 +8,12 @@ auth_check_menu($auth, $sub_menu, "w");
|
|||||||
$co_id = isset($_REQUEST['co_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_REQUEST['co_id']) : '';
|
$co_id = isset($_REQUEST['co_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_REQUEST['co_id']) : '';
|
||||||
|
|
||||||
// 상단, 하단 파일경로 필드 추가
|
// 상단, 하단 파일경로 필드 추가
|
||||||
if (!sql_query(" select co_include_head from {$g5['content_table']} limit 1 ", false)) {
|
|
||||||
$sql = " ALTER TABLE `{$g5['content_table']}` ADD `co_include_head` VARCHAR( 255 ) NOT NULL ,
|
|
||||||
ADD `co_include_tail` VARCHAR( 255 ) NOT NULL ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// html purifier 사용여부 필드
|
// html purifier 사용여부 필드
|
||||||
if (!sql_query(" select co_tag_filter_use from {$g5['content_table']} limit 1 ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['content_table']}`
|
|
||||||
ADD `co_tag_filter_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `co_content` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(" update {$g5['content_table']} set co_tag_filter_use = '1' ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 내용 추가
|
// 모바일 내용 추가
|
||||||
if (!sql_query(" select co_mobile_content from {$g5['content_table']} limit 1", false)) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['content_table']}`
|
|
||||||
ADD `co_mobile_content` longtext NOT NULL AFTER `co_content` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스킨 설정 추가
|
// 스킨 설정 추가
|
||||||
if (!sql_query(" select co_skin from {$g5['content_table']} limit 1 ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['content_table']}`
|
|
||||||
ADD `co_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_mobile_content`,
|
|
||||||
ADD `co_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_skin` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(" update {$g5['content_table']} set co_skin = 'basic', co_mobile_skin = 'basic' ");
|
|
||||||
}
|
|
||||||
|
|
||||||
$html_title = "내용";
|
$html_title = "내용";
|
||||||
$g5['title'] = $html_title . ' 관리';
|
$g5['title'] = $html_title . ' 관리';
|
||||||
|
|||||||
@@ -8,30 +8,6 @@ if (!isset($g5['content_table'])) {
|
|||||||
die('<meta charset="utf-8">/data/dbconfig.php 파일에 <strong>$g5[\'content_table\'] = G5_TABLE_PREFIX.\'content\';</strong> 를 추가해 주세요.');
|
die('<meta charset="utf-8">/data/dbconfig.php 파일에 <strong>$g5[\'content_table\'] = G5_TABLE_PREFIX.\'content\';</strong> 를 추가해 주세요.');
|
||||||
}
|
}
|
||||||
//내용(컨텐츠)정보 테이블이 있는지 검사한다.
|
//내용(컨텐츠)정보 테이블이 있는지 검사한다.
|
||||||
if (!sql_query(" DESCRIBE {$g5['content_table']} ", false)) {
|
|
||||||
if (sql_query(" DESCRIBE {$g5['g5_shop_content_table']} ", false)) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['g5_shop_content_table']} RENAME TO `{$g5['content_table']}` ;", false);
|
|
||||||
} else {
|
|
||||||
$query_cp = sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['content_table']}` (
|
|
||||||
`co_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`co_html` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`co_subject` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`co_content` longtext NOT NULL,
|
|
||||||
`co_hit` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`co_include_head` varchar(255) NOT NULL,
|
|
||||||
`co_include_tail` varchar(255) NOT NULL,
|
|
||||||
PRIMARY KEY (`co_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
// 내용관리 생성
|
|
||||||
sql_query(" insert into `{$g5['content_table']}` set co_id = 'company', co_html = '1', co_subject = '회사소개', co_content= '<p align=center><b>회사소개에 대한 내용을 입력하십시오.</b></p>' ", false);
|
|
||||||
sql_query(" insert into `{$g5['content_table']}` set co_id = 'privacy', co_html = '1', co_subject = '개인정보 처리방침', co_content= '<p align=center><b>개인정보 처리방침에 대한 내용을 입력하십시오.</b></p>' ", false);
|
|
||||||
sql_query(" insert into `{$g5['content_table']}` set co_id = 'provision', co_html = '1', co_subject = '서비스 이용약관', co_content= '<p align=center><b>서비스 이용약관에 대한 내용을 입력하십시오.</b></p>' ", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$g5['title'] = '내용관리';
|
$g5['title'] = '내용관리';
|
||||||
require_once G5_ADMIN_PATH . '/admin.head.php';
|
require_once G5_ADMIN_PATH . '/admin.head.php';
|
||||||
|
|||||||
+150
-641
@@ -1,655 +1,164 @@
|
|||||||
<?php
|
<?php
|
||||||
$sub_menu = '100410';
|
$sub_menu = '100410';
|
||||||
include_once('./_common.php');
|
include_once('./_common.php');
|
||||||
|
include_once(G5_LIB_PATH . '/migration.lib.php');
|
||||||
|
|
||||||
auth_check_menu($auth, $sub_menu, 'r');
|
auth_check_menu($auth, $sub_menu, 'r');
|
||||||
|
|
||||||
|
if ($is_admin != 'super') {
|
||||||
|
alert('최고관리자만 접근 가능합니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_execute = isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST';
|
||||||
|
$migration_result = array('success' => true, 'applied' => 0, 'skipped' => 0, 'errors' => array());
|
||||||
|
|
||||||
|
if ($is_execute) {
|
||||||
|
check_demo();
|
||||||
|
check_admin_token();
|
||||||
|
$migration_id = isset($_POST['migration_id']) ? trim($_POST['migration_id']) : '';
|
||||||
|
$migration_result = g5_migration_run($migration_id);
|
||||||
|
$migration_result = run_replace('admin_dbupgrade_result', $migration_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$migration_statuses = g5_migration_status();
|
||||||
|
$pending_count = 0;
|
||||||
|
foreach ($migration_statuses as $migration_status) {
|
||||||
|
if (isset($migration_status['error']) || $migration_status['status'] !== 'success' || $migration_status['checksum_changed']) {
|
||||||
|
$pending_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_execute) {
|
||||||
|
$db_upgrade_msg = $pending_count ? '적용하지 않은 DB 마이그레이션이 있습니다. 아래 내용을 확인한 뒤 실행해 주십시오.' : 'DB 마이그레이션이 모두 적용되어 있습니다.';
|
||||||
|
} elseif (!$migration_result['success']) {
|
||||||
|
$db_upgrade_msg = 'DB 마이그레이션에 실패했습니다. 오류 내용을 확인해 주십시오.';
|
||||||
|
} elseif ($migration_result['applied'] || $migration_result['skipped']) {
|
||||||
|
$db_upgrade_msg = 'DB 마이그레이션이 완료되었습니다.';
|
||||||
|
} else {
|
||||||
|
$db_upgrade_msg = '적용할 DB 마이그레이션이 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
$g5['title'] = 'DB 업그레이드';
|
$g5['title'] = 'DB 업그레이드';
|
||||||
include_once('./admin.head.php');
|
include_once('./admin.head.php');
|
||||||
|
|
||||||
$is_check = false;
|
|
||||||
|
|
||||||
// 메일 인증 링크 유효시간 설정 추가
|
|
||||||
if (!isset($config['cf_email_certify_minutes'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_email_certify_minutes` int(11) NOT NULL DEFAULT '60' AFTER `cf_use_email_certify`
|
|
||||||
", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//소셜 로그인 관련 필드 및 구글 리챕챠 필드 추가
|
|
||||||
if(!isset($config['cf_social_login_use'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_social_login_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_googl_shorturl_apikey`,
|
|
||||||
ADD `cf_google_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_twitter_secret`,
|
|
||||||
ADD `cf_google_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_google_clientid`,
|
|
||||||
ADD `cf_naver_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_google_secret`,
|
|
||||||
ADD `cf_naver_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_naver_clientid`,
|
|
||||||
ADD `cf_kakao_rest_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_naver_secret`,
|
|
||||||
ADD `cf_social_servicelist` varchar(255) NOT NULL DEFAULT '' AFTER `cf_social_login_use`,
|
|
||||||
ADD `cf_payco_clientid` varchar(100) NOT NULL DEFAULT '' AFTER `cf_social_servicelist`,
|
|
||||||
ADD `cf_payco_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_payco_clientid`,
|
|
||||||
ADD `cf_captcha` varchar(100) NOT NULL DEFAULT '' AFTER `cf_kakao_js_apikey`,
|
|
||||||
ADD `cf_recaptcha_site_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_captcha`,
|
|
||||||
ADD `cf_recaptcha_secret_key` varchar(100) NOT NULL DEFAULT '' AFTER `cf_recaptcha_site_key`
|
|
||||||
", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//소셜 로그인 관련 필드 카카오 클라이언트 시크릿 추가
|
|
||||||
if(!isset($config['cf_kakao_client_secret'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_kakao_client_secret` varchar(100) NOT NULL DEFAULT '' AFTER `cf_kakao_rest_key`
|
|
||||||
", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 회원 이미지 관련 필드 추가
|
|
||||||
if(!isset($config['cf_member_img_size'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_member_img_size` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_icon_height`,
|
|
||||||
ADD `cf_member_img_width` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_img_size`,
|
|
||||||
ADD `cf_member_img_height` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_img_width`
|
|
||||||
", true);
|
|
||||||
|
|
||||||
$sql = " update {$g5['config_table']} set cf_member_img_size = 50000, cf_member_img_width = 60, cf_member_img_height = 60 ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 소셜 로그인 관리 테이블 없을 경우 생성
|
|
||||||
if( isset($g5['social_profile_table']) && !sql_query(" DESC {$g5['social_profile_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['social_profile_table']}` (
|
|
||||||
`mp_no` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`provider` varchar(50) NOT NULL DEFAULT '',
|
|
||||||
`object_sha` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`identifier` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`profileurl` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`photourl` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`displayname` varchar(150) NOT NULL DEFAULT '',
|
|
||||||
`description` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`mp_register_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`mp_latest_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
UNIQUE KEY `mp_no` (`mp_no`),
|
|
||||||
KEY `mb_id` (`mb_id`),
|
|
||||||
KEY `provider` (`provider`)
|
|
||||||
) ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 게시판 짧은 주소
|
|
||||||
$sql = " select bo_table from {$g5['board_table']} ";
|
|
||||||
$result = sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = sql_fetch_array($result)) {
|
|
||||||
$write_table = $g5['write_prefix'] . $row['bo_table']; // 게시판 테이블 전체이름
|
|
||||||
|
|
||||||
$sql = " SHOW COLUMNS FROM {$write_table} LIKE 'wr_seo_title' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
|
|
||||||
if( !$row ){
|
|
||||||
sql_query("ALTER TABLE `{$write_table}`
|
|
||||||
ADD `wr_seo_title` varchar(200) NOT NULL DEFAULT '' AFTER `wr_content`,
|
|
||||||
ADD INDEX `wr_seo_title` (`wr_seo_title`);
|
|
||||||
", false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 내용 관리 짧은 주소
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['content_table']}` LIKE 'co_seo_title' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
|
|
||||||
if( !$row ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['content_table']}`
|
|
||||||
ADD `co_seo_title` varchar(200) NOT NULL DEFAULT '' AFTER `co_content`,
|
|
||||||
ADD INDEX `co_seo_title` (`co_seo_title`);
|
|
||||||
", false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "select * from {$g5['content_table']} limit 100 ";
|
|
||||||
$result = sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = sql_fetch_array($result)) {
|
|
||||||
|
|
||||||
if( ! $row['co_seo_title']){
|
|
||||||
|
|
||||||
$co_seo_title = exist_seo_title_recursive('content', generate_seo_title($row['co_subject']), $g5['content_table'], $row['co_id']);
|
|
||||||
|
|
||||||
$sql = " update {$g5['content_table']}
|
|
||||||
set co_seo_title = '$co_seo_title'
|
|
||||||
where co_id = '{$row['co_id']}' ";
|
|
||||||
sql_query($sql);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 메모 테이블
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['memo_table']}` LIKE 'me_send_id' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
|
|
||||||
if( !$row ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['memo_table']}`
|
|
||||||
ADD `me_send_id` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
ADD `me_type` ENUM('send','recv') NOT NULL DEFAULT 'recv',
|
|
||||||
ADD `me_send_ip` VARCHAR(100) NOT NULL DEFAULT '',
|
|
||||||
CHANGE COLUMN `me_id` `me_id` INT(11) NOT NULL AUTO_INCREMENT;
|
|
||||||
", false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 읽지 않은 메모 수 칼럼
|
|
||||||
if(!isset($member['mb_memo_cnt'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_memo_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_call`", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스크랩 읽은 수 추가
|
|
||||||
if(!isset($member['mb_scrap_cnt'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_scrap_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_cnt`", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 짧은 URL 주소를 사용 여부 필드 추가
|
|
||||||
if (!isset($config['cf_bbs_rewrite'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_bbs_rewrite` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_link_target` ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 파일테이블에 추가 칼럼
|
|
||||||
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['board_file_table']}` LIKE 'bf_fileurl' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
|
|
||||||
if( !$row ) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['board_file_table']}`
|
|
||||||
ADD COLUMN `bf_fileurl` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bf_content`,
|
|
||||||
ADD COLUMN `bf_thumburl` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bf_fileurl`,
|
|
||||||
ADD COLUMN `bf_storage` VARCHAR(50) NOT NULL DEFAULT '' AFTER `bf_thumburl`", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defined('G5_USE_SHOP') && G5_USE_SHOP) {
|
|
||||||
// 임시저장 테이블이 없을 경우 생성
|
|
||||||
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
|
|
||||||
`log_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`oid` bigint(20) unsigned NOT NULL,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`post_data` text NOT NULL,
|
|
||||||
`ol_code` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ol_msg` text NOT NULL,
|
|
||||||
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`ol_ip` varchar(25) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`log_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = sql_query("describe `{$g5['g5_shop_post_log_table']}`");
|
|
||||||
while ($row = sql_fetch_array($result)){
|
|
||||||
if( isset($row['Field']) && $row['Field'] === 'ol_msg' && $row['Type'] === 'varchar(255)' ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` MODIFY ol_msg TEXT NOT NULL;", false);
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` DROP PRIMARY KEY;", false);
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` ADD `log_id` int(11) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`log_id`);", false);
|
|
||||||
$is_check = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($default['de_id'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD COLUMN `de_id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
|
||||||
ADD PRIMARY KEY (`de_id`); ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// auth.au_menu 컬럼 크기 조정
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['auth_table']}` LIKE 'au_menu' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
if (
|
|
||||||
stripos($row['Type'], 'varchar') !== false
|
|
||||||
&& (int) preg_replace('/[^0-9]/', '', $row['Type']) < 50
|
|
||||||
) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['auth_table']}` CHANGE `au_menu` `au_menu` VARCHAR(50) NOT NULL; ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// qa config 테이블 auto id key 추가
|
|
||||||
$row = sql_fetch("select * from `{$g5['qa_config_table']}` limit 1");
|
|
||||||
if (!isset($row['qa_id'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['qa_config_table']}` ADD COLUMN `qa_id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
|
||||||
ADD PRIMARY KEY (`qa_id`); ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// config 기본 테이블 auto id key 추가
|
|
||||||
if (!isset($config['cf_id'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
|
||||||
ADD PRIMARY KEY (`cf_id`); ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// login 테이블 auto id key 추가
|
|
||||||
$row = sql_fetch("select * from `{$g5['login_table']}` limit 1");
|
|
||||||
if (!isset($row['lo_id'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['login_table']}`
|
|
||||||
ADD COLUMN `lo_id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
|
||||||
DROP PRIMARY KEY,
|
|
||||||
ADD PRIMARY KEY (`lo_id`),
|
|
||||||
ADD UNIQUE KEY `lo_ip_unique` (`lo_ip`) ", true);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// visit 테이블 auto id key 로 변경
|
|
||||||
$result = sql_query("describe `{$g5['visit_table']}`");
|
|
||||||
while ($row = sql_fetch_array($result)){
|
|
||||||
if (isset($row['Field']) && $row['Field'] === 'vi_id' && (isset($row['Default']) && $row['Default'] == 0)){
|
|
||||||
sql_query("ALTER TABLE `{$g5['visit_table']}`
|
|
||||||
CHANGE COLUMN `vi_id` `vi_id` INT(11) NOT NULL AUTO_INCREMENT;
|
|
||||||
", false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 광고성 정보 수신 동의 사용 필드 추가
|
|
||||||
if (!isset($config['cf_use_promotion'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_use_promotion` tinyint(1) NOT NULL DEFAULT '0' AFTER `cf_privacy` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 광고성 정보 수신 동의 여부 필드 추가 + 메일 / SMS 수신 일자 추가
|
|
||||||
if (!isset($member['mb_marketing_agree'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['member_table']}`
|
|
||||||
ADD `mb_marketing_agree` tinyint(1) NOT NULL DEFAULT '0' AFTER `mb_scrap_cnt`,
|
|
||||||
ADD `mb_marketing_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_marketing_agree`,
|
|
||||||
ADD `mb_thirdparty_agree` tinyint(1) NOT NULL DEFAULT '0' AFTER `mb_marketing_date`,
|
|
||||||
ADD `mb_thirdparty_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_thirdparty_agree`,
|
|
||||||
ADD `mb_agree_log` TEXT NOT NULL AFTER `mb_thirdparty_date`,
|
|
||||||
ADD `mb_mailling_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_mailling`,
|
|
||||||
ADD `mb_sms_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `mb_sms` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 쿠폰 로그 테이블에 UNIQUE 인덱스 추가 (쿠폰 이중사용 방지)
|
|
||||||
if (defined('G5_USE_SHOP') && G5_USE_SHOP) {
|
|
||||||
$result = sql_query("SHOW INDEX FROM `{$g5['g5_shop_coupon_log_table']}` WHERE Key_name = 'idx_coupon_use'", false);
|
|
||||||
if (!$result || !sql_num_rows($result)) {
|
|
||||||
// 기존에 동일 쿠폰이 중복 사용된 데이터가 있으면 UNIQUE 인덱스 생성 실패하므로 중복 데이터 정리
|
|
||||||
$dup_sql = " SELECT cp_id, mb_id, MIN(cl_id) as keep_id
|
|
||||||
FROM `{$g5['g5_shop_coupon_log_table']}`
|
|
||||||
GROUP BY cp_id, mb_id
|
|
||||||
HAVING COUNT(*) > 1 ";
|
|
||||||
|
|
||||||
$dup_result = sql_query($dup_sql, false);
|
|
||||||
if ($dup_result && sql_num_rows($dup_result)) {
|
|
||||||
while ($dup_row = sql_fetch_array($dup_result)) {
|
|
||||||
|
|
||||||
echo $dup_row['cp_id']." 의 동일 쿠폰이 중복 사용된 데이터가 있으므로 인덱스 생성이 불가합니다. <br>";
|
|
||||||
|
|
||||||
$sql = " DELETE FROM `{$g5['g5_shop_coupon_log_table']}`
|
|
||||||
WHERE cp_id = '{$dup_row['cp_id']}'
|
|
||||||
AND mb_id = '{$dup_row['mb_id']}'
|
|
||||||
AND cl_id != '{$dup_row['keep_id']}' ";
|
|
||||||
if ($is_admin === 'super') {
|
|
||||||
echo "데이터베이스에서 검토후에 이 쿼리문을 실행해 주세요.<br>$sql<br>";
|
|
||||||
}
|
|
||||||
// sql_query($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MyISAM + utf8mb4 환경에서 키 길이 초과 방지: cp_id varchar(100), mb_id varchar(100)으로 조정
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_coupon_log_table']}` MODIFY `cp_id` varchar(100) NOT NULL DEFAULT '', MODIFY `mb_id` varchar(100) NOT NULL DEFAULT ''", false);
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_coupon_log_table']}` ADD UNIQUE KEY `idx_coupon_use` (`cp_id`, `mb_id`)", false);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 자동 로그인 토큰 테이블 생성 (KVE-2026-0610: 추측 가능한 자동 로그인 쿠키 위조 방지)
|
|
||||||
// 다중 디바이스 지원을 위해 회원당 여러 토큰을 별도 테이블로 관리
|
|
||||||
if (!isset($g5['member_auto_login_table'])) {
|
|
||||||
$g5['member_auto_login_table'] = G5_TABLE_PREFIX.'member_auto_login';
|
|
||||||
}
|
|
||||||
if (!sql_query(" DESC `{$g5['member_auto_login_table']}` ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['member_auto_login_table']}` (
|
|
||||||
`al_id` int(11) NOT NULL auto_increment,
|
|
||||||
`mb_id` varchar(20) NOT NULL default '',
|
|
||||||
`al_token` varchar(64) NOT NULL default '',
|
|
||||||
`al_user_agent` varchar(255) NOT NULL default '',
|
|
||||||
`al_ip` varchar(45) NOT NULL default '',
|
|
||||||
`al_created` datetime DEFAULT NULL,
|
|
||||||
`al_last_used` datetime DEFAULT NULL,
|
|
||||||
`al_expire` datetime DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`al_id`),
|
|
||||||
UNIQUE KEY `al_token` (`al_token`),
|
|
||||||
KEY `mb_id` (`mb_id`),
|
|
||||||
KEY `al_expire` (`al_expire`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// KG이니시스 결제 처리 현황 및 단계별 이력 테이블
|
|
||||||
if (defined('G5_USE_SHOP') && G5_USE_SHOP) {
|
|
||||||
$inicis_pro_config_columns = array(
|
|
||||||
'de_inicis_pro_alert_use' => "ADD COLUMN `de_inicis_pro_alert_use` tinyint(4) NOT NULL DEFAULT '1'",
|
|
||||||
'de_inicis_pro_reconcile_use' => "ADD COLUMN `de_inicis_pro_reconcile_use` tinyint(4) NOT NULL DEFAULT '0'",
|
|
||||||
'de_inicis_pro_log_days' => "ADD COLUMN `de_inicis_pro_log_days` int(11) NOT NULL DEFAULT '365'",
|
|
||||||
'de_inicis_pro_summary_days' => "ADD COLUMN `de_inicis_pro_summary_days` int(11) NOT NULL DEFAULT '1825'",
|
|
||||||
'de_inicis_pro_monitor_at' => "ADD COLUMN `de_inicis_pro_monitor_at` datetime DEFAULT NULL",
|
|
||||||
'de_inicis_pro_monitor_message' => "ADD COLUMN `de_inicis_pro_monitor_message` varchar(255) NOT NULL DEFAULT ''"
|
|
||||||
);
|
|
||||||
$inicis_pro_config_alter = array();
|
|
||||||
foreach ($inicis_pro_config_columns as $column => $alter) {
|
|
||||||
$column_result = sql_query(" SHOW COLUMNS FROM `{$g5['g5_shop_default_table']}` LIKE '$column' ", false);
|
|
||||||
if (!$column_result || sql_num_rows($column_result) === 0)
|
|
||||||
$inicis_pro_config_alter[] = $alter;
|
|
||||||
}
|
|
||||||
if (count($inicis_pro_config_alter)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}` ".implode(', ', $inicis_pro_config_alter), true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($g5['g5_shop_inicis_pay_table']))
|
|
||||||
$g5['g5_shop_inicis_pay_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay';
|
|
||||||
if (!isset($g5['g5_shop_inicis_pay_event_table']))
|
|
||||||
$g5['g5_shop_inicis_pay_event_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay_event';
|
|
||||||
|
|
||||||
if (!sql_query(" DESC `{$g5['g5_shop_inicis_pay_table']}` ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_inicis_pay_table']}` (
|
|
||||||
`ip_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_mid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_environment` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_amount` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_pay_type` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_device` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`ip_order_type` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`ip_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_result_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_result_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_noti_at` datetime DEFAULT NULL,
|
|
||||||
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_checked_at` datetime DEFAULT NULL,
|
|
||||||
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_vbank_due_at` datetime DEFAULT NULL,
|
|
||||||
`ip_expired_at` datetime DEFAULT NULL,
|
|
||||||
`ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_approved_at` datetime DEFAULT NULL,
|
|
||||||
`ip_ordered_at` datetime DEFAULT NULL,
|
|
||||||
`ip_notified_at` datetime DEFAULT NULL,
|
|
||||||
`ip_canceled_at` datetime DEFAULT NULL,
|
|
||||||
`ip_created_at` datetime DEFAULT NULL,
|
|
||||||
`ip_updated_at` datetime DEFAULT NULL,
|
|
||||||
`ip_ip` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`ip_event_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_alerted_at` datetime DEFAULT NULL,
|
|
||||||
`ip_alert_key` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_amount` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_checked_at` datetime DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`ip_id`),
|
|
||||||
UNIQUE KEY `ip_oid` (`ip_oid`),
|
|
||||||
KEY `ip_tid` (`ip_tid`),
|
|
||||||
KEY `ip_auth_tid` (`ip_auth_tid`),
|
|
||||||
KEY `ip_status` (`ip_status`),
|
|
||||||
KEY `ip_noti_status` (`ip_noti_status`),
|
|
||||||
KEY `ip_cancel_status` (`ip_cancel_status`),
|
|
||||||
KEY `ip_refund_required` (`ip_refund_required`),
|
|
||||||
KEY `ip_updated_at` (`ip_updated_at`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sql_query(" DESC `{$g5['g5_shop_inicis_pay_table']}` ", false)) {
|
|
||||||
$inicis_pay_columns = array(
|
|
||||||
'ip_environment' => "ADD COLUMN `ip_environment` varchar(10) NOT NULL DEFAULT '' AFTER `ip_mid`",
|
|
||||||
'ip_easy_pay' => "ADD COLUMN `ip_easy_pay` varchar(20) NOT NULL DEFAULT '' AFTER `ip_pay_type`",
|
|
||||||
'ip_noti_status' => "ADD COLUMN `ip_noti_status` varchar(30) NOT NULL DEFAULT '' AFTER `ip_result_message`",
|
|
||||||
'ip_noti_code' => "ADD COLUMN `ip_noti_code` varchar(30) NOT NULL DEFAULT '' AFTER `ip_noti_status`",
|
|
||||||
'ip_noti_message' => "ADD COLUMN `ip_noti_message` varchar(255) NOT NULL DEFAULT '' AFTER `ip_noti_code`",
|
|
||||||
'ip_noti_failed_count' => "ADD COLUMN `ip_noti_failed_count` int(11) NOT NULL DEFAULT '0' AFTER `ip_noti_message`",
|
|
||||||
'ip_noti_at' => "ADD COLUMN `ip_noti_at` datetime DEFAULT NULL AFTER `ip_noti_failed_count`",
|
|
||||||
'ip_cancel_status' => "ADD COLUMN `ip_cancel_status` varchar(30) NOT NULL DEFAULT '' AFTER `ip_noti_at`",
|
|
||||||
'ip_cancel_code' => "ADD COLUMN `ip_cancel_code` varchar(30) NOT NULL DEFAULT '' AFTER `ip_cancel_status`",
|
|
||||||
'ip_cancel_message' => "ADD COLUMN `ip_cancel_message` varchar(255) NOT NULL DEFAULT '' AFTER `ip_cancel_code`",
|
|
||||||
'ip_cancel_checked_at' => "ADD COLUMN `ip_cancel_checked_at` datetime DEFAULT NULL AFTER `ip_cancel_message`",
|
|
||||||
'ip_refund_required' => "ADD COLUMN `ip_refund_required` tinyint(4) NOT NULL DEFAULT '0' AFTER `ip_cancel_checked_at`",
|
|
||||||
'ip_vbank_due_at' => "ADD COLUMN `ip_vbank_due_at` datetime DEFAULT NULL AFTER `ip_refund_required`",
|
|
||||||
'ip_expired_at' => "ADD COLUMN `ip_expired_at` datetime DEFAULT NULL AFTER `ip_vbank_due_at`",
|
|
||||||
'ip_audit_error' => "ADD COLUMN `ip_audit_error` tinyint(4) NOT NULL DEFAULT '0'",
|
|
||||||
'ip_alerted_at' => "ADD COLUMN `ip_alerted_at` datetime DEFAULT NULL",
|
|
||||||
'ip_alert_key' => "ADD COLUMN `ip_alert_key` varchar(64) NOT NULL DEFAULT ''",
|
|
||||||
'ip_pg_status' => "ADD COLUMN `ip_pg_status` varchar(30) NOT NULL DEFAULT ''",
|
|
||||||
'ip_pg_amount' => "ADD COLUMN `ip_pg_amount` int(11) NOT NULL DEFAULT '0'",
|
|
||||||
'ip_pg_tid' => "ADD COLUMN `ip_pg_tid` varchar(80) NOT NULL DEFAULT ''",
|
|
||||||
'ip_pg_result_code' => "ADD COLUMN `ip_pg_result_code` varchar(30) NOT NULL DEFAULT ''",
|
|
||||||
'ip_pg_message' => "ADD COLUMN `ip_pg_message` varchar(255) NOT NULL DEFAULT ''",
|
|
||||||
'ip_pg_checked_at' => "ADD COLUMN `ip_pg_checked_at` datetime DEFAULT NULL"
|
|
||||||
);
|
|
||||||
$inicis_pay_alter = array();
|
|
||||||
foreach ($inicis_pay_columns as $column => $alter) {
|
|
||||||
$column_result = sql_query(" SHOW COLUMNS FROM `{$g5['g5_shop_inicis_pay_table']}` LIKE '$column' ", false);
|
|
||||||
if (!$column_result || sql_num_rows($column_result) === 0)
|
|
||||||
$inicis_pay_alter[] = $alter;
|
|
||||||
}
|
|
||||||
if (count($inicis_pay_alter)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_pay_table']}` ".implode(', ', $inicis_pay_alter), true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($inicis_pay_alter)) {
|
|
||||||
$environment = !empty($default['de_card_test']) ? 'test' : 'live';
|
|
||||||
sql_query(" insert ignore into `{$g5['g5_shop_inicis_pay_table']}`
|
|
||||||
(ip_oid, ip_environment, ip_status, ip_noti_status, ip_noti_code, ip_noti_message,
|
|
||||||
ip_noti_failed_count, ip_noti_at, ip_created_at, ip_updated_at, ip_event_count)
|
|
||||||
select e.ip_oid, '$environment', e.pe_status, e.pe_status, e.pe_code, e.pe_message,
|
|
||||||
sum(if(e.pe_status = 'notification_failed', 1, 0)), max(e.pe_created_at),
|
|
||||||
min(e.pe_created_at), max(e.pe_created_at), count(*)
|
|
||||||
from `{$g5['g5_shop_inicis_pay_event_table']}` e
|
|
||||||
left join `{$g5['g5_shop_inicis_pay_table']}` p on p.ip_oid = e.ip_oid
|
|
||||||
where p.ip_id is null
|
|
||||||
and e.pe_stage = 'notification'
|
|
||||||
group by e.ip_oid ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}`
|
|
||||||
set ip_environment = case
|
|
||||||
when lower(ip_mid) in ('inipaytest','iniescrow0') then 'test'
|
|
||||||
when ip_mid <> '' then 'live'
|
|
||||||
else '$environment'
|
|
||||||
end
|
|
||||||
where ip_environment = '' ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
inner join (
|
|
||||||
select ip_oid, max(pe_id) as pe_id,
|
|
||||||
sum(if(pe_status = 'notification_failed', 1, 0)) as fail_count
|
|
||||||
from `{$g5['g5_shop_inicis_pay_event_table']}`
|
|
||||||
where pe_stage = 'notification'
|
|
||||||
group by ip_oid
|
|
||||||
) x on x.ip_oid = p.ip_oid
|
|
||||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.pe_id = x.pe_id
|
|
||||||
set p.ip_noti_status = e.pe_status,
|
|
||||||
p.ip_noti_code = e.pe_code,
|
|
||||||
p.ip_noti_message = e.pe_message,
|
|
||||||
p.ip_noti_failed_count = x.fail_count,
|
|
||||||
p.ip_noti_at = e.pe_created_at ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
inner join (
|
|
||||||
select ip_oid, max(pe_id) as pe_id
|
|
||||||
from `{$g5['g5_shop_inicis_pay_event_table']}`
|
|
||||||
where pe_stage = 'cancel'
|
|
||||||
group by ip_oid
|
|
||||||
) x on x.ip_oid = p.ip_oid
|
|
||||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.pe_id = x.pe_id
|
|
||||||
set p.ip_cancel_status = e.pe_status,
|
|
||||||
p.ip_cancel_code = e.pe_code,
|
|
||||||
p.ip_cancel_message = e.pe_message,
|
|
||||||
p.ip_cancel_checked_at = e.pe_created_at ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e on e.ip_oid = p.ip_oid and e.pe_stage = 'request'
|
|
||||||
set p.ip_easy_pay = case
|
|
||||||
when e.pe_message like '삼성페이%' then 'SAMSUNGPAY'
|
|
||||||
when e.pe_message like 'lpay%' then 'LPAY'
|
|
||||||
when e.pe_message like 'inicis_kakaopay%' then 'KAKAOPAY'
|
|
||||||
when e.pe_message like '간편결제%' then 'EASYPAY'
|
|
||||||
else p.ip_easy_pay
|
|
||||||
end
|
|
||||||
where p.ip_easy_pay = '' ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}`
|
|
||||||
set ip_noti_status = case
|
|
||||||
when ip_status = 'paid' then 'paid'
|
|
||||||
when ip_status = 'vbank_issued' then 'vbank_issued'
|
|
||||||
when ip_status = 'notification_received' then 'notification_received'
|
|
||||||
else ip_noti_status
|
|
||||||
end,
|
|
||||||
ip_cancel_status = case
|
|
||||||
when ip_status in ('canceled','cancel_failed','partial_canceled','partial_cancel_failed') then ip_status
|
|
||||||
else ip_cancel_status
|
|
||||||
end ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
inner join {$g5['g5_shop_order_table']} o on o.od_id = p.ip_oid
|
|
||||||
set p.ip_status = 'paid_after_cancel',
|
|
||||||
p.ip_refund_required = '1',
|
|
||||||
p.ip_noti_status = 'paid_after_cancel',
|
|
||||||
p.ip_noti_message = '취소 주문에 가상계좌 입금 확인'
|
|
||||||
where p.ip_pay_type = 'VBANK'
|
|
||||||
and p.ip_status = 'paid'
|
|
||||||
and o.od_status = '취소'
|
|
||||||
and o.od_receipt_price > 0 ", false);
|
|
||||||
$inicis_pro_migrated_at = G5_TIME_YMDHIS;
|
|
||||||
$inicis_pro_migrated_message = '기존 결제·주문 이력 대조에서 취소 후 입금 확인';
|
|
||||||
sql_query(" insert into `{$g5['g5_shop_inicis_pay_event_table']}`
|
|
||||||
(ip_oid, ip_tid, pe_stage, pe_status, pe_code, pe_message, pe_source, pe_ip, pe_created_at)
|
|
||||||
select p.ip_oid, p.ip_tid, 'reconcile', 'paid_after_cancel', '',
|
|
||||||
'".sql_escape_string($inicis_pro_migrated_message)."', 'system', '', '$inicis_pro_migrated_at'
|
|
||||||
from `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
left join `{$g5['g5_shop_inicis_pay_event_table']}` e
|
|
||||||
on e.ip_oid = p.ip_oid and e.pe_status = 'paid_after_cancel'
|
|
||||||
where p.ip_status = 'paid_after_cancel'
|
|
||||||
and p.ip_refund_required = '1'
|
|
||||||
and e.pe_id is null ", false);
|
|
||||||
sql_query(" update `{$g5['g5_shop_inicis_pay_table']}` p
|
|
||||||
inner join `{$g5['g5_shop_inicis_pay_event_table']}` e
|
|
||||||
on e.ip_oid = p.ip_oid
|
|
||||||
and e.pe_status = 'paid_after_cancel'
|
|
||||||
and e.pe_message = '".sql_escape_string($inicis_pro_migrated_message)."'
|
|
||||||
and e.pe_created_at = '$inicis_pro_migrated_at'
|
|
||||||
set p.ip_event_count = p.ip_event_count + 1 ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$inicis_pay_indexes = array(
|
|
||||||
'ip_noti_status' => "ADD KEY `ip_noti_status` (`ip_noti_status`)",
|
|
||||||
'ip_cancel_status' => "ADD KEY `ip_cancel_status` (`ip_cancel_status`)",
|
|
||||||
'ip_refund_required' => "ADD KEY `ip_refund_required` (`ip_refund_required`)"
|
|
||||||
);
|
|
||||||
foreach ($inicis_pay_indexes as $index_name => $index_sql) {
|
|
||||||
$index_result = sql_query(" SHOW INDEX FROM `{$g5['g5_shop_inicis_pay_table']}` WHERE Key_name = '$index_name' ", false);
|
|
||||||
if (!$index_result || sql_num_rows($index_result) === 0) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_pay_table']}` $index_sql ", true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sql_query(" DESC `{$g5['g5_shop_inicis_pay_event_table']}` ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_inicis_pay_event_table']}` (
|
|
||||||
`pe_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`pe_stage` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`pe_source` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`pe_ip` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`pe_created_at` datetime DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`pe_id`),
|
|
||||||
KEY `ip_oid` (`ip_oid`),
|
|
||||||
KEY `ip_tid` (`ip_tid`),
|
|
||||||
KEY `pe_status` (`pe_status`),
|
|
||||||
KEY `pe_created_at` (`pe_created_at`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_check = run_replace('admin_dbupgrade', $is_check);
|
|
||||||
|
|
||||||
$db_upgrade_msg = $is_check ? 'DB 업그레이드가 완료되었습니다.' : '더 이상 업그레이드 할 내용이 없습니다.<br>현재 DB 업그레이드가 완료된 상태입니다.';
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="local_desc01 local_desc">
|
<div class="local_desc01 local_desc">
|
||||||
<p>
|
<p><?php echo $db_upgrade_msg; ?></p>
|
||||||
<?php echo $db_upgrade_msg; ?>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ($migration_result['errors']) { ?>
|
||||||
|
<div class="local_desc01 local_desc" style="color:#d00">
|
||||||
|
<?php foreach ($migration_result['errors'] as $migration_error) { ?>
|
||||||
|
<p><?php echo htmlspecialchars($migration_error, ENT_QUOTES, 'UTF-8'); ?></p>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<form method="post" action="<?php echo G5_ADMIN_URL; ?>/dbupgrade.php" onsubmit="return confirm('선택한 DB 마이그레이션을 실행하시겠습니까? 실행 전 데이터베이스 백업을 권장합니다.');">
|
||||||
|
<input type="hidden" name="token" value="<?php echo get_admin_token(); ?>">
|
||||||
|
<div class="dbupgrade_all_actions">
|
||||||
|
<button type="submit" name="migration_id" value="" class="btn_submit">전체 마이그레이션 실행</button>
|
||||||
|
</div>
|
||||||
|
<div class="tbl_head01 tbl_wrap">
|
||||||
|
<table id="dbupgrade_migration_table">
|
||||||
|
<caption>버전형 DB 마이그레이션 목록</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" aria-sort="none"><button type="button" class="dbupgrade_sort" data-column="0">마이그레이션 <span aria-hidden="true"></span></button></th>
|
||||||
|
<th scope="col" class="dbupgrade_description" aria-sort="none"><button type="button" class="dbupgrade_sort" data-column="1">설명 <span aria-hidden="true"></span></button></th>
|
||||||
|
<th scope="col" aria-sort="none"><button type="button" class="dbupgrade_sort" data-column="2">상태 <span aria-hidden="true"></span></button></th>
|
||||||
|
<th scope="col" aria-sort="none"><button type="button" class="dbupgrade_sort" data-column="3">적용 시각 <span aria-hidden="true"></span></button></th>
|
||||||
|
<th scope="col" aria-sort="none"><button type="button" class="dbupgrade_sort" data-column="4">실행 <span aria-hidden="true"></span></button></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php $previous_migrations_ready = true; ?>
|
||||||
|
<?php foreach ($migration_statuses as $migration_status) { ?>
|
||||||
|
<?php
|
||||||
|
$current_migration_status = isset($migration_status['status']) ? $migration_status['status'] : 'error';
|
||||||
|
$migration_succeeded = $current_migration_status === 'success' && !$migration_status['checksum_changed'];
|
||||||
|
$migration_can_run = $current_migration_status !== 'error' && $current_migration_status !== 'success' && $previous_migrations_ready;
|
||||||
|
$migration_button_title = $current_migration_status === 'success' ? '이미 성공한 마이그레이션입니다.' : ($previous_migrations_ready ? '' : '선행 마이그레이션을 먼저 실행해야 합니다.');
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<?php if (isset($migration_status['error'])) { ?>
|
||||||
|
<td colspan="5"><?php echo htmlspecialchars($migration_status['error'], ENT_QUOTES, 'UTF-8'); ?></td>
|
||||||
|
<?php } else { ?>
|
||||||
|
<td><?php echo htmlspecialchars($migration_status['id'], ENT_QUOTES, 'UTF-8'); ?></td>
|
||||||
|
<td class="dbupgrade_description"><?php echo htmlspecialchars($migration_status['description'], ENT_QUOTES, 'UTF-8'); ?></td>
|
||||||
|
<td><?php echo g5_migration_status_label($migration_status['status'], $migration_status['checksum_changed']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($migration_status['applied_at'], ENT_QUOTES, 'UTF-8'); ?></td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" name="migration_id" value="<?php echo htmlspecialchars($migration_status['id'], ENT_QUOTES, 'UTF-8'); ?>" class="btn_frmline"<?php echo $migration_can_run ? '' : ' disabled'; ?><?php echo $migration_button_title !== '' ? ' title="' . htmlspecialchars($migration_button_title, ENT_QUOTES, 'UTF-8') . '"' : ''; ?>>실행</button>
|
||||||
|
</td>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
<?php $previous_migrations_ready = $previous_migrations_ready && $migration_succeeded; ?>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dbupgrade_all_actions {display:block;width:100%;margin:0 0 20px;overflow:hidden;text-align:right}
|
||||||
|
.dbupgrade_all_actions .btn_submit {display:inline-block;float:none;position:static;width:auto;height:30px;margin:0;padding:0 15px;border:0}
|
||||||
|
.dbupgrade_sort {width:100%; border:0; background:transparent; color:inherit; font:inherit; cursor:pointer}
|
||||||
|
#dbupgrade_migration_table td.dbupgrade_description {text-align:left}
|
||||||
|
#dbupgrade_migration_table th.dbupgrade_description, #dbupgrade_migration_table th.dbupgrade_description .dbupgrade_sort {text-align:center}
|
||||||
|
.btn_frmline:disabled {background:#b7b7b7;color:#fff;cursor:not-allowed}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var table = document.getElementById('dbupgrade_migration_table');
|
||||||
|
if (!table || !table.tBodies.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var buttons = table.querySelectorAll('.dbupgrade_sort');
|
||||||
|
var tbody = table.tBodies[0];
|
||||||
|
|
||||||
|
function getCellText(row, column) {
|
||||||
|
return row.cells[column] ? row.cells[column].textContent.replace(/^\s+|\s+$/g, '') : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortRows(button, initialAscending) {
|
||||||
|
var column = parseInt(button.getAttribute('data-column'), 10);
|
||||||
|
var header = button.parentNode;
|
||||||
|
var ascending = typeof initialAscending === 'boolean' ? initialAscending : header.getAttribute('aria-sort') !== 'ascending';
|
||||||
|
var rows = Array.prototype.slice.call(tbody.rows);
|
||||||
|
|
||||||
|
rows.sort(function (left, right) {
|
||||||
|
var leftText = getCellText(left, column);
|
||||||
|
var rightText = getCellText(right, column);
|
||||||
|
var compared = leftText.localeCompare(rightText, undefined, {numeric: true, sensitivity: 'base'});
|
||||||
|
|
||||||
|
return ascending ? compared : -compared;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (var i = 0; i < buttons.length; i++) {
|
||||||
|
buttons[i].parentNode.setAttribute('aria-sort', 'none');
|
||||||
|
buttons[i].getElementsByTagName('span')[0].textContent = '';
|
||||||
|
}
|
||||||
|
header.setAttribute('aria-sort', ascending ? 'ascending' : 'descending');
|
||||||
|
button.getElementsByTagName('span')[0].textContent = ascending ? '▲' : '▼';
|
||||||
|
|
||||||
|
for (var j = 0; j < rows.length; j++) {
|
||||||
|
tbody.appendChild(rows[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < buttons.length; i++) {
|
||||||
|
buttons[i].onclick = function () {
|
||||||
|
sortRows(this);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buttons.length) {
|
||||||
|
sortRows(buttons[0], false);
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once ('./admin.tail.php');
|
include_once('./admin.tail.php');
|
||||||
|
|||||||
@@ -26,14 +26,6 @@ if ($w == "u") {
|
|||||||
$g5['title'] = $html_title . ' 관리';
|
$g5['title'] = $html_title . ' 관리';
|
||||||
|
|
||||||
// 모바일 상하단 내용 필드추가
|
// 모바일 상하단 내용 필드추가
|
||||||
if (!sql_query(" select fm_mobile_head_html from {$g5['faq_master_table']} limit 1 ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['faq_master_table']}`
|
|
||||||
ADD `fm_mobile_head_html` text NOT NULL AFTER `fm_tail_html`,
|
|
||||||
ADD `fm_mobile_tail_html` text NOT NULL AFTER `fm_mobile_head_html` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once G5_ADMIN_PATH . '/admin.head.php';
|
require_once G5_ADMIN_PATH . '/admin.head.php';
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ $sql_common = " set fm_subject = '$fm_subject',
|
|||||||
fm_order = '$fm_order' ";
|
fm_order = '$fm_order' ";
|
||||||
|
|
||||||
if ($w == "") {
|
if ($w == "") {
|
||||||
$sql = " alter table {$g5['faq_master_table']} auto_increment=1 ";
|
|
||||||
sql_query($sql);
|
|
||||||
|
|
||||||
$sql = " insert {$g5['faq_master_table']} $sql_common ";
|
$sql = " insert {$g5['faq_master_table']} $sql_common ";
|
||||||
sql_query($sql);
|
sql_query($sql);
|
||||||
|
|
||||||
|
|||||||
@@ -10,45 +10,8 @@ if (!isset($g5['faq_table']) || !isset($g5['faq_master_table'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//자주하시는 질문 마스터 테이블이 있는지 검사한다.
|
//자주하시는 질문 마스터 테이블이 있는지 검사한다.
|
||||||
if (!sql_query(" DESCRIBE {$g5['faq_master_table']} ", false)) {
|
|
||||||
if (sql_query(" DESCRIBE {$g5['g5_shop_faq_master_table']} ", false)) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['g5_shop_faq_master_table']} RENAME TO `{$g5['faq_master_table']}` ;", false);
|
|
||||||
} else {
|
|
||||||
$query_cp = sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['faq_master_table']}` (
|
|
||||||
`fm_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`fm_subject` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`fm_head_html` text NOT NULL,
|
|
||||||
`fm_tail_html` text NOT NULL,
|
|
||||||
`fm_order` int(11) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`fm_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// FAQ Master
|
|
||||||
sql_query(" insert into `{$g5['faq_master_table']}` set fm_id = '1', fm_subject = '자주하시는 질문' ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//자주하시는 질문 테이블이 있는지 검사한다.
|
//자주하시는 질문 테이블이 있는지 검사한다.
|
||||||
if (!sql_query(" DESCRIBE {$g5['faq_table']} ", false)) {
|
|
||||||
if (sql_query(" DESCRIBE {$g5['g5_shop_faq_table']} ", false)) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['g5_shop_faq_table']} RENAME TO `{$g5['faq_table']}` ;", false);
|
|
||||||
} else {
|
|
||||||
$query_cp = sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['faq_table']}` (
|
|
||||||
`fa_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`fm_id` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`fa_subject` text NOT NULL,
|
|
||||||
`fa_content` text NOT NULL,
|
|
||||||
`fa_order` int(11) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`fa_id`),
|
|
||||||
KEY `fm_id` (`fm_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$g5['title'] = 'FAQ관리';
|
$g5['title'] = 'FAQ관리';
|
||||||
require_once G5_ADMIN_PATH . '/admin.head.php';
|
require_once G5_ADMIN_PATH . '/admin.head.php';
|
||||||
|
|||||||
@@ -150,62 +150,21 @@ $mb_marketing_agree_no = !$mb['mb_marketing_agree'] ? 'checked="checked"' :
|
|||||||
$mb_thirdparty_agree_yes = $mb['mb_thirdparty_agree'] ? 'checked="checked"' : '';
|
$mb_thirdparty_agree_yes = $mb['mb_thirdparty_agree'] ? 'checked="checked"' : '';
|
||||||
$mb_thirdparty_agree_no = !$mb['mb_thirdparty_agree'] ? 'checked="checked"' : '';
|
$mb_thirdparty_agree_no = !$mb['mb_thirdparty_agree'] ? 'checked="checked"' : '';
|
||||||
|
|
||||||
if (isset($mb['mb_certify'])) {
|
|
||||||
// 날짜시간형이라면 drop 시킴
|
|
||||||
if (preg_match("/-/", $mb['mb_certify'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}` DROP `mb_certify` ", false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}` ADD `mb_certify` TINYINT(4) NOT NULL DEFAULT '0' AFTER `mb_hp` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($mb['mb_adult'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}` CHANGE `mb_adult` `mb_adult` TINYINT(4) NOT NULL DEFAULT '0' ", false);
|
|
||||||
} else {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['member_table']}` ADD `mb_adult` TINYINT NOT NULL DEFAULT '0' AFTER `mb_certify` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 지번주소 필드추가
|
// 지번주소 필드추가
|
||||||
if (!isset($mb['mb_addr_jibeon'])) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_addr_jibeon` varchar(255) NOT NULL DEFAULT '' AFTER `mb_addr2` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 건물명필드추가
|
// 건물명필드추가
|
||||||
if (!isset($mb['mb_addr3'])) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `mb_addr2` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 중복가입 확인필드 추가
|
// 중복가입 확인필드 추가
|
||||||
if (!isset($mb['mb_dupinfo'])) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_dupinfo` varchar(255) NOT NULL DEFAULT '' AFTER `mb_adult` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이메일인증 체크 필드추가
|
// 이메일인증 체크 필드추가
|
||||||
if (!isset($mb['mb_email_certify2'])) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_email_certify2` varchar(255) NOT NULL DEFAULT '' AFTER `mb_email_certify` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 본인인증 내역 테이블 정보가 dbconfig에 없으면 소셜 테이블 정의
|
// 본인인증 내역 테이블 정보가 dbconfig에 없으면 소셜 테이블 정의
|
||||||
if (!isset($g5['member_cert_history'])) {
|
if (!isset($g5['member_cert_history'])) {
|
||||||
$g5['member_cert_history_table'] = G5_TABLE_PREFIX . 'member_cert_history';
|
$g5['member_cert_history_table'] = G5_TABLE_PREFIX . 'member_cert_history';
|
||||||
}
|
}
|
||||||
// 멤버 본인인증 정보 변경 내역 테이블 없을 경우 생성
|
// 멤버 본인인증 정보 변경 내역 테이블 없을 경우 생성
|
||||||
if (isset($g5['member_cert_history_table']) && !sql_query(" DESC {$g5['member_cert_history_table']} ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['member_cert_history_table']}` (
|
|
||||||
`ch_id` int(11) NOT NULL auto_increment,
|
|
||||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ch_name` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_hp` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_birth` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_type` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ch_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
PRIMARY KEY (`ch_id`),
|
|
||||||
KEY `mb_id` (`mb_id`)
|
|
||||||
) ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mb_cert_history = '';
|
$mb_cert_history = '';
|
||||||
if (isset($mb_id) && $mb_id) {
|
if (isset($mb_id) && $mb_id) {
|
||||||
|
|||||||
@@ -11,22 +11,6 @@ if (!isset($g5['menu_table'])) {
|
|||||||
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'menu_table\'] = G5_TABLE_PREFIX.\'menu\';</strong> 를 추가해 주세요.');
|
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'menu_table\'] = G5_TABLE_PREFIX.\'menu\';</strong> 를 추가해 주세요.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sql_query(" DESCRIBE {$g5['menu_table']} ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['menu_table']}` (
|
|
||||||
`me_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`me_code` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`me_name` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`me_link` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`me_target` varchar(255) NOT NULL DEFAULT '0',
|
|
||||||
`me_order` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`me_use` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`me_mobile_use` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`me_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = " select * from {$g5['menu_table']} order by me_id ";
|
$sql = " select * from {$g5['menu_table']} order by me_id ";
|
||||||
$result = sql_query($sql);
|
$result = sql_query($sql);
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ $nw = array(
|
|||||||
$html_title = "팝업레이어";
|
$html_title = "팝업레이어";
|
||||||
|
|
||||||
// 팝업레이어 테이블에 쇼핑몰, 커뮤니티 인지 구분하는 여부 필드 추가
|
// 팝업레이어 테이블에 쇼핑몰, 커뮤니티 인지 구분하는 여부 필드 추가
|
||||||
$sql = " ALTER TABLE `{$g5['new_win_table']}` ADD `nw_division` VARCHAR(10) NOT NULL DEFAULT 'both' ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
|
|
||||||
if ($w == "u") {
|
if ($w == "u") {
|
||||||
$html_title .= " 수정";
|
$html_title .= " 수정";
|
||||||
|
|||||||
@@ -8,31 +8,6 @@ if (!isset($g5['new_win_table'])) {
|
|||||||
die('<meta charset="utf-8">/data/dbconfig.php 파일에 <strong>$g5[\'new_win_table\'] = G5_TABLE_PREFIX.\'new_win\';</strong> 를 추가해 주세요.');
|
die('<meta charset="utf-8">/data/dbconfig.php 파일에 <strong>$g5[\'new_win_table\'] = G5_TABLE_PREFIX.\'new_win\';</strong> 를 추가해 주세요.');
|
||||||
}
|
}
|
||||||
//내용(컨텐츠)정보 테이블이 있는지 검사한다.
|
//내용(컨텐츠)정보 테이블이 있는지 검사한다.
|
||||||
if (!sql_query(" DESCRIBE {$g5['new_win_table']} ", false)) {
|
|
||||||
if (sql_query(" DESCRIBE {$g5['g5_shop_new_win_table']} ", false)) {
|
|
||||||
sql_query(" ALTER TABLE {$g5['g5_shop_new_win_table']} RENAME TO `{$g5['new_win_table']}` ;", false);
|
|
||||||
} else {
|
|
||||||
$query_cp = sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['new_win_table']}` (
|
|
||||||
`nw_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`nw_division` varchar(10) NOT NULL DEFAULT 'both',
|
|
||||||
`nw_device` varchar(10) NOT NULL DEFAULT 'both',
|
|
||||||
`nw_begin_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`nw_end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`nw_disable_hours` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`nw_left` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`nw_top` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`nw_height` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`nw_width` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`nw_subject` text NOT NULL,
|
|
||||||
`nw_content` text NOT NULL,
|
|
||||||
`nw_content_html` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`nw_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$g5['title'] = '팝업레이어 관리';
|
$g5['title'] = '팝업레이어 관리';
|
||||||
require_once G5_ADMIN_PATH . '/admin.head.php';
|
require_once G5_ADMIN_PATH . '/admin.head.php';
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ if ($w == '') {
|
|||||||
alert('w 값이 제대로 넘어오지 않았습니다.');
|
alert('w 값이 제대로 넘어오지 않았습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($po['po_use'])) {
|
|
||||||
sql_query(" alter table `{$g5['poll_table']}` add `po_use` tinyint not null default '0' after `mb_ids` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$g5['title'] = $html_title;
|
$g5['title'] = $html_title;
|
||||||
require_once './admin.head.php';
|
require_once './admin.head.php';
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -8,92 +8,6 @@ auth_check_menu($auth, $sub_menu, 'r');
|
|||||||
$g5['title'] = '1:1문의 설정';
|
$g5['title'] = '1:1문의 설정';
|
||||||
require_once './admin.head.php';
|
require_once './admin.head.php';
|
||||||
|
|
||||||
// DB 테이블 생성
|
|
||||||
if (!sql_query(" DESCRIBE `{$g5['qa_config_table']}` ", false)) {
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['qa_config_table']}` (
|
|
||||||
`qa_id` int(11) NOT NULL auto_increment,
|
|
||||||
`qa_title` varchar(255) NOT NULL DEFAULT'',
|
|
||||||
`qa_category` varchar(255) NOT NULL DEFAULT'',
|
|
||||||
`qa_skin` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_mobile_skin` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_use_email` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_req_email` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_use_hp` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_req_hp` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_use_sms` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_send_number` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_admin_hp` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_use_editor` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_subject_len` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_mobile_subject_len` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_page_rows` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_mobile_page_rows` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_image_width` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_upload_size` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_insert_content` text NOT NULL,
|
|
||||||
`qa_include_head` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_include_tail` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_content_head` text NOT NULL,
|
|
||||||
`qa_content_tail` text NOT NULL,
|
|
||||||
`qa_mobile_content_head` text NOT NULL,
|
|
||||||
`qa_mobile_content_tail` text NOT NULL,
|
|
||||||
`qa_1_subj` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_2_subj` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_3_subj` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_4_subj` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_5_subj` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_1` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_2` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_3` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_4` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_5` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`qa_id`)
|
|
||||||
)",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
sql_query(
|
|
||||||
" CREATE TABLE IF NOT EXISTS `{$g5['qa_content_table']}` (
|
|
||||||
`qa_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`qa_num` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_parent` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`qa_related` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`qa_name` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_email` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_hp` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_type` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_category` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_email_recv` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_sms_recv` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_html` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_subject` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_content` text NOT NULL,
|
|
||||||
`qa_status` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`qa_file1` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_source1` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_file2` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_source2` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_ip` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`qa_1` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_2` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_3` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_4` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`qa_5` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`qa_id`),
|
|
||||||
KEY `qa_num_parent` (`qa_num`,`qa_parent`)
|
|
||||||
)",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['qa_content_table']}` LIKE 'qa_content' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
if (strpos($row['Type'], 'text') === false) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['qa_content_table']}` CHANGE `qa_content` `qa_content` text NOT NULL ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qaconfig = get_qa_config();
|
$qaconfig = get_qa_config();
|
||||||
|
|
||||||
if (empty($qaconfig)) {
|
if (empty($qaconfig)) {
|
||||||
@@ -106,28 +20,6 @@ if (empty($qaconfig)) {
|
|||||||
$qaconfig = get_qa_config();
|
$qaconfig = get_qa_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 관리자 이메일필드 추가
|
|
||||||
if (!isset($qaconfig['qa_admin_email'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['qa_config_table']}`
|
|
||||||
ADD `qa_admin_email` varchar(255) NOT NULL DEFAULT '' AFTER `qa_admin_hp` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 상단 하단 설정 필드 추가
|
|
||||||
if (!isset($qaconfig['qa_include_head'])) {
|
|
||||||
sql_query(
|
|
||||||
" ALTER TABLE `{$g5['qa_config_table']}`
|
|
||||||
ADD `qa_include_head` varchar(255) NOT NULL DEFAULT '' AFTER `qa_insert_content`,
|
|
||||||
ADD `qa_include_tail` varchar(255) NOT NULL DEFAULT '' AFTER `qa_include_head`,
|
|
||||||
ADD `qa_content_head` text NOT NULL AFTER `qa_include_tail`,
|
|
||||||
ADD `qa_content_tail` text NOT NULL AFTER `qa_content_head`,
|
|
||||||
ADD `qa_mobile_content_head` text NOT NULL AFTER `qa_content_tail`,
|
|
||||||
ADD `qa_mobile_content_tail` text NOT NULL AFTER `qa_mobile_content_head` ",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form name="fqaconfigform" id="fqaconfigform" method="post" onsubmit="return fqaconfigform_submit(this);" autocomplete="off">
|
<form name="fqaconfigform" id="fqaconfigform" method="post" onsubmit="return fqaconfigform_submit(this);" autocomplete="off">
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 접속기기 필드 추가
|
// 접속기기 필드 추가
|
||||||
if(!sql_query(" select bn_device from {$g5['g5_shop_banner_table']} limit 0, 1 ")) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_banner_table']}`
|
|
||||||
ADD `bn_device` varchar(10) not null default '' AFTER `bn_url` ", true);
|
|
||||||
sql_query(" update {$g5['g5_shop_banner_table']} set bn_device = 'pc' ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ if ($w=="")
|
|||||||
{
|
{
|
||||||
if (!$bn_bimg_name) alert('배너 이미지를 업로드 하세요.');
|
if (!$bn_bimg_name) alert('배너 이미지를 업로드 하세요.');
|
||||||
|
|
||||||
sql_query(" alter table {$g5['g5_shop_banner_table']} auto_increment=1 ");
|
|
||||||
|
|
||||||
$sql = " insert into {$g5['g5_shop_banner_table']}
|
$sql = " insert into {$g5['g5_shop_banner_table']}
|
||||||
set bn_alt = '$bn_alt',
|
set bn_alt = '$bn_alt',
|
||||||
bn_url = '$bn_url',
|
bn_url = '$bn_url',
|
||||||
|
|||||||
@@ -109,30 +109,12 @@ if ($w == 'u') $pg_anchor .= '<li><a href="#frm_etc">기타설정</a></li>';
|
|||||||
$pg_anchor .= '</ul>';
|
$pg_anchor .= '</ul>';
|
||||||
|
|
||||||
// 쿠폰 적용 불가 설정 필드 추가
|
// 쿠폰 적용 불가 설정 필드 추가
|
||||||
if(!sql_query(" select ca_nocoupon from {$g5['g5_shop_category_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
|
|
||||||
ADD `ca_nocoupon` tinyint(4) NOT NULL DEFAULT '0' AFTER `ca_adult_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스킨 디렉토리 필드 추가
|
// 스킨 디렉토리 필드 추가
|
||||||
if(!sql_query(" select ca_skin_dir from {$g5['g5_shop_category_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
|
|
||||||
ADD `ca_skin_dir` varchar(255) NOT NULL DEFAULT '' AFTER `ca_name`,
|
|
||||||
ADD `ca_mobile_skin_dir` varchar(255) NOT NULL DEFAULT '' AFTER `ca_skin_dir` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 분류 출력순서 필드 추가
|
// 분류 출력순서 필드 추가
|
||||||
if(!sql_query(" select ca_order from {$g5['g5_shop_category_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
|
|
||||||
ADD `ca_order` int(11) NOT NULL DEFAULT '0' AFTER `ca_name` ", true);
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}` ADD INDEX(`ca_order`) ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 상품 출력줄수 필드 추가
|
// 모바일 상품 출력줄수 필드 추가
|
||||||
if(!sql_query(" select ca_mobile_list_row from {$g5['g5_shop_category_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_category_table']}`
|
|
||||||
ADD `ca_mobile_list_row` int(11) NOT NULL DEFAULT '0' AFTER `ca_mobile_list_mod` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스킨 Path
|
// 스킨 Path
|
||||||
if(!$ca['ca_skin_dir'])
|
if(!$ca['ca_skin_dir'])
|
||||||
|
|||||||
@@ -27,240 +27,6 @@ $pg_anchor = '<ul class="anchor">
|
|||||||
<li><a href="#anc_scf_sms">SMS설정</a></li>
|
<li><a href="#anc_scf_sms">SMS설정</a></li>
|
||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
// 무이자 할부 사용설정 필드 추가
|
|
||||||
if(!isset($default['de_card_noint_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_card_noint_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_card_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 관련상품 설정 필드추가
|
|
||||||
if(!isset($default['de_mobile_rel_list_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_mobile_rel_list_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_rel_img_height`,
|
|
||||||
ADD `de_mobile_rel_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_mobile_rel_list_use`,
|
|
||||||
ADD `de_mobile_rel_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_rel_list_skin`,
|
|
||||||
ADD `de_mobile_rel_img_height` int(11) NOT NULL DEFAULT ' 0' AFTER `de_mobile_rel_img_width`", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 신규회원 쿠폰 설정 필드 추가
|
|
||||||
if(!isset($default['de_member_reg_coupon_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_member_reg_coupon_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_tax_flag_use`,
|
|
||||||
ADD `de_member_reg_coupon_term` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_use`,
|
|
||||||
ADD `de_member_reg_coupon_price` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_term` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 신규회원 쿠폰 주문 최소금액 필드추가
|
|
||||||
if(!isset($default['de_member_reg_coupon_minimum'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_member_reg_coupon_minimum` int(11) NOT NULL DEFAULT '0' AFTER `de_member_reg_coupon_price` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lg 결제관련 필드 추가
|
|
||||||
if(!isset($default['de_pg_service'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_pg_service` varchar(255) NOT NULL DEFAULT '' AFTER `de_sms_hp` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// inicis 필드 추가
|
|
||||||
if(!isset($default['de_inicis_mid'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_inicis_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kcp_site_key` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 초기화면 이미지 줄 수 필드 추가
|
|
||||||
if(!isset($default['de_mobile_type1_list_row'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_mobile_type1_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type1_list_mod`,
|
|
||||||
ADD `de_mobile_type2_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type2_list_mod`,
|
|
||||||
ADD `de_mobile_type3_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type3_list_mod`,
|
|
||||||
ADD `de_mobile_type4_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type4_list_mod`,
|
|
||||||
ADD `de_mobile_type5_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_type5_list_mod` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 관련상품 이미지 줄 수 필드 추가
|
|
||||||
if(!isset($default['de_mobile_rel_list_mod'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_mobile_rel_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_rel_list_skin` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 검색상품 이미지 줄 수 필드 추가
|
|
||||||
if(!isset($default['de_mobile_search_list_row'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_mobile_search_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_search_list_mod` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PG 간펼결제 사용여부 필드 추가
|
|
||||||
if(!isset($default['de_easy_pay_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_easy_pay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_iche_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이니시스 삼성페이 사용여부 필드 추가
|
|
||||||
if(!isset($default['de_samsung_pay_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_samsung_pay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_easy_pay_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이니시스
|
|
||||||
if(!isset($default['de_inicis_cartpoint_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_inicis_cartpoint_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_samsung_pay_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이니시스 lpay 사용여부 필드 추가
|
|
||||||
if(!isset($default['de_inicis_lpay_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_inicis_lpay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_samsung_pay_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이니시스 kakaopay 사용여부 필드 추가
|
|
||||||
if(!isset($default['de_inicis_kakaopay_use'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_inicis_kakaopay_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_inicis_lpay_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 카카오페이 필드 추가
|
|
||||||
if(!isset($default['de_kakaopay_mid'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_kakaopay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_tax_flag_use`,
|
|
||||||
ADD `de_kakaopay_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_mid`,
|
|
||||||
ADD `de_kakaopay_enckey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_key`,
|
|
||||||
ADD `de_kakaopay_hashkey` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_enckey`,
|
|
||||||
ADD `de_kakaopay_cancelpwd` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_hashkey` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 이니시스 웹결제 사인키 필드 추가
|
|
||||||
if(!isset($default['de_inicis_sign_key'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_inicis_sign_key` varchar(255) NOT NULL DEFAULT '' ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 네이버페이 필드추가
|
|
||||||
if(!isset($default['de_naverpay_mid'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_naverpay_mid` varchar(255) NOT NULL DEFAULT '' AFTER `de_kakaopay_cancelpwd`,
|
|
||||||
ADD `de_naverpay_cert_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mid`,
|
|
||||||
ADD `de_naverpay_button_key` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_cert_key`,
|
|
||||||
ADD `de_naverpay_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `de_naverpay_button_key`,
|
|
||||||
ADD `de_naverpay_mb_id` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_test`,
|
|
||||||
ADD `de_naverpay_sendcost` varchar(255) NOT NULL DEFAULT '' AFTER `de_naverpay_mb_id`", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 유형별상품리스트 설정필드 추가
|
|
||||||
if(!isset($default['de_listtype_list_skin'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_listtype_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_mobile_search_img_height`,
|
|
||||||
ADD `de_listtype_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_skin`,
|
|
||||||
ADD `de_listtype_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_mod`,
|
|
||||||
ADD `de_listtype_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_list_row`,
|
|
||||||
ADD `de_listtype_img_height` int(11) NOT NULL DEFAULT '0' AFTER `de_listtype_img_width`,
|
|
||||||
ADD `de_mobile_listtype_list_skin` varchar(255) NOT NULL DEFAULT '' AFTER `de_listtype_img_height`,
|
|
||||||
ADD `de_mobile_listtype_list_mod` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_skin`,
|
|
||||||
ADD `de_mobile_listtype_list_row` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_mod`,
|
|
||||||
ADD `de_mobile_listtype_img_width` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_list_row`,
|
|
||||||
ADD `de_mobile_listtype_img_height` int(11) NOT NULL DEFAULT '0' AFTER `de_mobile_listtype_img_width` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 임시저장 테이블이 없을 경우 생성
|
|
||||||
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
|
|
||||||
`log_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`oid` bigint(20) unsigned NOT NULL,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`post_data` text NOT NULL,
|
|
||||||
`ol_code` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ol_msg` text NOT NULL,
|
|
||||||
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`ol_ip` varchar(25) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`log_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 현금영수증 발급 조건 추가
|
|
||||||
if(!isset($default['de_taxsave_types'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD `de_taxsave_types` set('account','vbank','transfer') NOT NULL DEFAULT 'account' AFTER `de_taxsave_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 아이코드 토큰키 추가
|
|
||||||
if( ! isset($config['cf_icode_token_key']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_icode_token_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_icode_server_port`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PG 간편결제 추가 ( NHN_KCP 네이버페이, 카카오페이 )
|
|
||||||
if( ! isset($default['de_easy_pay_services']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD COLUMN `de_easy_pay_services` VARCHAR(255) NOT NULL DEFAULT '' AFTER `de_easy_pay_use`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// KG 이니시스 iniapi_key 추가
|
|
||||||
if( ! isset($default['de_inicis_iniapi_key']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD COLUMN `de_inicis_iniapi_key` VARCHAR(30) NOT NULL DEFAULT '' AFTER `de_inicis_sign_key`,
|
|
||||||
ADD COLUMN `de_inicis_iniapi_iv` VARCHAR(30) NOT NULL DEFAULT '' AFTER `de_inicis_iniapi_key`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// KG이니시스 INIpay PRO 설정 추가
|
|
||||||
if (!isset($default['de_inicis_pro_use'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD COLUMN `de_inicis_pro_use` TINYINT(4) NOT NULL DEFAULT '0' AFTER `de_inicis_sign_key`,
|
|
||||||
ADD COLUMN `de_inicis_hash_key` VARCHAR(255) NOT NULL DEFAULT '' AFTER `de_inicis_pro_use`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($default['de_inicis_pro_alert_use'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_alert_use` TINYINT(4) NOT NULL DEFAULT '1'", false);
|
|
||||||
$default['de_inicis_pro_alert_use'] = 1;
|
|
||||||
}
|
|
||||||
if (!isset($default['de_inicis_pro_reconcile_use'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_reconcile_use` TINYINT(4) NOT NULL DEFAULT '0'", false);
|
|
||||||
$default['de_inicis_pro_reconcile_use'] = 0;
|
|
||||||
}
|
|
||||||
if (!isset($default['de_inicis_pro_log_days'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_log_days` INT(11) NOT NULL DEFAULT '365'", false);
|
|
||||||
$default['de_inicis_pro_log_days'] = 365;
|
|
||||||
}
|
|
||||||
if (!isset($default['de_inicis_pro_summary_days'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_summary_days` INT(11) NOT NULL DEFAULT '1825'", false);
|
|
||||||
$default['de_inicis_pro_summary_days'] = 1825;
|
|
||||||
}
|
|
||||||
if (!array_key_exists('de_inicis_pro_monitor_at', $default)) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_monitor_at` DATETIME DEFAULT NULL", false);
|
|
||||||
$default['de_inicis_pro_monitor_at'] = '';
|
|
||||||
}
|
|
||||||
if (!isset($default['de_inicis_pro_monitor_message'])) {
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_default_table']}` ADD COLUMN `de_inicis_pro_monitor_message` VARCHAR(255) NOT NULL DEFAULT ''", false);
|
|
||||||
$default['de_inicis_pro_monitor_message'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// KG이니시스 INIpay PRO 결제 감사 테이블이 없으면 생성한다.
|
|
||||||
include_once(G5_SHOP_PATH.'/inicis/pro/inicis_pro.lib.php');
|
|
||||||
if (function_exists('inicis_pro_audit_ensure_tables'))
|
|
||||||
inicis_pro_audit_ensure_tables();
|
|
||||||
|
|
||||||
// NICEPAY mid, key 추가
|
|
||||||
if (! isset($default['de_nicepay_mid'])) {
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_default_table']}`
|
|
||||||
ADD COLUMN `de_nicepay_mid` VARCHAR(20) NOT NULL DEFAULT '' AFTER `de_inicis_cartpoint_use`,
|
|
||||||
ADD COLUMN `de_nicepay_key` VARCHAR(150) NOT NULL DEFAULT '' AFTER `de_nicepay_mid`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 토스페이먼츠 client, secret key 추가
|
|
||||||
if( ! isset($config['cf_toss_client_key']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_toss_client_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_lg_mert_key`,
|
|
||||||
ADD COLUMN `cf_toss_secret_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_toss_client_key`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( function_exists('pg_setting_check') ){
|
if( function_exists('pg_setting_check') ){
|
||||||
pg_setting_check(true);
|
pg_setting_check(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,10 +73,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 모바일 1줄당 이미지수 필드 추가
|
// 모바일 1줄당 이미지수 필드 추가
|
||||||
if(!sql_query(" select ev_mobile_list_row from {$g5['g5_shop_event_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_event_table']}`
|
|
||||||
ADD `ev_mobile_list_row` int(11) NOT NULL DEFAULT '0' AFTER `ev_mobile_list_mod` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -158,29 +158,13 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 재입고알림 설정 필드 추가
|
// 재입고알림 설정 필드 추가
|
||||||
if(!sql_query(" select it_stock_sms from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_stock_sms` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_stock_qty` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 추가옵션 포인트 설정 필드 추가
|
// 추가옵션 포인트 설정 필드 추가
|
||||||
if(!sql_query(" select it_supply_point from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_supply_point` int(11) NOT NULL DEFAULT '0' AFTER `it_point_type` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 상품메모 필드 추가
|
// 상품메모 필드 추가
|
||||||
if(!sql_query(" select it_shop_memo from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_shop_memo` text NOT NULL AFTER `it_use_avg` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 지식쇼핑 PID 필드추가
|
// 지식쇼핑 PID 필드추가
|
||||||
// 상품메모 필드 추가
|
// 상품메모 필드 추가
|
||||||
if(!sql_query(" select ec_mall_pid from {$g5['g5_shop_item_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `ec_mall_pid` varchar(255) NOT NULL AFTER `it_shop_memo` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pg_anchor ='<ul class="anchor">
|
$pg_anchor ='<ul class="anchor">
|
||||||
<li><a href="#anc_sitfrm_cate">상품분류</a></li>
|
<li><a href="#anc_sitfrm_cate">상품분류</a></li>
|
||||||
@@ -199,17 +183,8 @@ $pg_anchor ='<ul class="anchor">
|
|||||||
|
|
||||||
|
|
||||||
// 쿠폰적용안함 설정 필드 추가
|
// 쿠폰적용안함 설정 필드 추가
|
||||||
if(!sql_query(" select it_nocoupon from {$g5['g5_shop_item_table']} limit 1", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_nocoupon` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_use` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 스킨필드 추가
|
// 스킨필드 추가
|
||||||
if(!sql_query(" select it_skin from {$g5['g5_shop_item_table']} limit 1", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_skin` varchar(255) NOT NULL DEFAULT '' AFTER `ca_id3`,
|
|
||||||
ADD `it_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `it_skin` ", true);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form name="fitemform" action="./itemformupdate.php" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
|
<form name="fitemform" action="./itemformupdate.php" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
|
||||||
|
|||||||
@@ -11,18 +11,6 @@ include_once (G5_ADMIN_PATH.'/admin.head.php');
|
|||||||
if(!isset($g5['g5_shop_item_stocksms_table']))
|
if(!isset($g5['g5_shop_item_stocksms_table']))
|
||||||
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'g5_shop_item_stocksms_table\'] = G5_SHOP_TABLE_PREFIX.\'item_stocksms\';</strong> 를 추가해 주세요.');
|
die('<meta charset="utf-8">dbconfig.php 파일에 <strong>$g5[\'g5_shop_item_stocksms_table\'] = G5_SHOP_TABLE_PREFIX.\'item_stocksms\';</strong> 를 추가해 주세요.');
|
||||||
|
|
||||||
if(!sql_query(" select ss_id from {$g5['g5_shop_item_stocksms_table']} limit 1", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_item_stocksms_table']}` (
|
|
||||||
`ss_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`it_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ss_hp` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ss_send` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ss_send_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`ss_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`ss_ip` varchar(25) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`ss_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
|
||||||
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('it_id', 'ss_hp', 'ss_send', 'ss_send_time', 'ss_datetime'))) ? $_GET['sort1'] : 'ss_send';
|
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('it_id', 'ss_hp', 'ss_send', 'ss_send_time', 'ss_datetime'))) ? $_GET['sort1'] : 'ss_send';
|
||||||
|
|||||||
@@ -18,13 +18,6 @@ if (!$is['is_id'])
|
|||||||
alert('등록된 자료가 없습니다.');
|
alert('등록된 자료가 없습니다.');
|
||||||
|
|
||||||
// 사용후기 의 답변 필드 추가
|
// 사용후기 의 답변 필드 추가
|
||||||
if (!isset($is['is_reply_subject'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_item_use_table']}`
|
|
||||||
ADD COLUMN `is_reply_subject` VARCHAR(255) NOT NULL DEFAULT '' AFTER `is_confirm`,
|
|
||||||
ADD COLUMN `is_reply_content` TEXT NOT NULL AFTER `is_reply_subject`,
|
|
||||||
ADD COLUMN `is_reply_name` VARCHAR(25) NOT NULL DEFAULT '' AFTER `is_reply_content`
|
|
||||||
", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$name = get_sideview($is['mb_id'], get_text($is['is_name']), $is['mb_email'], $is['mb_homepage']);
|
$name = get_sideview($is['mb_id'], get_text($is['is_name']), $is['mb_email'], $is['mb_homepage']);
|
||||||
|
|
||||||
|
|||||||
@@ -76,27 +76,10 @@ $sql = " select it_id,
|
|||||||
$result = sql_query($sql);
|
$result = sql_query($sql);
|
||||||
|
|
||||||
// 주소 참고항목 필드추가
|
// 주소 참고항목 필드추가
|
||||||
if(!isset($od['od_addr3'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
|
|
||||||
ADD `od_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `od_addr2`,
|
|
||||||
ADD `od_b_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `od_b_addr2` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 배송목록에 참고항목 필드추가
|
// 배송목록에 참고항목 필드추가
|
||||||
if(!sql_query(" select ad_addr3 from {$g5['g5_shop_order_address_table']} limit 1", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_address_table']}`
|
|
||||||
ADD `ad_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `ad_addr2` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결제 PG 필드 추가
|
// 결제 PG 필드 추가
|
||||||
if(!sql_query(" select od_pg from {$g5['g5_shop_order_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
|
|
||||||
ADD `od_pg` varchar(255) NOT NULL DEFAULT '' AFTER `od_mobile`,
|
|
||||||
ADD `od_casseqno` varchar(255) NOT NULL DEFAULT '' AFTER `od_escrow` ", true);
|
|
||||||
|
|
||||||
// 주문 결제 PG kcp로 설정
|
|
||||||
sql_query(" update {$g5['g5_shop_order_table']} set od_pg = 'kcp' ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// LG 현금영수증 JS
|
// LG 현금영수증 JS
|
||||||
if($od['od_pg'] == 'lg') {
|
if($od['od_pg'] == 'lg') {
|
||||||
|
|||||||
@@ -140,12 +140,6 @@ $qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
|
|||||||
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
|
||||||
|
|
||||||
// 주문삭제 히스토리 테이블 필드 추가
|
// 주문삭제 히스토리 테이블 필드 추가
|
||||||
if(!sql_query(" select mb_id from {$g5['g5_shop_order_delete_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_delete_table']}`
|
|
||||||
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `de_data`,
|
|
||||||
ADD `de_ip` varchar(255) NOT NULL DEFAULT '' AFTER `mb_id`,
|
|
||||||
ADD `de_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `de_ip` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( function_exists('pg_setting_check') ){
|
if( function_exists('pg_setting_check') ){
|
||||||
pg_setting_check(true);
|
pg_setting_check(true);
|
||||||
|
|||||||
@@ -60,24 +60,8 @@ $pg_anchor = '<ul class="anchor">
|
|||||||
</ul>';
|
</ul>';
|
||||||
|
|
||||||
// pg 설정 필드 추가
|
// pg 설정 필드 추가
|
||||||
if(!sql_query(" select pp_pg from {$g5['g5_shop_personalpay_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_personalpay_table']}`
|
|
||||||
ADD `pp_pg` varchar(255) NOT NULL DEFAULT '' AFTER `pp_price` ", true);
|
|
||||||
|
|
||||||
// 개인결제 PG kcp로 설정
|
|
||||||
sql_query(" update {$g5['g5_shop_personalpay_table']} set pp_pg = 'kcp' ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 현금영수증 필드 추가
|
// 현금영수증 필드 추가
|
||||||
if(!sql_query(" select pp_cash from {$g5['g5_shop_personalpay_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_personalpay_table']}`
|
|
||||||
ADD `pp_cash` tinyint(4) NOT NULL DEFAULT '0' AFTER `pp_shop_memo`,
|
|
||||||
ADD `pp_cash_no` varchar(255) NOT NULL DEFAULT '' AFTER `pp_cash`,
|
|
||||||
ADD `pp_cash_info` text NOT NULL AFTER `pp_cash_no`,
|
|
||||||
ADD `pp_email` varchar(255) NOT NULL DEFAULT '' AFTER `pp_name`,
|
|
||||||
ADD `pp_hp` varchar(255) NOT NULL DEFAULT '' AFTER `pp_email`,
|
|
||||||
ADD `pp_casseqno` varchar(255) NOT NULL DEFAULT '' AFTER `pp_app_no` ", true);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form name="fpersonalpayform" action="./personalpayformupdate.php" method="post" onsubmit="return form_check(this);">
|
<form name="fpersonalpayform" action="./personalpayformupdate.php" method="post" onsubmit="return form_check(this);">
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.2
|
|||||||
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
||||||
|
|
||||||
// 아이코드 토큰키 추가
|
// 아이코드 토큰키 추가
|
||||||
if( ! isset($config['cf_icode_token_key']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD COLUMN `cf_icode_token_key` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_icode_server_port`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
$config['cf_icode_token_key'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 배열코드 초기화
|
// 배열코드 초기화
|
||||||
$userinfo = array('payment'=>'', 'coin'=>'');
|
$userinfo = array('payment'=>'', 'coin'=>'');
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ check_admin_token();
|
|||||||
|
|
||||||
$result = sql_query("describe `{$g5['sms5_write_table']}`");
|
$result = sql_query("describe `{$g5['sms5_write_table']}`");
|
||||||
while ($row = sql_fetch_array($result)){
|
while ($row = sql_fetch_array($result)){
|
||||||
if( $row['Field'] === 'wr_message' && $row['Type'] === 'varchar(255)' ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['sms5_write_table']}` MODIFY wr_message TEXT NOT NULL;", false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$g5['title'] = "문자전송중";
|
$g5['title'] = "문자전송중";
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ if ($is_admin != 'super')
|
|||||||
alert('최고관리자만 접근 가능합니다.');
|
alert('최고관리자만 접근 가능합니다.');
|
||||||
|
|
||||||
// 테마 필드 추가
|
// 테마 필드 추가
|
||||||
if(!isset($config['cf_theme'])) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
|
||||||
ADD `cf_theme` varchar(255) NOT NULL DEFAULT '' AFTER `cf_title` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$theme = get_theme_dir();
|
$theme = get_theme_dir();
|
||||||
if($config['cf_theme'] && in_array($config['cf_theme'], $theme))
|
if($config['cf_theme'] && in_array($config['cf_theme'], $theme))
|
||||||
|
|||||||
Executable
+220
@@ -0,0 +1,220 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
if (PHP_SAPI !== 'cli') {
|
||||||
|
exit("CLI에서만 실행할 수 있습니다.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$root = dirname(dirname(__FILE__));
|
||||||
|
chdir($root);
|
||||||
|
|
||||||
|
define('G5_IS_CLI', true);
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = $root . '/index.php';
|
||||||
|
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||||
|
$_SERVER['REQUEST_URI'] = '/';
|
||||||
|
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||||
|
$_SERVER['SERVER_PORT'] = 80;
|
||||||
|
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'CLI';
|
||||||
|
|
||||||
|
require_once $root . '/common.php';
|
||||||
|
require_once G5_LIB_PATH . '/migration.lib.php';
|
||||||
|
|
||||||
|
$test_suffix = substr(md5(getmypid() . microtime()), 0, 10);
|
||||||
|
$test_config_table = G5_TABLE_PREFIX . 'migration_test_config_' . $test_suffix;
|
||||||
|
$test_auth_table = G5_TABLE_PREFIX . 'migration_test_auth_' . $test_suffix;
|
||||||
|
$test_memo_table = G5_TABLE_PREFIX . 'migration_test_memo_' . $test_suffix;
|
||||||
|
$test_member_table = G5_TABLE_PREFIX . 'migration_test_member_' . $test_suffix;
|
||||||
|
$test_board_file_table = G5_TABLE_PREFIX . 'migration_test_board_file_' . $test_suffix;
|
||||||
|
$test_social_profile_table = G5_TABLE_PREFIX . 'migration_test_social_' . $test_suffix;
|
||||||
|
$test_content_table = G5_TABLE_PREFIX . 'migration_test_content_' . $test_suffix;
|
||||||
|
$test_board_table = G5_TABLE_PREFIX . 'migration_test_board_' . $test_suffix;
|
||||||
|
$test_write_prefix = G5_TABLE_PREFIX . 'migration_test_write_' . $test_suffix . '_';
|
||||||
|
$test_write_table = $test_write_prefix . 'sample';
|
||||||
|
$test_cart_table = G5_TABLE_PREFIX . 'migration_test_cart_' . $test_suffix;
|
||||||
|
$test_item_table = G5_TABLE_PREFIX . 'migration_test_item_' . $test_suffix;
|
||||||
|
$test_shop_default_table = G5_TABLE_PREFIX . 'migration_test_default_' . $test_suffix;
|
||||||
|
$test_inicis_pay_table = G5_TABLE_PREFIX . 'migration_test_inicis_' . $test_suffix;
|
||||||
|
$test_inicis_pay_event_table = G5_TABLE_PREFIX . 'migration_test_inicis_event_' . $test_suffix;
|
||||||
|
$test_absent_prefix = G5_TABLE_PREFIX . 'migration_test_absent_' . $test_suffix . '_';
|
||||||
|
$test_tables = array($test_config_table, $test_auth_table, $test_memo_table, $test_member_table, $test_board_file_table, $test_social_profile_table, $test_content_table, $test_board_table, $test_write_table, $test_cart_table, $test_item_table, $test_shop_default_table, $test_inicis_pay_table, $test_inicis_pay_event_table);
|
||||||
|
|
||||||
|
function g5_migration_test_cleanup()
|
||||||
|
{
|
||||||
|
global $test_tables;
|
||||||
|
foreach ($test_tables as $table) {
|
||||||
|
sql_query("DROP TABLE IF EXISTS `" . str_replace('`', '``', $table) . "`", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_test_fail($message)
|
||||||
|
{
|
||||||
|
fwrite(STDERR, '[실패] ' . $message . "\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_test_execute($migration)
|
||||||
|
{
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
g5_migration_test_fail($migration['error']);
|
||||||
|
}
|
||||||
|
foreach ($migration['statements'] as $statement) {
|
||||||
|
if (!g5_migration_should_run_statement($statement['conditions'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$result = g5_migration_execute_statement($statement);
|
||||||
|
if ($result['error'] !== '') {
|
||||||
|
g5_migration_test_fail($result['error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
register_shutdown_function('g5_migration_test_cleanup');
|
||||||
|
g5_migration_test_cleanup();
|
||||||
|
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_config_table}` (
|
||||||
|
`cf_googl_shorturl_apikey` varchar(50) NOT NULL DEFAULT '',
|
||||||
|
`cf_twitter_secret` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cf_kakao_js_apikey` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cf_member_icon_height` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cf_google_clientid` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cf_member_img_width` int(11) NOT NULL DEFAULT '0'
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_auth_table}` (`au_menu` varchar(20) NOT NULL DEFAULT '') ENGINE=MyISAM DEFAULT CHARSET=utf8", false) ||
|
||||||
|
!sql_query("CREATE TABLE `{$test_memo_table}` (`me_id` int(11) NOT NULL, PRIMARY KEY (`me_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8", false) ||
|
||||||
|
!sql_query("CREATE TABLE `{$test_member_table}` (`mb_marketing_agree` tinyint(1) NOT NULL DEFAULT '0') ENGINE=MyISAM DEFAULT CHARSET=utf8", false) ||
|
||||||
|
!sql_query("CREATE TABLE `{$test_board_file_table}` (`bf_fileurl` varchar(255) NOT NULL DEFAULT '') ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_content_table}` (
|
||||||
|
`co_id` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`co_subject` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`co_seo_title` varchar(200) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`co_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_board_table}` (`bo_table` varchar(20) NOT NULL DEFAULT '') ENGINE=MyISAM DEFAULT CHARSET=utf8", false) ||
|
||||||
|
!sql_query("CREATE TABLE `{$test_write_table}` (`wr_id` int(11) NOT NULL AUTO_INCREMENT, `wr_seo_title` varchar(200) NOT NULL DEFAULT '', PRIMARY KEY (`wr_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8", false) ||
|
||||||
|
!sql_query("INSERT INTO `{$test_board_table}` SET bo_table = 'sample'", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_cart_table}` (
|
||||||
|
`ct_id` int(11) NOT NULL AUTO_INCREMENT, `it_id` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`it_name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`it_sc_method` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`ct_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_item_table}` (
|
||||||
|
`it_id` varchar(20) NOT NULL DEFAULT '', `it_sc_type` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`it_sc_method` tinyint(4) NOT NULL DEFAULT '0', `it_sc_price` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`it_sc_minimum` int(11) NOT NULL DEFAULT '0', `it_sc_qty` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`it_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_shop_default_table}` (`de_inicis_pro_reconcile_use` tinyint(4) NOT NULL DEFAULT '0') ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
if (!sql_query("CREATE TABLE `{$test_inicis_pay_table}` (
|
||||||
|
`ip_id` int(11) NOT NULL AUTO_INCREMENT, `ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||||
|
`ip_environment` varchar(10) NOT NULL DEFAULT '', PRIMARY KEY (`ip_id`), UNIQUE KEY `ip_oid` (`ip_oid`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8", false)) {
|
||||||
|
g5_migration_test_fail(sql_error_info());
|
||||||
|
}
|
||||||
|
|
||||||
|
$g5['config_table'] = $test_config_table;
|
||||||
|
$g5['auth_table'] = $test_auth_table;
|
||||||
|
$g5['memo_table'] = $test_memo_table;
|
||||||
|
$g5['member_table'] = $test_member_table;
|
||||||
|
$g5['board_file_table'] = $test_board_file_table;
|
||||||
|
$g5['social_profile_table'] = $test_social_profile_table;
|
||||||
|
$g5['content_table'] = $test_content_table;
|
||||||
|
$g5['board_table'] = $test_board_table;
|
||||||
|
$g5['write_prefix'] = $test_write_prefix;
|
||||||
|
$g5['g5_shop_cart_table'] = $test_cart_table;
|
||||||
|
$g5['g5_shop_item_table'] = $test_item_table;
|
||||||
|
$g5['g5_shop_default_table'] = $test_shop_default_table;
|
||||||
|
$g5['g5_shop_inicis_pay_table'] = $test_inicis_pay_table;
|
||||||
|
$g5['g5_shop_inicis_pay_event_table'] = $test_inicis_pay_event_table;
|
||||||
|
$isolated_keys = array(
|
||||||
|
'g5_shop_order_data_table', 'g5_shop_inicis_log_table'
|
||||||
|
);
|
||||||
|
foreach ($isolated_keys as $index => $key) {
|
||||||
|
$g5[$key] = $test_absent_prefix . $index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 복합 ALTER의 첫 컬럼만 없는 역방향 부분 적용 상태에서도 과거 마이그레이션이 중단되지 않아야 한다.
|
||||||
|
g5_migration_test_execute(g5_migration_parse_file(G5_PATH . '/migrations/20140331_001_shop_cart_shipping.sql'));
|
||||||
|
g5_migration_test_execute(g5_migration_parse_file(G5_PATH . '/migrations/20180330_001_social_login.sql'));
|
||||||
|
g5_migration_test_execute(g5_migration_parse_file(G5_PATH . '/migrations/20260723_001_inicis_pro.sql'));
|
||||||
|
if (!g5_migration_column_exists($test_cart_table, 'it_sc_type') ||
|
||||||
|
!g5_migration_column_exists($test_config_table, 'cf_social_login_use') ||
|
||||||
|
!g5_migration_column_exists($test_config_table, 'cf_member_img_size') ||
|
||||||
|
!g5_migration_column_exists($test_shop_default_table, 'de_inicis_pro_alert_use')) {
|
||||||
|
g5_migration_test_fail('역방향 부분 적용 스키마에서 과거 복합 변경의 기준 컬럼을 복구하지 못했습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$schema_migration = g5_migration_parse_file(G5_PATH . '/migrations/20260904_002_reconcile_partial_schema.sql');
|
||||||
|
g5_migration_test_execute($schema_migration);
|
||||||
|
if (!g5_migration_column_exists($test_config_table, 'cf_google_secret') ||
|
||||||
|
!g5_migration_column_exists($test_config_table, 'cf_member_img_width') ||
|
||||||
|
!g5_migration_column_exists($test_config_table, 'cf_member_img_height')) {
|
||||||
|
g5_migration_test_fail('부분 적용 설정 테이블의 누락 컬럼을 복구하지 못했습니다.');
|
||||||
|
}
|
||||||
|
if (!g5_migration_column_exists($test_cart_table, 'it_sc_method') ||
|
||||||
|
!g5_migration_column_exists($test_shop_default_table, 'de_inicis_pro_monitor_message') ||
|
||||||
|
!g5_migration_column_exists($test_inicis_pay_table, 'ip_pg_status') ||
|
||||||
|
!g5_migration_index_exists($test_inicis_pay_table, 'ip_refund_required')) {
|
||||||
|
g5_migration_test_fail('부분 적용 쇼핑몰 테이블의 누락 컬럼 또는 인덱스를 복구하지 못했습니다.');
|
||||||
|
}
|
||||||
|
$write_column = sql_fetch("SHOW COLUMNS FROM `{$test_write_table}` LIKE 'wr_seo_title'", false);
|
||||||
|
if (!isset($write_column['Type']) || strtolower($write_column['Type']) !== 'varchar(255)') {
|
||||||
|
g5_migration_test_fail('게시판 글 SEO 컬럼의 최종 자료형을 보정하지 못했습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_query("INSERT INTO `{$test_config_table}` SET cf_member_img_size = 0, cf_member_img_width = 0, cf_member_img_height = 0", false);
|
||||||
|
sql_query("INSERT INTO `{$test_content_table}` SET co_id = 'company', co_subject = '회사 소개', co_seo_title = ''", false);
|
||||||
|
sql_query("INSERT INTO `{$test_item_table}` SET it_id = 'item-1', it_sc_type = 2, it_sc_method = 1, it_sc_price = 3000, it_sc_minimum = 50000, it_sc_qty = 2", false);
|
||||||
|
sql_query("INSERT INTO `{$test_cart_table}` SET it_id = 'item-1'", false);
|
||||||
|
|
||||||
|
$data_migration = g5_migration_parse_file(G5_PATH . '/migrations/20260904_003_backfill_legacy_data.sql');
|
||||||
|
g5_migration_test_execute($data_migration);
|
||||||
|
|
||||||
|
$config_row = sql_fetch("SELECT cf_member_img_size, cf_member_img_width, cf_member_img_height FROM `{$test_config_table}` LIMIT 1", false);
|
||||||
|
if ((int) $config_row['cf_member_img_size'] !== 50000 || (int) $config_row['cf_member_img_width'] !== 60 || (int) $config_row['cf_member_img_height'] !== 60) {
|
||||||
|
g5_migration_test_fail('회원 이미지 설정 기본값을 보정하지 못했습니다.');
|
||||||
|
}
|
||||||
|
$content_row = sql_fetch("SELECT co_seo_title FROM `{$test_content_table}` WHERE co_id = 'company'", false);
|
||||||
|
if (!isset($content_row['co_seo_title']) || $content_row['co_seo_title'] === '') {
|
||||||
|
g5_migration_test_fail('콘텐츠 SEO 제목을 보정하지 못했습니다.');
|
||||||
|
}
|
||||||
|
$cart_row = sql_fetch("SELECT it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty FROM `{$test_cart_table}` WHERE it_id = 'item-1'", false);
|
||||||
|
if ((int) $cart_row['it_sc_type'] !== 2 || (int) $cart_row['it_sc_method'] !== 1 || (int) $cart_row['it_sc_price'] !== 3000 || (int) $cart_row['it_sc_minimum'] !== 50000 || (int) $cart_row['it_sc_qty'] !== 2) {
|
||||||
|
g5_migration_test_fail('장바구니 배송비 데이터를 보정하지 못했습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$migrations = g5_migration_discover();
|
||||||
|
$migration_ids = array();
|
||||||
|
$dependency_records = array();
|
||||||
|
foreach ($migrations as $migration) {
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
g5_migration_test_fail($migration['error']);
|
||||||
|
}
|
||||||
|
$migration_ids[] = $migration['id'];
|
||||||
|
$dependency_records[$migration['id']] = array('status' => 'success', 'checksum' => $migration['checksum']);
|
||||||
|
}
|
||||||
|
$sorted_ids = $migration_ids;
|
||||||
|
sort($sorted_ids, SORT_STRING);
|
||||||
|
if ($migration_ids !== $sorted_ids) {
|
||||||
|
g5_migration_test_fail('전체 마이그레이션이 오래된 순서로 정렬되지 않았습니다.');
|
||||||
|
}
|
||||||
|
$last_migration = $migrations[count($migrations) - 1];
|
||||||
|
unset($dependency_records[$migrations[0]['id']]);
|
||||||
|
if (g5_migration_validate_target_dependencies($migrations, $dependency_records, $last_migration['id']) === '') {
|
||||||
|
g5_migration_test_fail('누락된 선행 마이그레이션을 차단하지 못했습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "실행 순서·선행 조건·부분 적용 스키마·기존 데이터 보정 검사가 통과했습니다.\n";
|
||||||
Executable
+123
@@ -0,0 +1,123 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
if (PHP_SAPI !== 'cli') exit("CLI에서만 실행할 수 있습니다.\n");
|
||||||
|
|
||||||
|
$root = dirname(dirname(__FILE__));
|
||||||
|
$install_files = array($root.'/install/gnuboard5.sql', $root.'/install/gnuboard5shop.sql', $root.'/adm/sql_write.sql');
|
||||||
|
$migration_files = glob($root.'/migrations/*.sql');
|
||||||
|
$install_sql = '';
|
||||||
|
foreach ($install_files as $install_file) {
|
||||||
|
$contents = @file_get_contents($install_file);
|
||||||
|
if ($contents === false) {
|
||||||
|
fwrite(STDERR, '신규 설치 SQL을 읽을 수 없습니다: '.basename($install_file)."\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$install_sql .= "\n".$contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_map = array(
|
||||||
|
'{{auth_table}}'=>'g5_auth', '{{board_file_table}}'=>'g5_board_file', '{{config_table}}'=>'g5_config',
|
||||||
|
'{{content_table}}'=>'g5_content', '{{login_table}}'=>'g5_login', '{{member_table}}'=>'g5_member',
|
||||||
|
'{{member_auto_login_table}}'=>'g5_member_auto_login', '{{memo_table}}'=>'g5_memo',
|
||||||
|
'{{qa_config_table}}'=>'g5_qa_config', '{{social_profile_table}}'=>'g5_member_social_profiles',
|
||||||
|
'{{visit_table}}'=>'g5_visit', '{{write_table}}'=>'__TABLE_NAME__',
|
||||||
|
'{{g5_shop_cart_table}}'=>'g5_shop_cart', '{{g5_shop_coupon_log_table}}'=>'g5_shop_coupon_log',
|
||||||
|
'{{g5_shop_coupon_table}}'=>'g5_shop_coupon', '{{g5_shop_coupon_zone_table}}'=>'g5_shop_coupon_zone',
|
||||||
|
'{{g5_shop_default_table}}'=>'g5_shop_default', '{{g5_shop_inicis_log_table}}'=>'g5_shop_inicis_log',
|
||||||
|
'{{g5_shop_inicis_pay_event_table}}'=>'g5_shop_inicis_pay_event',
|
||||||
|
'{{g5_shop_inicis_pay_table}}'=>'g5_shop_inicis_pay',
|
||||||
|
'{{g5_shop_order_cancel_log_table}}'=>'g5_shop_order_cancel_log',
|
||||||
|
'{{g5_shop_order_data_table}}'=>'g5_shop_order_data', '{{g5_shop_order_table}}'=>'g5_shop_order',
|
||||||
|
'{{g5_shop_post_log_table}}'=>'g5_shop_order_post_log'
|
||||||
|
);
|
||||||
|
|
||||||
|
$install_tables = array();
|
||||||
|
if (preg_match_all('/CREATE\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?\s+`([^`]+)`\s*\((.*?)\)\s*ENGINE/is', $install_sql, $matches, PREG_SET_ORDER)) {
|
||||||
|
foreach ($matches as $match) $install_tables[$match[1]] = $match[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_schema_normalize_definition($definition)
|
||||||
|
{
|
||||||
|
$definition = preg_replace('/\s+AFTER\s+`?[a-zA-Z0-9_]+`?\s*$/i', '', trim($definition));
|
||||||
|
$definition = preg_replace('/\s+FIRST\s*$/i', '', $definition);
|
||||||
|
$definition = str_replace('`', '', strtolower($definition));
|
||||||
|
return preg_replace('/\s+/', ' ', $definition);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_schema_check_objects($file, $table, $sql, $install_tables, &$errors, &$latest_definitions)
|
||||||
|
{
|
||||||
|
if (!isset($install_tables[$table])) {
|
||||||
|
$errors[] = $file.': 신규 설치 SQL에 `'.$table.'` 테이블이 없습니다.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$body = $install_tables[$table];
|
||||||
|
if (preg_match_all('/\bADD(?:\s+COLUMN)?\s+`([a-zA-Z0-9_]+)`/i', $sql, $columns)) {
|
||||||
|
foreach ($columns[1] as $column) {
|
||||||
|
if (!preg_match('/`'.preg_quote($column, '/').'`\s+[a-z]/i', $body))
|
||||||
|
$errors[] = $file.': `'.$table.'`.`'.$column.'` 컬럼이 신규 설치 SQL에 없습니다.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match_all('/(?:ADD(?:\s+COLUMN)?|MODIFY(?:\s+COLUMN)?|CHANGE(?:\s+COLUMN)?\s+`[a-zA-Z0-9_]+`)\s+`([a-zA-Z0-9_]+)`\s+(.*?)(?=,\s*(?:ADD|MODIFY|CHANGE|DROP|PRIMARY|UNIQUE|KEY|INDEX)\b|$)/is', $sql, $definitions, PREG_SET_ORDER)) {
|
||||||
|
foreach ($definitions as $definition) {
|
||||||
|
$latest_definitions[$table][$definition[1]] = g5_schema_normalize_definition($definition[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match_all('/\bADD\s+(?:UNIQUE\s+)?(?:KEY|INDEX)\s+`([^`]+)`/i', $sql, $indexes)) {
|
||||||
|
foreach ($indexes[1] as $index) {
|
||||||
|
if (!preg_match('/(?:UNIQUE\s+)?KEY\s+`'.preg_quote($index, '/').'`/i', $body))
|
||||||
|
$errors[] = $file.': `'.$table.'`.`'.$index.'` 인덱스가 신규 설치 SQL에 없습니다.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$errors = array();
|
||||||
|
$latest_definitions = array();
|
||||||
|
foreach ((array) $migration_files as $migration_file) {
|
||||||
|
$sql = @file_get_contents($migration_file);
|
||||||
|
if ($sql === false) {
|
||||||
|
$errors[] = basename($migration_file).': 파일을 읽을 수 없습니다.';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match_all('/ALTER\s+TABLE\s+`(\{\{[a-zA-Z0-9_]+\}\})`\s+(.*?);/is', $sql, $alters, PREG_SET_ORDER)) {
|
||||||
|
foreach ($alters as $alter) {
|
||||||
|
if (!isset($table_map[$alter[1]])) {
|
||||||
|
$errors[] = basename($migration_file).': 검사할 수 없는 자리표시자입니다: '.$alter[1];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g5_schema_check_objects(basename($migration_file), $table_map[$alter[1]], $alter[2], $install_tables, $errors, $latest_definitions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match_all('/CREATE\s+TABLE\s+`(\{\{[a-zA-Z0-9_]+\}\})`\s*\((.*?)\)\s*ENGINE/is', $sql, $creates, PREG_SET_ORDER)) {
|
||||||
|
foreach ($creates as $create) {
|
||||||
|
if (!isset($table_map[$create[1]]) || !isset($install_tables[$table_map[$create[1]]])) {
|
||||||
|
$errors[] = basename($migration_file).': 신규 설치 SQL에서 생성 대상 테이블을 찾을 수 없습니다: '.$create[1];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$table = $table_map[$create[1]];
|
||||||
|
if (preg_match_all('/`([a-zA-Z0-9_]+)`\s+[a-z]/i', $create[2], $columns)) {
|
||||||
|
foreach ($columns[1] as $column) {
|
||||||
|
if (!preg_match('/`'.preg_quote($column, '/').'`\s+[a-z]/i', $install_tables[$table]))
|
||||||
|
$errors[] = basename($migration_file).': `'.$table.'`.`'.$column.'` 컬럼이 신규 설치 SQL에 없습니다.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($latest_definitions as $table => $columns) {
|
||||||
|
foreach ($columns as $column => $definition) {
|
||||||
|
if (!preg_match('/^\s*`'.preg_quote($column, '/').'`\s+(.+?),?\s*$/mi', $install_tables[$table], $match)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$install_definition = g5_schema_normalize_definition($match[1]);
|
||||||
|
if ($definition !== $install_definition) {
|
||||||
|
$errors[] = '`'.$table.'`.`'.$column.'` 최종 정의가 신규 설치 SQL과 다릅니다: '.$definition.' != '.$install_definition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($errors) {
|
||||||
|
foreach ($errors as $error) fwrite(STDERR, '[실패] '.$error."\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
echo "마이그레이션의 테이블·컬럼·인덱스와 최종 컬럼 정의가 신규 설치 SQL과 일치합니다.\n";
|
||||||
Executable
+69
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
if (PHP_SAPI !== 'cli') {
|
||||||
|
exit("CLI에서만 실행할 수 있습니다.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$root = dirname(dirname(__FILE__));
|
||||||
|
$scan_paths = array('');
|
||||||
|
$excluded = array(
|
||||||
|
'lib/migration.lib.php',
|
||||||
|
'lib/PHPExcel/',
|
||||||
|
'data/',
|
||||||
|
'install/',
|
||||||
|
'migrations/',
|
||||||
|
'bin/check-migration-runner.php'
|
||||||
|
);
|
||||||
|
$lifecycle_ddl_files = array(
|
||||||
|
'adm/board_delete.inc.php'
|
||||||
|
);
|
||||||
|
$errors = array();
|
||||||
|
|
||||||
|
foreach ($scan_paths as $scan_path) {
|
||||||
|
$base = $root . '/' . $scan_path;
|
||||||
|
if (!is_dir($base)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($base));
|
||||||
|
foreach ($iterator as $file) {
|
||||||
|
$pathname = $file->getPathname();
|
||||||
|
if (!$file->isFile() || strtolower(pathinfo($pathname, PATHINFO_EXTENSION)) !== 'php') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$relative = str_replace($root . '/', '', str_replace('\\', '/', $pathname));
|
||||||
|
$skip = false;
|
||||||
|
foreach ($excluded as $exclude) {
|
||||||
|
if ($relative === $exclude || strpos($relative, $exclude) === 0) {
|
||||||
|
$skip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($skip) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($relative, $lifecycle_ddl_files)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents = file_get_contents($pathname);
|
||||||
|
$contents = preg_replace('/^.*\$schema_create.*$/m', '', $contents);
|
||||||
|
if (preg_match_all('/\b(?:ALTER\s+TABLE|CREATE\s+TABLE|DROP\s+TABLE|RENAME\s+(?:TABLE|TO)|TRUNCATE\s+TABLE)\b/i', $contents, $matches, PREG_OFFSET_CAPTURE)) {
|
||||||
|
foreach ($matches[0] as $match) {
|
||||||
|
$line = substr_count(substr($contents, 0, $match[1]), "\n") + 1;
|
||||||
|
$errors[] = $relative . ':' . $line . ': ' . preg_replace('/\s+/', ' ', trim($match[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($errors) {
|
||||||
|
foreach ($errors as $error) {
|
||||||
|
fwrite(STDERR, '[실패] ' . $error . "\n");
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "일반 실행 경로에 DDL 문이 없습니다.\n";
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
if (PHP_SAPI !== 'cli') {
|
||||||
|
exit("CLI에서만 실행할 수 있습니다.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$root = dirname(dirname(__FILE__));
|
||||||
|
chdir($root);
|
||||||
|
|
||||||
|
define('G5_IS_CLI', true);
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = $root . '/index.php';
|
||||||
|
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||||
|
$_SERVER['REQUEST_URI'] = '/';
|
||||||
|
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||||
|
$_SERVER['SERVER_PORT'] = 80;
|
||||||
|
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'CLI';
|
||||||
|
|
||||||
|
require_once $root . '/common.php';
|
||||||
|
require_once G5_LIB_PATH . '/migration.lib.php';
|
||||||
|
|
||||||
|
$command = isset($argv[1]) ? $argv[1] : 'status';
|
||||||
|
|
||||||
|
if ($command === 'status') {
|
||||||
|
$statuses = g5_migration_status();
|
||||||
|
foreach ($statuses as $status) {
|
||||||
|
if (isset($status['error'])) {
|
||||||
|
fwrite(STDERR, '[오류] ' . $status['error'] . "\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$label = g5_migration_status_label($status['status'], $status['checksum_changed']);
|
||||||
|
echo '[' . $label . '] ' . $status['id'] . ' ' . $status['description'] . "\n";
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($command !== 'migrate') {
|
||||||
|
fwrite(STDERR, "사용법: php bin/db-migrate.php status | migrate [마이그레이션_ID]\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$target_id = isset($argv[2]) && $argv[2] !== '--all' ? $argv[2] : '';
|
||||||
|
$result = g5_migration_run($target_id);
|
||||||
|
if (!$result['success']) {
|
||||||
|
foreach ($result['errors'] as $error) {
|
||||||
|
fwrite(STDERR, '[실패] ' . $error . "\n");
|
||||||
|
}
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '적용: ' . $result['applied'] . ', 기존 스키마 확인: ' . $result['skipped'] . "\n";
|
||||||
+3
-1
@@ -831,7 +831,9 @@ if (G5_IS_MOBILE) {
|
|||||||
|
|
||||||
|
|
||||||
// 방문자수의 접속을 남김
|
// 방문자수의 접속을 남김
|
||||||
include_once(G5_BBS_PATH.'/visit_insert.inc.php');
|
if (!defined('G5_IS_CLI') || !G5_IS_CLI) {
|
||||||
|
include_once(G5_BBS_PATH.'/visit_insert.inc.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 일정 기간이 지난 DB 데이터 삭제 및 최적화
|
// 일정 기간이 지난 DB 데이터 삭제 및 최적화
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# 과거 데이터베이스 패치 조사
|
||||||
|
|
||||||
|
일반 실행 경로에서 제거한 DDL과 전체 Git 이력을 대조했다. 최초 공개 스키마에 이미 포함된 2012~2013년 관리 화면 보정 코드는 기준선으로 분류하고, 별도 업그레이드 진입점에 추가된 2014년 이후 변경은 도입 커밋과 날짜별 마이그레이션으로 옮겼다.
|
||||||
|
|
||||||
|
| 도입일 | 원본 커밋 | 마이그레이션 | 주요 변경 |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 2014-03-31 | `3889e0235` | `20140331_001_shop_cart_shipping` | 장바구니 배송비 필드 |
|
||||||
|
| 2014-11-05 | `de2b73436` | `20141105_001_shop_cart_select_time` | 장바구니 선택 시각 |
|
||||||
|
| 2015-03-06 | `344b1983a` | `20150306_001_shop_cart_indexes` | 장바구니 조회 인덱스 |
|
||||||
|
| 2015-05-29 | `a7cfae126` | `20150529_001_inicis_mobile_tables` | 모바일 이니시스·주문 임시 테이블 |
|
||||||
|
| 2015-09-08 | `6495aa007` | `20150908_001_inicis_auth_number` | 이니시스 승인번호 |
|
||||||
|
| 2016-04-22 | `4c9ac8b6b` | `20160422_001_shop_test_order` | 테스트 주문 구분 |
|
||||||
|
| 2016-04-27 | `f1cd96dc3` | `20160427_001_shop_order_data_cart` | 미완료 주문 장바구니 정보 |
|
||||||
|
| 2016-09-09 | `6e1aa4ac0` | `20160909_001_shop_coupon_zone` | 쿠폰존 |
|
||||||
|
| 2017-09-21 | `db7e07da2` | `20170921_001_inicis_notification_data` | 이니시스 통지 원문 |
|
||||||
|
| 2018-03-30 | `f7ac06d7d` | `20180330_001_social_login` | 소셜 로그인 설정·프로필 |
|
||||||
|
| 2019-12-02 | `22aad37bf` | `20191202_001`, `20191202_002` | 5.4 SEO·메모·첨부 스키마 |
|
||||||
|
| 2019-12-23 | `54dc82a5d`, `ffc43056b` | `20191223_001_gnuboard_5413_schema` | 주문 로그·스크랩·짧은 URL |
|
||||||
|
| 2023-09-09 | `28bfcea9c` | `20230909_001_auth_menu_length` | 관리 메뉴 ID 길이 |
|
||||||
|
| 2024-04-02 | `1e72d7e81` | `20240402_001_primary_keys` | 단일 행 테이블 등의 기본키 |
|
||||||
|
| 2025-08-19 | `cb1fadba4` | `20250819_001_sms_table_prefix` | SMS5 테이블 접두어 |
|
||||||
|
| 2025-09-04 | `66f6a75a1`, `7e8eff539` | `20250904_001_marketing_consent` | 제거되지 않고 유지된 마케팅 동의 필드 |
|
||||||
|
| 2026-03-25 | `5054e2463` | `20260325_001_coupon_use_unique` | 쿠폰 중복 사용 방지 인덱스 |
|
||||||
|
| 2026-04-16 | `4d5c59766` | `20260416_001_member_auto_login` | 자동 로그인 토큰 테이블 |
|
||||||
|
| 2026-06-25 | `0301c45f5` | `20260625_001_order_cancel_log` | 주문 취소·환불 이력 |
|
||||||
|
| 2026-07-23 | `acdbcfd8b` | `20260723_001_inicis_pro` | INIpay PRO 설정·결제 이력 |
|
||||||
|
| 2026-09-03 | `530140902` | `20260904_001_add_email_certify_minutes` | 메일 인증 유효시간 |
|
||||||
|
|
||||||
|
2012~2013년에 `config_form.php`, `board_form.php`, `member_form.php`, `qa_config.php` 등에서 수행하던 보정은 그누보드5 최초 배포 스키마를 형성하는 과정이었다. 이 항목들은 위 연속 패치보다 앞선 기준선이며 현재 `install/gnuboard5.sql`과 `install/gnuboard5shop.sql`에 포함된다. 제거 후 설치 스키마에서 누락된 필드는 별도로 대조해 보완했다.
|
||||||
|
|
||||||
|
팝빌 알림톡 테이블·설정과 게시판 알림 필드는 `7e8eff539`에서 기능과 함께 제거됐으므로 현재 목표 스키마에 다시 만들지 않는다. 반면 같은 도입 커밋의 마케팅 동의 필드는 유지돼 별도 마이그레이션으로 남겼다. 데이터 삭제가 필요한 쿠폰 중복 정리는 자동 수행하지 않으며, 중복이 있으면 고유 인덱스 생성 실패를 그대로 보고해 운영자가 데이터를 검토하도록 한다.
|
||||||
|
|
||||||
|
초기 이전 작업에서 확인된 복합 `ALTER TABLE`의 부분 적용 가능성과 누락된 데이터 보정은 `20260904_002_reconcile_partial_schema`, `20260904_003_backfill_legacy_data`에서 보완한다. 두 마이그레이션은 누락 컬럼과 인덱스를 개별 검사하고, 장바구니 배송비·회원 이미지 기본값·콘텐츠 SEO 데이터를 보정하며 SEO 컬럼 길이를 신규 설치 정의와 일치시킨다.
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# 데이터베이스 마이그레이션
|
||||||
|
|
||||||
|
데이터베이스 스키마 변경은 설정·목록·상세 화면이나 공통 라이브러리의 일반 실행 경로에서 수행하지 않는다. 신규 설치의 최종 스키마는 `install/gnuboard5.sql`에 반영하고, 기존 설치 변경은 `migrations` 디렉터리의 버전형 SQL 파일로 관리한다.
|
||||||
|
|
||||||
|
## 파일 규칙
|
||||||
|
|
||||||
|
- 파일명은 `YYYYMMDD_NNN_설명.sql` 형식을 사용한다.
|
||||||
|
- 파일명은 한 번 배포한 뒤 변경하거나 재사용하지 않는다.
|
||||||
|
- `-- @description`에 관리자에게 표시할 설명을 작성한다.
|
||||||
|
- 각 SQL 문 바로 앞에 `-- @if-table-missing`, `-- @if-table-exists`, `-- @if-column-missing`, `-- @if-index-missing` 조건을 둘 수 있다. 조건이 여러 개면 모두 만족할 때만 실행한다.
|
||||||
|
- 게시판별 글 테이블은 `-- @foreach-write-table-if-column-missing column_name`과 `{{write_table}}`을 사용한다.
|
||||||
|
- SQL에는 실제 접두어 대신 실행기가 지원하는 테이블 자리표시자를 사용한다.
|
||||||
|
- 한 파일은 가능한 한 하나의 목적만 포함한다.
|
||||||
|
|
||||||
|
자리표시자는 `$g5`에 등록된 `*_table` 키를 `{{config_table}}` 형식으로 사용한다. 실행기가 실제 테이블명으로 치환하며, 치환되지 않은 자리표시자는 오류로 처리한다.
|
||||||
|
|
||||||
|
## 실행 방법
|
||||||
|
|
||||||
|
CLI를 권장한다.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php bin/db-migrate.php status
|
||||||
|
php bin/db-migrate.php migrate
|
||||||
|
php bin/db-migrate.php migrate 20260416_001_member_auto_login
|
||||||
|
php bin/check-migration-schema.php
|
||||||
|
php bin/check-migration-runner.php
|
||||||
|
php bin/check-runtime-ddl.php
|
||||||
|
```
|
||||||
|
|
||||||
|
웹에서는 최고관리자가 **환경설정 → DB업그레이드**에서 전체 또는 특정 마이그레이션을 명시적으로 실행할 수 있다. 성공한 마이그레이션의 개별 실행 버튼은 비활성화되며, 전체 실행에서도 성공 이력과 체크섬이 일치하는 항목은 건너뛴다. 화면 조회만으로는 DDL이 실행되지 않는다.
|
||||||
|
|
||||||
|
전체 실행은 파일명 오름차순, 즉 오래된 마이그레이션부터 처리하며 하나가 실패하면 이후 실행을 중단한다. 개별 실행도 대상보다 앞선 모든 마이그레이션의 성공 이력과 체크섬이 유효해야 한다. 선행 항목이 누락·실패·변경된 경우 대상만 건너뛰기 성공으로 기록하지 않고 오류로 차단한다.
|
||||||
|
|
||||||
|
실행기는 `g5_migrations` 테이블에 마이그레이션 ID, 체크섬, 상태, 오류, 실행시간과 적용시각을 기록한다. 프로세스 간 잠금을 사용해 동시 실행을 막고, 실패하면 이후 마이그레이션을 중단한다. 적용이 끝난 파일의 체크섬이 바뀌면 오류로 처리한다.
|
||||||
|
|
||||||
|
현재 마이그레이션은 공통 실행 취소를 제공하지 않는다. 컬럼·테이블 삭제에 따른 데이터 손실과 후속 마이그레이션 의존성을 자동으로 안전하게 해결할 수 없기 때문이다. `g5_migrations`의 성공 이력만 삭제하는 것도 실제 스키마를 되돌리지 않으므로 취소로 취급하지 않는다. 롤백이 필요하면 데이터베이스 백업을 복원하거나, 해당 변경에 맞춘 별도 복구 절차를 검토한다.
|
||||||
|
|
||||||
|
`check-migration-schema.php`는 마이그레이션의 테이블·컬럼·인덱스가 신규 설치 SQL에 포함되는지와 최종 컬럼 정의가 일치하는지 검사한다. `check-migration-runner.php`는 격리된 임시 테이블로 부분 적용 스키마, 쇼핑몰 미설치 건너뛰기, 기존 데이터 보정을 검사한다. 마이그레이션을 추가하거나 설치 SQL을 변경한 뒤 두 검사를 반드시 실행한다.
|
||||||
|
|
||||||
|
`check-runtime-ddl.php`는 관리자·게시판·라이브러리·쇼핑몰 등 일반 실행 경로에 DDL 문이 다시 추가되지 않았는지 검사한다. 테이블이나 컬럼 변경은 이 검사를 우회하지 말고 버전형 마이그레이션으로 작성한다.
|
||||||
|
|
||||||
|
게시판 삭제 시 게시판별 테이블을 함께 삭제하는 것처럼 사용자가 명시적으로 요청한 데이터 생명주기 작업은 마이그레이션과 구분해 제한된 허용 목록으로 관리한다. 일반 레코드 생성 과정에서 `AUTO_INCREMENT`를 초기화하는 DDL은 허용하지 않는다.
|
||||||
|
|
||||||
|
## 권한과 배포
|
||||||
|
|
||||||
|
운영 환경에서는 웹 런타임 DB 계정에서 DDL 권한을 제거하고, 배포 단계에서 별도의 권한을 가진 계정으로 CLI 마이그레이션을 실행하는 구성을 권장한다. 웹 실행 기능을 사용하는 환경은 실행 시에만 필요한 DDL 권한이 있어야 한다.
|
||||||
|
|
||||||
|
배포 전에는 백업과 테이블 크기, 예상 잠금 시간을 확인한다. MySQL 계열 DB의 DDL은 트랜잭션으로 완전히 되돌릴 수 없으므로 실패한 마이그레이션의 오류를 확인하고 수동 복구 후 재실행한다.
|
||||||
|
|
||||||
|
## 기존 업그레이드 코드
|
||||||
|
|
||||||
|
과거 설치본을 화면 접근 시점에 보정하던 누적 DDL은 일반 실행 파일에서 제거했다. `orderupgrade.php`와 `adm/dbupgrade.php`에 누적됐던 배포 후 변경은 실제 도입 시점별 마이그레이션으로 이전했다. 조사 근거와 대응 목록은 `database-migration-history.md`에 기록한다.
|
||||||
@@ -80,5 +80,4 @@ add_replace('get_pretty_url', 'add_pretty_shop_url', 10, 5);
|
|||||||
add_replace('false_short_url_clean', 'shop_short_url_clean', 10, 4);
|
add_replace('false_short_url_clean', 'shop_short_url_clean', 10, 4);
|
||||||
add_replace('add_nginx_conf_rules', 'add_shop_nginx_conf_rules', 10, 3);
|
add_replace('add_nginx_conf_rules', 'add_shop_nginx_conf_rules', 10, 3);
|
||||||
add_replace('add_mod_rewrite_rules', 'add_shop_mod_rewrite_rules', 10, 3);
|
add_replace('add_mod_rewrite_rules', 'add_shop_mod_rewrite_rules', 10, 3);
|
||||||
add_replace('admin_dbupgrade', 'add_shop_admin_dbupgrade', 10, 3);
|
|
||||||
add_replace('exist_check_seo_title', 'shop_exist_check_seo_title', 10, 4);
|
add_replace('exist_check_seo_title', 'shop_exist_check_seo_title', 10, 4);
|
||||||
@@ -223,6 +223,8 @@ CREATE TABLE IF NOT EXISTS `g5_config` (
|
|||||||
`cf_intercept_ip` text NOT NULL,
|
`cf_intercept_ip` text NOT NULL,
|
||||||
`cf_analytics` text NOT NULL,
|
`cf_analytics` text NOT NULL,
|
||||||
`cf_add_meta` text NOT NULL,
|
`cf_add_meta` text NOT NULL,
|
||||||
|
`cf_syndi_token` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cf_syndi_except` text NOT NULL,
|
||||||
`cf_member_skin` varchar(50) NOT NULL DEFAULT '',
|
`cf_member_skin` varchar(50) NOT NULL DEFAULT '',
|
||||||
`cf_use_homepage` tinyint(4) NOT NULL DEFAULT '0',
|
`cf_use_homepage` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`cf_req_homepage` tinyint(4) NOT NULL DEFAULT '0',
|
`cf_req_homepage` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
@@ -989,3 +991,21 @@ CREATE TABLE IF NOT EXISTS `g5_menu` (
|
|||||||
`me_mobile_use` tinyint(4) NOT NULL DEFAULT '0',
|
`me_mobile_use` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`me_id`)
|
PRIMARY KEY (`me_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `g5_migrations`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `g5_migrations`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `g5_migrations` (
|
||||||
|
`migration_id` varchar(100) NOT NULL,
|
||||||
|
`description` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`checksum` char(64) NOT NULL DEFAULT '',
|
||||||
|
`status` varchar(20) NOT NULL DEFAULT 'pending',
|
||||||
|
`error_message` text NOT NULL,
|
||||||
|
`execution_ms` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`applied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`migration_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|||||||
@@ -585,6 +585,9 @@ CREATE TABLE IF NOT EXISTS `g5_shop_item_use` (
|
|||||||
`is_score` tinyint(4) NOT NULL DEFAULT '0',
|
`is_score` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`is_subject` varchar(255) NOT NULL DEFAULT '',
|
`is_subject` varchar(255) NOT NULL DEFAULT '',
|
||||||
`is_content` text NOT NULL,
|
`is_content` text NOT NULL,
|
||||||
|
`is_reply_subject` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`is_reply_content` text NOT NULL,
|
||||||
|
`is_reply_name` varchar(25) NOT NULL DEFAULT '',
|
||||||
`is_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`is_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`is_ip` varchar(25) NOT NULL DEFAULT '',
|
`is_ip` varchar(25) NOT NULL DEFAULT '',
|
||||||
`is_confirm` tinyint(4) NOT NULL DEFAULT '0',
|
`is_confirm` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
@@ -899,6 +902,59 @@ CREATE TABLE IF NOT EXISTS `g5_shop_inicis_log` (
|
|||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `g5_shop_order_cancel_log`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `g5_shop_order_cancel_log`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `g5_shop_order_cancel_log` (
|
||||||
|
`cl_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`od_id` bigint(20) unsigned NOT NULL,
|
||||||
|
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_pg` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`cl_pg_version` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`cl_settle_case` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cl_test` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`cl_source` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`cl_type` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`cl_status` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`cl_origin_tno` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_cancel_tno` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_pg_order_no` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cl_seq` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_pg_seq` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`cl_idempotency_key` char(32) NOT NULL DEFAULT '',
|
||||||
|
`cl_request_amount` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_approved_amount` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_remaining_amount` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_tax_mny` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_vat_mny` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_free_mny` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_refund_before` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_refund_after` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_result_code` varchar(50) NOT NULL DEFAULT '',
|
||||||
|
`cl_result_msg` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_reason` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_request_data` mediumtext NOT NULL,
|
||||||
|
`cl_response_data` mediumtext NOT NULL,
|
||||||
|
`cl_noti_data` mediumtext NOT NULL,
|
||||||
|
`cl_ip` varchar(45) NOT NULL DEFAULT '',
|
||||||
|
`cl_requested_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_approved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_local_applied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`cl_id`),
|
||||||
|
KEY `od_id` (`od_id`),
|
||||||
|
KEY `cl_pg` (`cl_pg`),
|
||||||
|
KEY `cl_pg_version` (`cl_pg_version`),
|
||||||
|
KEY `cl_status` (`cl_status`),
|
||||||
|
KEY `cl_idempotency_key` (`cl_idempotency_key`),
|
||||||
|
KEY `cl_origin_tno` (`cl_origin_tno`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `g5_shop_inicis_pay`
|
-- Table structure for table `g5_shop_inicis_pay`
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -662,6 +662,7 @@ if($g5_shop_install) {
|
|||||||
install_file_write($f, "\$g5['g5_shop_inicis_log_table'] = G5_SHOP_TABLE_PREFIX.'inicis_log'; // 이니시스 모바일 계좌이체 로그 테이블\n");
|
install_file_write($f, "\$g5['g5_shop_inicis_log_table'] = G5_SHOP_TABLE_PREFIX.'inicis_log'; // 이니시스 모바일 계좌이체 로그 테이블\n");
|
||||||
install_file_write($f, "\$g5['g5_shop_inicis_pay_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay'; // 이니시스 결제 처리 현황 테이블\n");
|
install_file_write($f, "\$g5['g5_shop_inicis_pay_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay'; // 이니시스 결제 처리 현황 테이블\n");
|
||||||
install_file_write($f, "\$g5['g5_shop_inicis_pay_event_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay_event'; // 이니시스 결제 처리 이력 테이블\n");
|
install_file_write($f, "\$g5['g5_shop_inicis_pay_event_table'] = G5_SHOP_TABLE_PREFIX.'inicis_pay_event'; // 이니시스 결제 처리 이력 테이블\n");
|
||||||
|
install_file_write($f, "\$g5['g5_shop_order_cancel_log_table'] = G5_SHOP_TABLE_PREFIX.'order_cancel_log'; // 주문 취소·환불 이력 테이블\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
install_file_write($f, "?>");
|
install_file_write($f, "?>");
|
||||||
|
|||||||
+1
-31
@@ -2720,7 +2720,7 @@ function get_email_certify_token()
|
|||||||
*/
|
*/
|
||||||
function is_valid_email_certify_token($token, $stored_token, $mb_datetime, $valid_minutes, $now = null)
|
function is_valid_email_certify_token($token, $stored_token, $mb_datetime, $valid_minutes, $now = null)
|
||||||
{
|
{
|
||||||
if (!$token || !$stored_token || !hash_equals((string) $stored_token, (string) $token)) {
|
if (!$token || !$stored_token || !slow_equals((string) $stored_token, (string) $token)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3663,21 +3663,6 @@ function insert_member_cert_history($mb_id, $name, $hp, $birth, $type)
|
|||||||
$g5['member_cert_history_table'] = G5_TABLE_PREFIX.'member_cert_history';
|
$g5['member_cert_history_table'] = G5_TABLE_PREFIX.'member_cert_history';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 멤버 본인인증 정보 변경 내역 테이블 없을 경우 생성
|
|
||||||
if(isset($g5['member_cert_history_table']) && !sql_query(" DESC {$g5['member_cert_history_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['member_cert_history_table']}` (
|
|
||||||
`ch_id` int(11) NOT NULL auto_increment,
|
|
||||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ch_name` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_hp` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_birth` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ch_type` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ch_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
||||||
PRIMARY KEY (`ch_id`),
|
|
||||||
KEY `mb_id` (`mb_id`)
|
|
||||||
) ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = " insert into {$g5['member_cert_history_table']}
|
$sql = " insert into {$g5['member_cert_history_table']}
|
||||||
set mb_id = '{$mb_id}',
|
set mb_id = '{$mb_id}',
|
||||||
ch_name = '{$name}',
|
ch_name = '{$name}',
|
||||||
@@ -4235,21 +4220,6 @@ function login_password_check($mb, $pass, $hash)
|
|||||||
if(!$mb_id)
|
if(!$mb_id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(G5_STRING_ENCRYPT_FUNCTION === 'create_hash' && (strlen($hash) === G5_MYSQL_PASSWORD_LENGTH || strlen($hash) === 16)) {
|
|
||||||
if( sql_password($pass) === $hash ){
|
|
||||||
|
|
||||||
if( ! isset($mb['mb_password2']) ){
|
|
||||||
$sql = "ALTER TABLE `{$g5['member_table']}` ADD `mb_password2` varchar(255) NOT NULL default '' AFTER `mb_password`";
|
|
||||||
sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$new_password = create_hash($pass);
|
|
||||||
$sql = " update {$g5['member_table']} set mb_password = '$new_password', mb_password2 = '$hash' where mb_id = '$mb_id' ";
|
|
||||||
sql_query($sql);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return check_password($pass, $hash);
|
return check_password($pass, $hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,528 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('_GNUBOARD_')) exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 버전형 DB 마이그레이션 파일을 읽고 실행한다.
|
||||||
|
*
|
||||||
|
* 마이그레이션 SQL은 G5_PATH/migrations 아래에 두며 파일명 순서대로 실행한다.
|
||||||
|
* 일반 웹 요청에서는 이 라이브러리를 불러와도 DDL을 실행하지 않는다.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function g5_migration_table_name()
|
||||||
|
{
|
||||||
|
return G5_TABLE_PREFIX . 'migrations';
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_path()
|
||||||
|
{
|
||||||
|
return G5_PATH . '/migrations';
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_replace_placeholders($sql)
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
$replacements = array();
|
||||||
|
foreach ($g5 as $key => $table) {
|
||||||
|
if (substr($key, -6) === '_table' && is_string($table) && $table !== '') {
|
||||||
|
$replacements['{{' . $key . '}}'] = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$shop_prefix = defined('G5_SHOP_TABLE_PREFIX') ? G5_SHOP_TABLE_PREFIX : G5_TABLE_PREFIX . 'shop_';
|
||||||
|
$fallbacks = array(
|
||||||
|
'member_auto_login_table' => G5_TABLE_PREFIX . 'member_auto_login',
|
||||||
|
'g5_shop_cart_table' => $shop_prefix . 'cart',
|
||||||
|
'g5_shop_item_table' => $shop_prefix . 'item',
|
||||||
|
'g5_shop_order_table' => $shop_prefix . 'order',
|
||||||
|
'g5_shop_default_table' => $shop_prefix . 'default',
|
||||||
|
'g5_shop_coupon_table' => $shop_prefix . 'coupon',
|
||||||
|
'g5_shop_coupon_log_table' => $shop_prefix . 'coupon_log',
|
||||||
|
'g5_shop_coupon_zone_table' => $shop_prefix . 'coupon_zone',
|
||||||
|
'g5_shop_inicis_log_table' => $shop_prefix . 'inicis_log',
|
||||||
|
'g5_shop_order_data_table' => $shop_prefix . 'order_data',
|
||||||
|
'g5_shop_post_log_table' => $shop_prefix . 'order_post_log',
|
||||||
|
'g5_shop_order_cancel_log_table' => $shop_prefix . 'order_cancel_log',
|
||||||
|
'g5_shop_inicis_pay_table' => $shop_prefix . 'inicis_pay',
|
||||||
|
'g5_shop_inicis_pay_event_table' => $shop_prefix . 'inicis_pay_event',
|
||||||
|
'sms5_config_table' => G5_TABLE_PREFIX . 'sms5_config',
|
||||||
|
'sms5_write_table' => G5_TABLE_PREFIX . 'sms5_write',
|
||||||
|
'sms5_history_table' => G5_TABLE_PREFIX . 'sms5_history',
|
||||||
|
'sms5_book_table' => G5_TABLE_PREFIX . 'sms5_book',
|
||||||
|
'sms5_book_group_table' => G5_TABLE_PREFIX . 'sms5_book_group',
|
||||||
|
'sms5_form_table' => G5_TABLE_PREFIX . 'sms5_form',
|
||||||
|
'sms5_form_group_table' => G5_TABLE_PREFIX . 'sms5_form_group'
|
||||||
|
);
|
||||||
|
foreach ($fallbacks as $key => $table) {
|
||||||
|
if (!isset($replacements['{{' . $key . '}}'])) {
|
||||||
|
$replacements['{{' . $key . '}}'] = $table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return strtr($sql, $replacements);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_parse_condition($directive, $file)
|
||||||
|
{
|
||||||
|
if (!preg_match('/^--\s*@(if|skip-if)-(table|column|index)-(exists|missing)\s+(\S+)(?:\s+(\S+))?\s*$/i', $directive, $matches)) {
|
||||||
|
return array('error' => '지원하지 않는 실행 조건입니다: ' . basename($file) . ' - ' . trim($directive));
|
||||||
|
}
|
||||||
|
|
||||||
|
$condition = array(
|
||||||
|
'object' => strtolower($matches[2]),
|
||||||
|
'state' => strtolower($matches[3]),
|
||||||
|
'table' => g5_migration_replace_placeholders(trim($matches[4], '`')),
|
||||||
|
'name' => isset($matches[5]) ? trim($matches[5], '`') : ''
|
||||||
|
);
|
||||||
|
if ($condition['object'] !== 'table' && $condition['name'] === '') {
|
||||||
|
return array('error' => '컬럼 또는 인덱스 이름이 없습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
if (strpos($condition['table'], '{{') !== false || strpos($condition['table'], '}}') !== false) {
|
||||||
|
return array('error' => '지원하지 않는 조건 테이블 자리표시자가 있습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_parse_file($file)
|
||||||
|
{
|
||||||
|
$contents = @file_get_contents($file);
|
||||||
|
if ($contents === false) {
|
||||||
|
return array('error' => '마이그레이션 파일을 읽을 수 없습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
$migration = array(
|
||||||
|
'id' => pathinfo($file, PATHINFO_FILENAME),
|
||||||
|
'description' => '',
|
||||||
|
'skip_table' => '',
|
||||||
|
'skip_column' => '',
|
||||||
|
'checksum' => hash('sha256', $contents),
|
||||||
|
'file' => $file,
|
||||||
|
'statements' => array()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!preg_match('/^[0-9]{8}_[0-9]{3}_[a-z0-9_]+$/', $migration['id'])) {
|
||||||
|
return array('error' => '마이그레이션 파일명이 규칙에 맞지 않습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^--\s*@description\s+(.+)$/mi', $contents, $matches)) {
|
||||||
|
$migration['description'] = trim($matches[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^--\s*@skip-if-column\s+(\S+)\s+(\S+)$/mi', $contents, $matches)) {
|
||||||
|
$migration['skip_table'] = g5_migration_replace_placeholders(trim($matches[1], '`'));
|
||||||
|
$migration['skip_column'] = trim($matches[2], '`');
|
||||||
|
}
|
||||||
|
|
||||||
|
$conditions = array();
|
||||||
|
$foreach_write_column = '';
|
||||||
|
$foreach_write_table = false;
|
||||||
|
$foreach_content_seo = false;
|
||||||
|
$buffer = '';
|
||||||
|
foreach (preg_split('/\r?\n/', $contents) as $line) {
|
||||||
|
if (preg_match('/^\s*--\s*@skip-if-column\s+/i', $line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^\s*--\s*@foreach-write-table-if-column-missing\s+(\S+)\s*$/i', $line, $matches)) {
|
||||||
|
$foreach_write_column = trim($matches[1], '`');
|
||||||
|
$foreach_write_table = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^\s*--\s*@foreach-write-table\s*$/i', $line)) {
|
||||||
|
$foreach_write_table = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^\s*--\s*@foreach-content-missing-seo\s*$/i', $line)) {
|
||||||
|
$foreach_content_seo = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^\s*--\s*@(if|skip-if)-/i', $line)) {
|
||||||
|
$parsed_condition = g5_migration_parse_condition(trim($line), $file);
|
||||||
|
if (isset($parsed_condition['error'])) {
|
||||||
|
return $parsed_condition;
|
||||||
|
}
|
||||||
|
$conditions[] = $parsed_condition;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^\s*--/', $line)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$buffer .= $line . "\n";
|
||||||
|
while (($position = strpos($buffer, ';')) !== false) {
|
||||||
|
$statement = trim(substr($buffer, 0, $position));
|
||||||
|
$buffer = substr($buffer, $position + 1);
|
||||||
|
if ($statement === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$foreach_write_table && !$foreach_content_seo) {
|
||||||
|
$statement = g5_migration_replace_placeholders($statement);
|
||||||
|
}
|
||||||
|
$allowed_dynamic_placeholder = strpos($statement, '{{write_table}}') !== false || ($foreach_content_seo && strpos($statement, '{{content_table}}') !== false);
|
||||||
|
if ((strpos($statement, '{{') !== false || strpos($statement, '}}') !== false) && !$allowed_dynamic_placeholder) {
|
||||||
|
return array('error' => '지원하지 않는 테이블 자리표시자가 있습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
$migration['statements'][] = array('sql' => $statement, 'conditions' => $conditions, 'foreach_write_column' => $foreach_write_column, 'foreach_write_table' => $foreach_write_table, 'foreach_content_seo' => $foreach_content_seo);
|
||||||
|
$conditions = array();
|
||||||
|
$foreach_write_column = '';
|
||||||
|
$foreach_write_table = false;
|
||||||
|
$foreach_content_seo = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (trim($buffer) !== '') {
|
||||||
|
return array('error' => 'SQL 문 끝에 세미콜론이 없습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$migration['statements']) {
|
||||||
|
return array('error' => '실행할 SQL이 없습니다: ' . basename($file));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $migration;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_discover()
|
||||||
|
{
|
||||||
|
$files = glob(g5_migration_path() . '/*.sql');
|
||||||
|
$migrations = array();
|
||||||
|
|
||||||
|
if (!$files) {
|
||||||
|
return $migrations;
|
||||||
|
}
|
||||||
|
|
||||||
|
sort($files, SORT_STRING);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$migration = g5_migration_parse_file($file);
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
return array($migration);
|
||||||
|
}
|
||||||
|
$migrations[] = $migration;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $migrations;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_table_exists($table)
|
||||||
|
{
|
||||||
|
$result = sql_query("SHOW TABLES LIKE '" . sql_real_escape_string($table) . "'", false);
|
||||||
|
if (!$result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($row = sql_fetch_array($result)) {
|
||||||
|
if (reset($row) === $table) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_column_exists($table, $column)
|
||||||
|
{
|
||||||
|
$result = sql_query("SHOW COLUMNS FROM `" . str_replace('`', '``', $table) . "` LIKE '" . sql_real_escape_string($column) . "'", false);
|
||||||
|
return $result && sql_num_rows($result) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_index_exists($table, $index)
|
||||||
|
{
|
||||||
|
if (!g5_migration_table_exists($table)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$result = sql_query("SHOW INDEX FROM `" . str_replace('`', '``', $table) . "` WHERE Key_name = '" . sql_real_escape_string($index) . "'", false);
|
||||||
|
return $result && sql_num_rows($result) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_should_run_statement($conditions)
|
||||||
|
{
|
||||||
|
if (!$conditions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
foreach ($conditions as $condition) {
|
||||||
|
if ($condition['object'] === 'table') {
|
||||||
|
$exists = g5_migration_table_exists($condition['table']);
|
||||||
|
} elseif ($condition['object'] === 'column') {
|
||||||
|
$exists = g5_migration_column_exists($condition['table'], $condition['name']);
|
||||||
|
} else {
|
||||||
|
$exists = g5_migration_index_exists($condition['table'], $condition['name']);
|
||||||
|
}
|
||||||
|
if (($condition['state'] === 'exists') !== $exists) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_execute_statement($statement)
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
if ($statement['foreach_content_seo']) {
|
||||||
|
if (!function_exists('exist_seo_title_recursive') || !function_exists('generate_seo_title')) {
|
||||||
|
return array('error' => 'SEO 제목 생성 함수를 사용할 수 없습니다.', 'executed' => false);
|
||||||
|
}
|
||||||
|
$result = sql_query("SELECT co_id, co_subject FROM `{$g5['content_table']}` WHERE co_seo_title = ''", false);
|
||||||
|
if (!$result) {
|
||||||
|
return array('error' => sql_error_info(), 'executed' => false);
|
||||||
|
}
|
||||||
|
$executed = false;
|
||||||
|
while ($content = sql_fetch_array($result)) {
|
||||||
|
$seo_title = exist_seo_title_recursive('content', generate_seo_title($content['co_subject']), $g5['content_table'], $content['co_id']);
|
||||||
|
$sql = str_replace(
|
||||||
|
array('{{content_table}}', '{{content_id}}', '{{seo_title}}'),
|
||||||
|
array($g5['content_table'], sql_real_escape_string($content['co_id']), sql_real_escape_string($seo_title)),
|
||||||
|
$statement['sql']
|
||||||
|
);
|
||||||
|
if (!sql_query($sql, false)) {
|
||||||
|
return array('error' => $content['co_id'] . ': ' . sql_error_info(), 'executed' => $executed);
|
||||||
|
}
|
||||||
|
$executed = true;
|
||||||
|
}
|
||||||
|
return array('error' => '', 'executed' => $executed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$statement['foreach_write_table']) {
|
||||||
|
return array('error' => sql_query($statement['sql'], false) ? '' : sql_error_info(), 'executed' => true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = sql_query("SELECT bo_table FROM `{$g5['board_table']}`", false);
|
||||||
|
if (!$result) {
|
||||||
|
return array('error' => sql_error_info(), 'executed' => false);
|
||||||
|
}
|
||||||
|
$executed = false;
|
||||||
|
while ($board = sql_fetch_array($result)) {
|
||||||
|
$write_table = $g5['write_prefix'] . $board['bo_table'];
|
||||||
|
if (!g5_migration_table_exists($write_table) || ($statement['foreach_write_column'] !== '' && g5_migration_column_exists($write_table, $statement['foreach_write_column']))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$sql = str_replace('{{write_table}}', $write_table, $statement['sql']);
|
||||||
|
if (!sql_query($sql, false)) {
|
||||||
|
return array('error' => $write_table . ': ' . sql_error_info(), 'executed' => $executed);
|
||||||
|
}
|
||||||
|
$executed = true;
|
||||||
|
}
|
||||||
|
return array('error' => '', 'executed' => $executed);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_get_records()
|
||||||
|
{
|
||||||
|
$table = g5_migration_table_name();
|
||||||
|
$records = array();
|
||||||
|
|
||||||
|
if (!g5_migration_table_exists($table)) {
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = sql_query("SELECT migration_id, checksum, status, error_message, applied_at FROM `{$table}` ORDER BY migration_id", false);
|
||||||
|
if (!$result) {
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($row = sql_fetch_array($result)) {
|
||||||
|
$records[$row['migration_id']] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_status()
|
||||||
|
{
|
||||||
|
$migrations = g5_migration_discover();
|
||||||
|
$records = g5_migration_get_records();
|
||||||
|
$status = array();
|
||||||
|
|
||||||
|
foreach ($migrations as $migration) {
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
$status[] = $migration;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = isset($records[$migration['id']]) ? $records[$migration['id']] : null;
|
||||||
|
$migration['status'] = $record ? $record['status'] : 'pending';
|
||||||
|
$migration['checksum_changed'] = $record && $record['status'] === 'success' && $record['checksum'] !== $migration['checksum'];
|
||||||
|
$migration['error_message'] = $record ? $record['error_message'] : '';
|
||||||
|
$migration['applied_at'] = $record ? $record['applied_at'] : '';
|
||||||
|
$status[] = $migration;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_status_label($status, $checksum_changed = false)
|
||||||
|
{
|
||||||
|
if ($checksum_changed) {
|
||||||
|
return '적용 후 파일 변경됨';
|
||||||
|
}
|
||||||
|
|
||||||
|
$labels = array(
|
||||||
|
'pending' => '대기',
|
||||||
|
'success' => '성공',
|
||||||
|
'failed' => '실패'
|
||||||
|
);
|
||||||
|
|
||||||
|
return isset($labels[$status]) ? $labels[$status] : '알 수 없음';
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_validate_target_dependencies($migrations, $records, $target_id)
|
||||||
|
{
|
||||||
|
$target_index = -1;
|
||||||
|
foreach ($migrations as $index => $migration) {
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
return $migration['error'];
|
||||||
|
}
|
||||||
|
if ($migration['id'] === $target_id) {
|
||||||
|
$target_index = $index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target_index < 0) {
|
||||||
|
return '요청한 마이그레이션을 찾을 수 없습니다: ' . $target_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($index = 0; $index < $target_index; $index++) {
|
||||||
|
$migration = $migrations[$index];
|
||||||
|
$record = isset($records[$migration['id']]) ? $records[$migration['id']] : null;
|
||||||
|
if (!$record || $record['status'] !== 'success') {
|
||||||
|
return $target_id . ' 실행 전에 선행 마이그레이션을 먼저 실행해야 합니다: ' . $migration['id'];
|
||||||
|
}
|
||||||
|
if ($record['checksum'] !== $migration['checksum']) {
|
||||||
|
return '선행 마이그레이션 파일이 적용 후 변경되었습니다: ' . $migration['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_ensure_table()
|
||||||
|
{
|
||||||
|
$table = g5_migration_table_name();
|
||||||
|
$sql = "CREATE TABLE IF NOT EXISTS `{$table}` (
|
||||||
|
`migration_id` varchar(100) NOT NULL,
|
||||||
|
`description` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`checksum` char(64) NOT NULL DEFAULT '',
|
||||||
|
`status` varchar(20) NOT NULL DEFAULT 'pending',
|
||||||
|
`error_message` text NOT NULL,
|
||||||
|
`execution_ms` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`applied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`migration_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8";
|
||||||
|
|
||||||
|
return (bool) sql_query($sql, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_save_record($migration, $status, $error_message, $execution_ms)
|
||||||
|
{
|
||||||
|
$table = g5_migration_table_name();
|
||||||
|
$id = sql_real_escape_string($migration['id']);
|
||||||
|
$description = sql_real_escape_string($migration['description']);
|
||||||
|
$checksum = sql_real_escape_string($migration['checksum']);
|
||||||
|
$status = sql_real_escape_string($status);
|
||||||
|
$error_message = sql_real_escape_string($error_message);
|
||||||
|
$execution_ms = (int) $execution_ms;
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `{$table}`
|
||||||
|
SET migration_id = '{$id}', description = '{$description}', checksum = '{$checksum}',
|
||||||
|
status = '{$status}', error_message = '{$error_message}', execution_ms = '{$execution_ms}',
|
||||||
|
applied_at = '" . G5_TIME_YMDHIS . "'
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
description = VALUES(description), checksum = VALUES(checksum), status = VALUES(status),
|
||||||
|
error_message = VALUES(error_message), execution_ms = VALUES(execution_ms), applied_at = VALUES(applied_at)";
|
||||||
|
|
||||||
|
return (bool) sql_query($sql, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function g5_migration_run($target_id = '')
|
||||||
|
{
|
||||||
|
$result = array('success' => false, 'applied' => 0, 'skipped' => 0, 'errors' => array());
|
||||||
|
|
||||||
|
if (!g5_migration_ensure_table()) {
|
||||||
|
$result['errors'][] = '마이그레이션 이력 테이블을 생성하지 못했습니다: ' . sql_error_info();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lock_name = 'g5_migration_' . substr(md5(G5_TABLE_PREFIX), 0, 16);
|
||||||
|
$lock = sql_fetch("SELECT GET_LOCK('{$lock_name}', 10) AS acquired", false);
|
||||||
|
if (!$lock || (int) $lock['acquired'] !== 1) {
|
||||||
|
$result['errors'][] = '다른 DB 업그레이드가 실행 중이거나 실행 잠금을 얻지 못했습니다.';
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$migrations = g5_migration_discover();
|
||||||
|
$records = g5_migration_get_records();
|
||||||
|
$target_found = $target_id === '';
|
||||||
|
|
||||||
|
if ($target_id !== '') {
|
||||||
|
$dependency_error = g5_migration_validate_target_dependencies($migrations, $records, $target_id);
|
||||||
|
if ($dependency_error !== '') {
|
||||||
|
$result['errors'][] = $dependency_error;
|
||||||
|
sql_query("SELECT RELEASE_LOCK('{$lock_name}')", false);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($migrations as $migration) {
|
||||||
|
if (isset($migration['error'])) {
|
||||||
|
$result['errors'][] = $migration['error'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target_id !== '' && $migration['id'] !== $target_id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$target_found = true;
|
||||||
|
|
||||||
|
$record = isset($records[$migration['id']]) ? $records[$migration['id']] : null;
|
||||||
|
if ($record && $record['status'] === 'success') {
|
||||||
|
if ($record['checksum'] !== $migration['checksum']) {
|
||||||
|
$result['errors'][] = $migration['id'] . ' 파일이 적용 후 변경되었습니다.';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$started_at = get_microtime();
|
||||||
|
$skip = $migration['skip_table'] && $migration['skip_column'] && g5_migration_column_exists($migration['skip_table'], $migration['skip_column']);
|
||||||
|
$migration_error = '';
|
||||||
|
$executed = false;
|
||||||
|
|
||||||
|
if (!$skip) {
|
||||||
|
foreach ($migration['statements'] as $statement) {
|
||||||
|
if (!g5_migration_should_run_statement($statement['conditions'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$statement_result = g5_migration_execute_statement($statement);
|
||||||
|
$executed = $executed || $statement_result['executed'];
|
||||||
|
if ($statement_result['error'] !== '') {
|
||||||
|
$migration_error = $statement_result['error'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$execution_ms = (int) round((get_microtime() - $started_at) * 1000);
|
||||||
|
if ($migration_error !== '') {
|
||||||
|
g5_migration_save_record($migration, 'failed', $migration_error, $execution_ms);
|
||||||
|
$result['errors'][] = $migration['id'] . ': ' . $migration_error;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g5_migration_save_record($migration, 'success', '', $execution_ms)) {
|
||||||
|
$result['errors'][] = $migration['id'] . ' 실행 이력을 저장하지 못했습니다: ' . sql_error_info();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($skip || !$executed) {
|
||||||
|
$result['skipped']++;
|
||||||
|
} else {
|
||||||
|
$result['applied']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!$target_found) {
|
||||||
|
$result['errors'][] = '요청한 마이그레이션을 찾을 수 없습니다: ' . $target_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_query("SELECT RELEASE_LOCK('{$lock_name}')", false);
|
||||||
|
$result['success'] = !$result['errors'];
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
@@ -2814,18 +2814,6 @@ function add_order_post_log($msg='', $code='error'){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $code === 'error' ) {
|
|
||||||
$result = sql_query("describe `{$g5['g5_shop_post_log_table']}`");
|
|
||||||
while ($row = sql_fetch_array($result)){
|
|
||||||
if( $row['Field'] === 'ol_msg' && $row['Type'] === 'varchar(255)' ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` MODIFY ol_msg TEXT NOT NULL;", false);
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` DROP PRIMARY KEY;", false);
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_post_log_table']}` ADD `log_id` int(11) NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`log_id`);", false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "insert into `{$g5['g5_shop_post_log_table']}`
|
$sql = "insert into `{$g5['g5_shop_post_log_table']}`
|
||||||
set oid = '$od_id',
|
set oid = '$od_id',
|
||||||
mb_id = '{$member['mb_id']}',
|
mb_id = '{$member['mb_id']}',
|
||||||
@@ -2837,20 +2825,6 @@ function add_order_post_log($msg='', $code='error'){
|
|||||||
|
|
||||||
if( $result = sql_query($sql, false) ){
|
if( $result = sql_query($sql, false) ){
|
||||||
sql_query(" delete from {$g5['g5_shop_post_log_table']} where ol_datetime < '".date('Y-m-d H:i:s', strtotime('-15 day', G5_SERVER_TIME))."' ", false);
|
sql_query(" delete from {$g5['g5_shop_post_log_table']} where ol_datetime < '".date('Y-m-d H:i:s', strtotime('-15 day', G5_SERVER_TIME))."' ", false);
|
||||||
} else {
|
|
||||||
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
|
|
||||||
`log_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`oid` bigint(20) unsigned NOT NULL,
|
|
||||||
`mb_id` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`post_data` text NOT NULL,
|
|
||||||
`ol_code` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ol_msg` text NOT NULL,
|
|
||||||
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
`ol_ip` varchar(25) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`log_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,26 +177,6 @@ function add_shop_mod_rewrite_rules($rules, $get_path_url, $base_path, $return_s
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_shop_admin_dbupgrade($is_check){
|
|
||||||
global $g5;
|
|
||||||
|
|
||||||
// 내용 관리 짧은 주소
|
|
||||||
$sql = " SHOW COLUMNS FROM `{$g5['g5_shop_item_table']}` LIKE 'it_seo_title' ";
|
|
||||||
$row = sql_fetch($sql);
|
|
||||||
|
|
||||||
if( !$row ){
|
|
||||||
sql_query("ALTER TABLE `{$g5['g5_shop_item_table']}`
|
|
||||||
ADD `it_seo_title` varchar(200) NOT NULL DEFAULT '' AFTER `it_name`,
|
|
||||||
ADD INDEX `it_seo_title` (`it_seo_title`);
|
|
||||||
", false);
|
|
||||||
|
|
||||||
$is_check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $is_check;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function shop_exist_check_seo_title($seo_title, $type, $shop_item_table, $it_id){
|
function shop_exist_check_seo_title($seo_title, $type, $shop_item_table, $it_id){
|
||||||
|
|
||||||
$sql = "select it_seo_title FROM {$shop_item_table} WHERE it_seo_title = '".sql_real_escape_string($seo_title)."' AND it_id <> '$it_id' limit 1";
|
$sql = "select it_seo_title FROM {$shop_item_table} WHERE it_seo_title = '".sql_real_escape_string($seo_title)."' AND it_id <> '$it_id' limit 1";
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
-- @description 장바구니 상품 배송비 정보 필드 추가 (3889e0235)
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_type
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}`
|
||||||
|
ADD `it_sc_type` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_name`;
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_method
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_method` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_sc_type`;
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_price
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_price` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_method`;
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_minimum
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_minimum` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_price`;
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_qty
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_qty` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_minimum`;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- @description 장바구니 주문폼 선택 시각 필드 추가 (de2b73436)
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} ct_select_time
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `ct_select_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `ct_select`;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- @description 장바구니 상품·상태 조회 인덱스 추가 (344b1983a)
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_cart_table}} it_id
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD INDEX `it_id` (`it_id`);
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_cart_table}} ct_status
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD INDEX `ct_status` (`ct_status`);
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
-- @description 모바일 이니시스 및 결제 임시저장 테이블 추가 (a7cfae126)
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_inicis_log_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_inicis_log_table}}` (
|
||||||
|
`oid` bigint(20) unsigned NOT NULL, `P_TID` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`P_MID` varchar(255) NOT NULL DEFAULT '', `P_AUTH_DT` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`P_STATUS` varchar(255) NOT NULL DEFAULT '', `P_TYPE` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`P_OID` varchar(255) NOT NULL DEFAULT '', `P_FN_NM` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`P_AMT` int(11) NOT NULL DEFAULT '0', `P_RMESG1` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
PRIMARY KEY (`oid`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_order_data_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_order_data_table}}` (
|
||||||
|
`od_id` bigint(20) unsigned NOT NULL, `dt_pg` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`dt_data` text NOT NULL, `dt_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
KEY `od_id` (`od_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- @description 모바일 이니시스 승인번호 필드 추가 (6495aa007)
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_log_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_log_table}} P_AUTH_NO
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_log_table}}` ADD `P_AUTH_NO` varchar(255) NOT NULL DEFAULT '' AFTER `P_FN_NM`;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- @description 테스트 주문 구분 필드 추가 (4c9ac8b6b)
|
||||||
|
-- @if-table-exists {{g5_shop_order_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_order_table}} od_test
|
||||||
|
ALTER TABLE `{{g5_shop_order_table}}` ADD `od_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `od_settle_case`;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
-- @description 미완료 주문의 장바구니·회원 필드 추가 (f1cd96dc3)
|
||||||
|
-- @if-table-exists {{g5_shop_order_data_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_order_data_table}} cart_id
|
||||||
|
ALTER TABLE `{{g5_shop_order_data_table}}`
|
||||||
|
ADD `cart_id` bigint(20) unsigned NOT NULL AFTER `od_id`;
|
||||||
|
-- @if-table-exists {{g5_shop_order_data_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_order_data_table}} mb_id
|
||||||
|
ALTER TABLE `{{g5_shop_order_data_table}}` ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `cart_id`;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
-- @description 쿠폰존 테이블과 쿠폰 연결 필드 추가 (6e1aa4ac0)
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_coupon_zone_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_coupon_zone_table}}` (
|
||||||
|
`cz_id` int(11) NOT NULL AUTO_INCREMENT, `cz_type` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`cz_subject` varchar(255) NOT NULL DEFAULT '', `cz_start` date NOT NULL DEFAULT '0000-00-00',
|
||||||
|
`cz_end` date NOT NULL DEFAULT '0000-00-00', `cz_file` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cz_period` int(11) NOT NULL DEFAULT '0', `cz_point` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cp_method` tinyint(4) NOT NULL DEFAULT '0', `cp_target` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cp_price` int(11) NOT NULL DEFAULT '0', `cp_type` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`cp_trunc` int(11) NOT NULL DEFAULT '0', `cp_minimum` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cp_maximum` int(11) NOT NULL DEFAULT '0', `cz_download` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cz_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`cz_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
-- @if-table-exists {{g5_shop_coupon_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_coupon_table}} cz_id
|
||||||
|
ALTER TABLE `{{g5_shop_coupon_table}}` ADD `cz_id` int(11) NOT NULL DEFAULT '0' AFTER `mb_id`;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
-- @description 모바일 이니시스 통지 원문·메일 상태 필드 추가 (db7e07da2)
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_log_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_log_table}} post_data
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_log_table}}`
|
||||||
|
ADD `post_data` text NOT NULL AFTER `P_RMESG1`;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_log_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_log_table}} is_mail_send
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_log_table}}` ADD `is_mail_send` tinyint(4) NOT NULL DEFAULT '1' AFTER `post_data`;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
-- @description 소셜 로그인 설정과 프로필 테이블 추가 (f7ac06d7d)
|
||||||
|
-- @if-column-missing {{config_table}} cf_social_login_use
|
||||||
|
ALTER TABLE `{{config_table}}`
|
||||||
|
ADD `cf_social_login_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_googl_shorturl_apikey`;
|
||||||
|
-- 나머지 컬럼은 부분 적용 조합에서도 중복 오류가 발생하지 않도록 20260904_002에서 개별 보정한다.
|
||||||
|
-- @if-column-missing {{config_table}} cf_kakao_client_secret
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_kakao_client_secret` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_member_img_size
|
||||||
|
ALTER TABLE `{{config_table}}`
|
||||||
|
ADD `cf_member_img_size` int(11) NOT NULL DEFAULT '0' AFTER `cf_member_icon_height`;
|
||||||
|
-- @if-table-missing {{social_profile_table}}
|
||||||
|
CREATE TABLE `{{social_profile_table}}` (
|
||||||
|
`mp_no` int(11) NOT NULL AUTO_INCREMENT, `mb_id` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`provider` varchar(50) NOT NULL DEFAULT '', `object_sha` varchar(45) NOT NULL DEFAULT '',
|
||||||
|
`identifier` varchar(255) NOT NULL DEFAULT '', `profileurl` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`photourl` varchar(255) NOT NULL DEFAULT '', `displayname` varchar(150) NOT NULL DEFAULT '',
|
||||||
|
`description` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`mp_register_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`mp_latest_day` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
UNIQUE KEY `mp_no` (`mp_no`), KEY `mb_id` (`mb_id`), KEY `provider` (`provider`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-- @description 그누보드 5.4 SEO·메모·첨부 스키마 추가 (22aad37bf)
|
||||||
|
-- @if-column-missing {{content_table}} co_seo_title
|
||||||
|
ALTER TABLE `{{content_table}}` ADD `co_seo_title` varchar(200) NOT NULL DEFAULT '' AFTER `co_content`, ADD INDEX `co_seo_title` (`co_seo_title`);
|
||||||
|
-- @if-column-missing {{memo_table}} me_send_id
|
||||||
|
ALTER TABLE `{{memo_table}}`
|
||||||
|
ADD `me_send_id` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-column-missing {{member_table}} mb_memo_cnt
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_memo_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_call`;
|
||||||
|
-- @if-column-missing {{board_file_table}} bf_fileurl
|
||||||
|
ALTER TABLE `{{board_file_table}}`
|
||||||
|
ADD `bf_fileurl` varchar(255) NOT NULL DEFAULT '' AFTER `bf_content`;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- @description 게시판별 글 테이블에 짧은 주소 필드 추가 (22aad37bf)
|
||||||
|
-- @foreach-write-table-if-column-missing wr_seo_title
|
||||||
|
ALTER TABLE `{{write_table}}` ADD `wr_seo_title` varchar(200) NOT NULL DEFAULT '' AFTER `wr_content`, ADD INDEX `wr_seo_title` (`wr_seo_title`);
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
-- @description 그누보드 5.4.1.3 스크랩·짧은 URL 설정 추가 (ffc43056b)
|
||||||
|
-- @if-column-missing {{member_table}} mb_scrap_cnt
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_scrap_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_cnt`;
|
||||||
|
-- @if-column-missing {{config_table}} cf_bbs_rewrite
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_bbs_rewrite` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_link_target`;
|
||||||
|
-- @if-table-missing {{g5_shop_post_log_table}}
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_post_log_table}}` (
|
||||||
|
`log_id` int(11) NOT NULL AUTO_INCREMENT, `oid` bigint(20) unsigned NOT NULL,
|
||||||
|
`mb_id` varchar(255) NOT NULL DEFAULT '', `post_data` text NOT NULL,
|
||||||
|
`ol_code` varchar(255) NOT NULL DEFAULT '', `ol_msg` text NOT NULL,
|
||||||
|
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`ol_ip` varchar(25) NOT NULL DEFAULT '', PRIMARY KEY (`log_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- @description 관리 권한 메뉴 ID 길이를 50자로 확장 (28bfcea9c)
|
||||||
|
-- @if-table-exists {{auth_table}}
|
||||||
|
ALTER TABLE `{{auth_table}}` CHANGE `au_menu` `au_menu` varchar(50) NOT NULL;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
-- @description 설정·QA·로그인·방문·쇼핑몰 설정 기본키 정비 (1e72d7e81)
|
||||||
|
-- @if-column-missing {{qa_config_table}} qa_id
|
||||||
|
ALTER TABLE `{{qa_config_table}}` ADD `qa_id` int(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`qa_id`);
|
||||||
|
-- @if-column-missing {{config_table}} cf_id
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_id` int(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`cf_id`);
|
||||||
|
-- @if-column-missing {{login_table}} lo_id
|
||||||
|
ALTER TABLE `{{login_table}}` ADD `lo_id` int(11) NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY (`lo_id`), ADD UNIQUE KEY `lo_ip_unique` (`lo_ip`);
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_id
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_id` int(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`de_id`);
|
||||||
|
-- @if-table-exists {{visit_table}}
|
||||||
|
ALTER TABLE `{{visit_table}}` CHANGE `vi_id` `vi_id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
-- @description SMS5 테이블에 설치 접두어 적용 (cb1fadba4)
|
||||||
|
-- @if-table-exists sms5_config
|
||||||
|
-- @if-table-missing {{sms5_config_table}}
|
||||||
|
RENAME TABLE `sms5_config` TO `{{sms5_config_table}}`;
|
||||||
|
-- @if-table-exists sms5_write
|
||||||
|
-- @if-table-missing {{sms5_write_table}}
|
||||||
|
RENAME TABLE `sms5_write` TO `{{sms5_write_table}}`;
|
||||||
|
-- @if-table-exists sms5_history
|
||||||
|
-- @if-table-missing {{sms5_history_table}}
|
||||||
|
RENAME TABLE `sms5_history` TO `{{sms5_history_table}}`;
|
||||||
|
-- @if-table-exists sms5_book
|
||||||
|
-- @if-table-missing {{sms5_book_table}}
|
||||||
|
RENAME TABLE `sms5_book` TO `{{sms5_book_table}}`;
|
||||||
|
-- @if-table-exists sms5_book_group
|
||||||
|
-- @if-table-missing {{sms5_book_group_table}}
|
||||||
|
RENAME TABLE `sms5_book_group` TO `{{sms5_book_group_table}}`;
|
||||||
|
-- @if-table-exists sms5_form
|
||||||
|
-- @if-table-missing {{sms5_form_table}}
|
||||||
|
RENAME TABLE `sms5_form` TO `{{sms5_form_table}}`;
|
||||||
|
-- @if-table-exists sms5_form_group
|
||||||
|
-- @if-table-missing {{sms5_form_group_table}}
|
||||||
|
RENAME TABLE `sms5_form_group` TO `{{sms5_form_group_table}}`;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- @description 광고성 정보 수신 동의와 수신일 필드 추가 (66f6a75a1)
|
||||||
|
-- @if-column-missing {{config_table}} cf_use_promotion
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_use_promotion` tinyint(1) NOT NULL DEFAULT '0' AFTER `cf_privacy`;
|
||||||
|
-- @if-column-missing {{member_table}} mb_marketing_agree
|
||||||
|
ALTER TABLE `{{member_table}}`
|
||||||
|
ADD `mb_marketing_agree` tinyint(1) NOT NULL DEFAULT '0' AFTER `mb_scrap_cnt`;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- @description 쿠폰 중복 사용 방지 복합 고유 인덱스 추가 (5054e2463)
|
||||||
|
-- @if-table-exists {{g5_shop_coupon_log_table}}
|
||||||
|
ALTER TABLE `{{g5_shop_coupon_log_table}}` MODIFY `cp_id` varchar(100) NOT NULL DEFAULT '', MODIFY `mb_id` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_coupon_log_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_coupon_log_table}} idx_coupon_use
|
||||||
|
ALTER TABLE `{{g5_shop_coupon_log_table}}` ADD UNIQUE KEY `idx_coupon_use` (`cp_id`, `mb_id`);
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- @description 안전한 자동 로그인 토큰 테이블 추가 (4d5c59766, KVE-2026-0610)
|
||||||
|
-- @if-table-missing {{member_auto_login_table}}
|
||||||
|
CREATE TABLE `{{member_auto_login_table}}` (
|
||||||
|
`al_id` int(11) NOT NULL AUTO_INCREMENT, `mb_id` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`al_token` varchar(64) NOT NULL DEFAULT '', `al_user_agent` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`al_ip` varchar(45) NOT NULL DEFAULT '', `al_created` datetime DEFAULT NULL,
|
||||||
|
`al_last_used` datetime DEFAULT NULL, `al_expire` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`al_id`), UNIQUE KEY `al_token` (`al_token`), KEY `mb_id` (`mb_id`), KEY `al_expire` (`al_expire`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
-- @description 주문 취소·환불 공통 이력 테이블 추가 (0301c45f5)
|
||||||
|
-- @if-table-exists {{g5_shop_order_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_order_cancel_log_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_order_cancel_log_table}}` (
|
||||||
|
`cl_id` int(11) NOT NULL AUTO_INCREMENT, `od_id` bigint(20) unsigned NOT NULL,
|
||||||
|
`mb_id` varchar(255) NOT NULL DEFAULT '', `cl_pg` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`cl_pg_version` varchar(30) NOT NULL DEFAULT '', `cl_settle_case` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`cl_test` tinyint(4) NOT NULL DEFAULT '0', `cl_source` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`cl_type` varchar(20) NOT NULL DEFAULT '', `cl_status` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`cl_origin_tno` varchar(255) NOT NULL DEFAULT '', `cl_cancel_tno` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_pg_order_no` varchar(100) NOT NULL DEFAULT '', `cl_seq` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_pg_seq` varchar(20) NOT NULL DEFAULT '', `cl_idempotency_key` char(32) NOT NULL DEFAULT '',
|
||||||
|
`cl_request_amount` int(11) NOT NULL DEFAULT '0', `cl_approved_amount` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_remaining_amount` int(11) NOT NULL DEFAULT '0', `cl_tax_mny` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_vat_mny` int(11) NOT NULL DEFAULT '0', `cl_free_mny` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_refund_before` int(11) NOT NULL DEFAULT '0', `cl_refund_after` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`cl_result_code` varchar(50) NOT NULL DEFAULT '', `cl_result_msg` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cl_reason` varchar(255) NOT NULL DEFAULT '', `cl_request_data` mediumtext NOT NULL,
|
||||||
|
`cl_response_data` mediumtext NOT NULL, `cl_noti_data` mediumtext NOT NULL,
|
||||||
|
`cl_ip` varchar(45) NOT NULL DEFAULT '',
|
||||||
|
`cl_requested_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_approved_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_local_applied_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`cl_updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
PRIMARY KEY (`cl_id`), KEY `od_id` (`od_id`), KEY `cl_pg` (`cl_pg`),
|
||||||
|
KEY `cl_pg_version` (`cl_pg_version`), KEY `cl_status` (`cl_status`),
|
||||||
|
KEY `cl_idempotency_key` (`cl_idempotency_key`), KEY `cl_origin_tno` (`cl_origin_tno`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
-- @description KG이니시스 INIpay PRO 설정과 결제 이력 테이블 추가 (acdbcfd8b)
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_alert_use
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}`
|
||||||
|
ADD `de_inicis_pro_alert_use` tinyint(4) NOT NULL DEFAULT '1';
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_inicis_pay_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_inicis_pay_table}}` (
|
||||||
|
`ip_id` int(11) NOT NULL AUTO_INCREMENT, `ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||||
|
`ip_tid` varchar(80) NOT NULL DEFAULT '', `ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
|
||||||
|
`ip_mid` varchar(80) NOT NULL DEFAULT '', `ip_environment` varchar(10) NOT NULL DEFAULT '',
|
||||||
|
`mb_id` varchar(20) NOT NULL DEFAULT '', `ip_amount` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`ip_pay_type` varchar(20) NOT NULL DEFAULT '', `ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
|
||||||
|
`ip_device` varchar(10) NOT NULL DEFAULT '', `ip_order_type` varchar(10) NOT NULL DEFAULT '',
|
||||||
|
`ip_status` varchar(30) NOT NULL DEFAULT '', `ip_result_code` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`ip_result_message` varchar(255) NOT NULL DEFAULT '', `ip_noti_status` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`ip_noti_code` varchar(30) NOT NULL DEFAULT '', `ip_noti_message` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0', `ip_noti_at` datetime DEFAULT NULL,
|
||||||
|
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '', `ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '', `ip_cancel_checked_at` datetime DEFAULT NULL,
|
||||||
|
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0', `ip_vbank_due_at` datetime DEFAULT NULL,
|
||||||
|
`ip_expired_at` datetime DEFAULT NULL, `ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
|
`ip_approved_at` datetime DEFAULT NULL, `ip_ordered_at` datetime DEFAULT NULL,
|
||||||
|
`ip_notified_at` datetime DEFAULT NULL, `ip_canceled_at` datetime DEFAULT NULL,
|
||||||
|
`ip_created_at` datetime DEFAULT NULL, `ip_updated_at` datetime DEFAULT NULL,
|
||||||
|
`ip_ip` varchar(45) NOT NULL DEFAULT '', `ip_event_count` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0', `ip_alerted_at` datetime DEFAULT NULL,
|
||||||
|
`ip_alert_key` varchar(64) NOT NULL DEFAULT '', `ip_pg_status` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`ip_pg_amount` int(11) NOT NULL DEFAULT '0', `ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
|
||||||
|
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '', `ip_pg_message` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`ip_pg_checked_at` datetime DEFAULT NULL, PRIMARY KEY (`ip_id`), UNIQUE KEY `ip_oid` (`ip_oid`),
|
||||||
|
KEY `ip_tid` (`ip_tid`), KEY `ip_auth_tid` (`ip_auth_tid`), KEY `ip_status` (`ip_status`),
|
||||||
|
KEY `ip_noti_status` (`ip_noti_status`), KEY `ip_cancel_status` (`ip_cancel_status`),
|
||||||
|
KEY `ip_refund_required` (`ip_refund_required`), KEY `ip_updated_at` (`ip_updated_at`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-table-missing {{g5_shop_inicis_pay_event_table}}
|
||||||
|
CREATE TABLE `{{g5_shop_inicis_pay_event_table}}` (
|
||||||
|
`pe_id` int(11) NOT NULL AUTO_INCREMENT, `ip_oid` varchar(64) NOT NULL DEFAULT '',
|
||||||
|
`ip_tid` varchar(80) NOT NULL DEFAULT '', `pe_stage` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`pe_status` varchar(30) NOT NULL DEFAULT '', `pe_code` varchar(30) NOT NULL DEFAULT '',
|
||||||
|
`pe_message` varchar(255) NOT NULL DEFAULT '', `pe_source` varchar(10) NOT NULL DEFAULT '',
|
||||||
|
`pe_ip` varchar(45) NOT NULL DEFAULT '', `pe_created_at` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`pe_id`), KEY `ip_oid` (`ip_oid`), KEY `ip_tid` (`ip_tid`),
|
||||||
|
KEY `pe_status` (`pe_status`), KEY `pe_created_at` (`pe_created_at`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- @description 메일 인증 링크 유효시간 설정 추가
|
||||||
|
-- @skip-if-column {{config_table}} cf_email_certify_minutes
|
||||||
|
|
||||||
|
ALTER TABLE `{{config_table}}`
|
||||||
|
ADD `cf_email_certify_minutes` int(11) NOT NULL DEFAULT '60' AFTER `cf_use_email_certify`;
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
-- @description 과거 복합 스키마 변경의 부분 적용 상태 보정
|
||||||
|
ALTER TABLE `{{auth_table}}` MODIFY `au_menu` varchar(50) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_method
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_method` tinyint(4) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_price
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_price` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_minimum
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_minimum` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_cart_table}} it_sc_qty
|
||||||
|
ALTER TABLE `{{g5_shop_cart_table}}` ADD `it_sc_qty` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_order_data_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_order_data_table}} mb_id
|
||||||
|
ALTER TABLE `{{g5_shop_order_data_table}}` ADD `mb_id` varchar(20) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_log_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_log_table}} is_mail_send
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_log_table}}` ADD `is_mail_send` tinyint(4) NOT NULL DEFAULT '1';
|
||||||
|
|
||||||
|
-- @if-column-missing {{config_table}} cf_google_clientid
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_google_clientid` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_google_secret
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_google_secret` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_naver_clientid
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_naver_clientid` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_naver_secret
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_naver_secret` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_kakao_rest_key
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_kakao_rest_key` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_social_servicelist
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_social_servicelist` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_payco_clientid
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_payco_clientid` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_payco_secret
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_payco_secret` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_captcha
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_captcha` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_recaptcha_site_key
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_recaptcha_site_key` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_recaptcha_secret_key
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_recaptcha_secret_key` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{config_table}} cf_member_img_width
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_member_img_width` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-column-missing {{config_table}} cf_member_img_height
|
||||||
|
ALTER TABLE `{{config_table}}` ADD `cf_member_img_height` int(11) NOT NULL DEFAULT '0';
|
||||||
|
|
||||||
|
-- @if-column-missing {{memo_table}} me_type
|
||||||
|
ALTER TABLE `{{memo_table}}` ADD `me_type` enum('send','recv') NOT NULL DEFAULT 'recv';
|
||||||
|
-- @if-column-missing {{memo_table}} me_send_ip
|
||||||
|
ALTER TABLE `{{memo_table}}` ADD `me_send_ip` varchar(100) NOT NULL DEFAULT '';
|
||||||
|
ALTER TABLE `{{memo_table}}` MODIFY `me_id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
-- @if-column-missing {{board_file_table}} bf_thumburl
|
||||||
|
ALTER TABLE `{{board_file_table}}` ADD `bf_thumburl` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @if-column-missing {{board_file_table}} bf_storage
|
||||||
|
ALTER TABLE `{{board_file_table}}` ADD `bf_storage` varchar(50) NOT NULL DEFAULT '';
|
||||||
|
|
||||||
|
-- @if-column-missing {{member_table}} mb_marketing_date
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_marketing_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||||
|
-- @if-column-missing {{member_table}} mb_thirdparty_agree
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_thirdparty_agree` tinyint(1) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-column-missing {{member_table}} mb_thirdparty_date
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_thirdparty_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||||
|
-- @if-column-missing {{member_table}} mb_agree_log
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_agree_log` text NOT NULL;
|
||||||
|
-- @if-column-missing {{member_table}} mb_mailling_date
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_mailling_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||||
|
-- @if-column-missing {{member_table}} mb_sms_date
|
||||||
|
ALTER TABLE `{{member_table}}` ADD `mb_sms_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||||
|
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_reconcile_use
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_inicis_pro_reconcile_use` tinyint(4) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_log_days
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_inicis_pro_log_days` int(11) NOT NULL DEFAULT '365';
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_summary_days
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_inicis_pro_summary_days` int(11) NOT NULL DEFAULT '1825';
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_monitor_at
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_inicis_pro_monitor_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_default_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_default_table}} de_inicis_pro_monitor_message
|
||||||
|
ALTER TABLE `{{g5_shop_default_table}}` ADD `de_inicis_pro_monitor_message` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_environment
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_environment` varchar(10) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_easy_pay
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_easy_pay` varchar(20) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_noti_status
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_noti_status` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_noti_code
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_noti_code` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_noti_message
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_noti_message` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_noti_failed_count
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_noti_failed_count` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_noti_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_noti_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_cancel_status
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_cancel_status` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_cancel_code
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_cancel_code` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_cancel_message
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_cancel_message` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_cancel_checked_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_cancel_checked_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_refund_required
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_refund_required` tinyint(4) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_vbank_due_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_vbank_due_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_expired_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_expired_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_audit_error
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_audit_error` tinyint(4) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_alerted_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_alerted_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_alert_key
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_alert_key` varchar(64) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_status
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_status` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_amount
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_amount` int(11) NOT NULL DEFAULT '0';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_tid
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_tid` varchar(80) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_result_code
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_result_code` varchar(30) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_message
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_message` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-column-missing {{g5_shop_inicis_pay_table}} ip_pg_checked_at
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD `ip_pg_checked_at` datetime DEFAULT NULL;
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_inicis_pay_table}} ip_noti_status
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD KEY `ip_noti_status` (`ip_noti_status`);
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_inicis_pay_table}} ip_cancel_status
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD KEY `ip_cancel_status` (`ip_cancel_status`);
|
||||||
|
-- @if-table-exists {{g5_shop_inicis_pay_table}}
|
||||||
|
-- @if-index-missing {{g5_shop_inicis_pay_table}} ip_refund_required
|
||||||
|
ALTER TABLE `{{g5_shop_inicis_pay_table}}` ADD KEY `ip_refund_required` (`ip_refund_required`);
|
||||||
|
|
||||||
|
ALTER TABLE `{{content_table}}` MODIFY `co_seo_title` varchar(255) NOT NULL DEFAULT '';
|
||||||
|
-- @foreach-write-table
|
||||||
|
ALTER TABLE `{{write_table}}` MODIFY `wr_seo_title` varchar(255) NOT NULL DEFAULT '';
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
-- @description 과거 스키마 변경 시 누락된 기존 데이터 보정
|
||||||
|
-- @if-table-exists {{g5_shop_cart_table}}
|
||||||
|
-- @if-table-exists {{g5_shop_item_table}}
|
||||||
|
UPDATE `{{g5_shop_cart_table}}` c
|
||||||
|
INNER JOIN `{{g5_shop_item_table}}` i ON i.it_id = c.it_id
|
||||||
|
SET c.it_sc_type = i.it_sc_type,
|
||||||
|
c.it_sc_method = i.it_sc_method,
|
||||||
|
c.it_sc_price = i.it_sc_price,
|
||||||
|
c.it_sc_minimum = i.it_sc_minimum,
|
||||||
|
c.it_sc_qty = i.it_sc_qty
|
||||||
|
WHERE c.it_sc_type = 0
|
||||||
|
AND c.it_sc_method = 0
|
||||||
|
AND c.it_sc_price = 0
|
||||||
|
AND c.it_sc_minimum = 0
|
||||||
|
AND c.it_sc_qty = 0;
|
||||||
|
|
||||||
|
UPDATE `{{config_table}}`
|
||||||
|
SET cf_member_img_size = 50000,
|
||||||
|
cf_member_img_width = 60,
|
||||||
|
cf_member_img_height = 60
|
||||||
|
WHERE cf_member_img_size = 0
|
||||||
|
AND cf_member_img_width = 0
|
||||||
|
AND cf_member_img_height = 0;
|
||||||
|
|
||||||
|
-- @foreach-content-missing-seo
|
||||||
|
UPDATE `{{content_table}}`
|
||||||
|
SET co_seo_title = '{{seo_title}}'
|
||||||
|
WHERE co_id = '{{content_id}}';
|
||||||
@@ -64,12 +64,6 @@ if($PGIP == "211.219.96.165" || $PGIP == "118.129.210.25" || $PGIP == "183.109.7
|
|||||||
// 결과 incis log 테이블 기록
|
// 결과 incis log 테이블 기록
|
||||||
if($P_TYPE == 'BANK' || $P_SRC_CODE == 'A') {
|
if($P_TYPE == 'BANK' || $P_SRC_CODE == 'A') {
|
||||||
|
|
||||||
if(!sql_query(" select post_data from {$g5['g5_shop_inicis_log_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_log_table']}`
|
|
||||||
ADD `post_data` text NOT NULL AFTER `P_RMESG1`,
|
|
||||||
ADD `is_mail_send` tinyint(4) NOT NULL DEFAULT '1' AFTER `post_data` ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = " insert into {$g5['g5_shop_inicis_log_table']}
|
$sql = " insert into {$g5['g5_shop_inicis_log_table']}
|
||||||
set oid = '$P_OID',
|
set oid = '$P_OID',
|
||||||
P_TID = '$P_TID',
|
P_TID = '$P_TID',
|
||||||
|
|||||||
@@ -65,15 +65,6 @@ if (get_cart_count($tmp_cart_id) == 0) { // 장바구니에 담기
|
|||||||
alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G5_SHOP_URL.'/cart.php');
|
alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G5_SHOP_URL.'/cart.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "select * from {$g5['g5_shop_order_table']} limit 1";
|
|
||||||
$check_tmp = sql_fetch($sql);
|
|
||||||
|
|
||||||
if(!isset($check_tmp['od_other_pay_type'])){
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_order_table']}`
|
|
||||||
ADD COLUMN `od_other_pay_type` VARCHAR(100) NOT NULL DEFAULT '' AFTER `od_settle_case`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 변수 초기화
|
// 변수 초기화
|
||||||
$od_other_pay_type = '';
|
$od_other_pay_type = '';
|
||||||
|
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
<?php
|
|
||||||
include_once('./_common.php');
|
|
||||||
|
|
||||||
if($is_admin != 'super')
|
|
||||||
alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);
|
|
||||||
|
|
||||||
$g5['title'] = '장바구니 테이블 업그레이드';
|
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
|
||||||
|
|
||||||
// 배송비정보 필드 cart 테이블에 추가
|
|
||||||
if(!sql_query(" select it_sc_type from {$g5['g5_shop_cart_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_cart_table']}`
|
|
||||||
ADD `it_sc_type` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_name`,
|
|
||||||
ADD `it_sc_method` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_sc_type`,
|
|
||||||
ADD `it_sc_price` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_method`,
|
|
||||||
ADD `it_sc_minimum` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_price`,
|
|
||||||
ADD `it_sc_qty` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_minimum` ", true);
|
|
||||||
|
|
||||||
// cart 테이블에 상품의 배송비관련 정보 기록
|
|
||||||
$sql = " select ct_id, it_id from {$g5['g5_shop_cart_table']} order by ct_id ";
|
|
||||||
$result = sql_query($sql);
|
|
||||||
|
|
||||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
|
||||||
$sql = " select it_id, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty
|
|
||||||
from {$g5['g5_shop_item_table']}
|
|
||||||
where it_id = '{$row['it_id']}' ";
|
|
||||||
$it = sql_fetch($sql);
|
|
||||||
|
|
||||||
if(!$it['it_id'])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$sql = " update {$g5['g5_shop_cart_table']}
|
|
||||||
set it_sc_type = '{$it['it_sc_type']}',
|
|
||||||
it_sc_method = '{$it['it_sc_method']}',
|
|
||||||
it_sc_price = '{$it['it_sc_price']}',
|
|
||||||
it_sc_minimum = '{$it['it_sc_minimum']}',
|
|
||||||
it_sc_qty = '{$it['it_sc_qty']}'
|
|
||||||
where ct_id = '{$row['ct_id']}' ";
|
|
||||||
sql_query($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 장바구니 상품 주문폼 등록시간 기록 필드 추가
|
|
||||||
if(!sql_query(" select ct_select_time from {$g5['g5_shop_cart_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_cart_table']}`
|
|
||||||
ADD `ct_select_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `ct_select` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 이니시스 계좌이체 결과 전달을 위한 테이블 추가
|
|
||||||
if(!sql_query(" DESCRIBE {$g5['g5_shop_inicis_log_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_inicis_log_table']}` (
|
|
||||||
`oid` bigint(20) unsigned NOT NULL,
|
|
||||||
`P_TID` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_MID` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_AUTH_DT` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_STATUS` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_TYPE` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_OID` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_FN_NM` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_AUTH_NO` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`P_AMT` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`P_RMESG1` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY (`oid`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cart 테이블 index 추가
|
|
||||||
if(!sql_fetch(" show keys from {$g5['g5_shop_cart_table']} where Key_name = 'ct_status' ")) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_cart_table']}`
|
|
||||||
ADD INDEX `it_id` (`it_id`),
|
|
||||||
ADD INDEX `ct_status` (`ct_status`) ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결제정보 임시저장 테이블 추가
|
|
||||||
if(isset($g5['g5_shop_order_data_table']) && !sql_query(" DESCRIBE {$g5['g5_shop_order_data_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_order_data_table']}` (
|
|
||||||
`od_id` bigint(20) unsigned NOT NULL,
|
|
||||||
`dt_pg` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`dt_data` text NOT NULL,
|
|
||||||
`dt_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
KEY `od_id` (`od_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 이니시스 결제정보 테이블 필드 추가
|
|
||||||
if(!sql_query(" select P_AUTH_NO from {$g5['g5_shop_inicis_log_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_log_table']}`
|
|
||||||
ADD `P_AUTH_NO` varchar(255) NOT NULL DEFAULT '' AFTER `P_FN_NM` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모바일 이니시스 noti 받는 테이블 필드 추가
|
|
||||||
if(!sql_query(" select post_data from {$g5['g5_shop_inicis_log_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_inicis_log_table']}`
|
|
||||||
ADD `post_data` text NOT NULL AFTER `P_RMESG1`,
|
|
||||||
ADD `is_mail_send` tinyint(4) NOT NULL DEFAULT '1' AFTER `post_data` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 테스트 주문필드 추가
|
|
||||||
if(!sql_query(" select od_test from {$g5['g5_shop_order_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_table']}`
|
|
||||||
ADD `od_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `od_settle_case` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 주문정보 임시저장 테이블에 장바구니 ID 필드 추가
|
|
||||||
if(!sql_query(" select cart_id from {$g5['g5_shop_order_data_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_order_data_table']}`
|
|
||||||
ADD `cart_id` bigint(20) unsigned NOT NULL AFTER `od_id`,
|
|
||||||
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `cart_id` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 쿠폰존 테이블 추가
|
|
||||||
if(isset($g5['g5_shop_coupon_zone_table'])) {
|
|
||||||
if(!sql_query(" DESCRIBE {$g5['g5_shop_coupon_zone_table']} ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_coupon_zone_table']}` (
|
|
||||||
`cz_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`cz_type` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`cz_subject` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cz_start` DATE NOT NULL DEFAULT '0000-00-00',
|
|
||||||
`cz_end` DATE NOT NULL DEFAULT '0000-00-00',
|
|
||||||
`cz_file` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cz_period` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`cz_point` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`cp_method` TINYINT(4) NOT NULL DEFAULT '0',
|
|
||||||
`cp_target` VARCHAR(255) NOT NULL DEFAULT '',
|
|
||||||
`cp_price` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`cp_type` TINYINT(4) NOT NULL DEFAULT '0',
|
|
||||||
`cp_trunc` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`cp_minimum` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`cp_maximum` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`cz_download` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`cz_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
||||||
PRIMARY KEY (`cz_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 쿠폰테이블에 cz_id 필드 추가
|
|
||||||
if(!sql_query(" select cz_id from {$g5['g5_shop_coupon_table']} limit 1 ", false)) {
|
|
||||||
sql_query(" ALTER TABLE `{$g5['g5_shop_coupon_table']}`
|
|
||||||
ADD `cz_id` int(11) NOT NULL DEFAULT '0' AFTER `mb_id` ", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<p>테이블 업그레이드 완료!</p>';
|
|
||||||
|
|
||||||
include_once(G5_PATH.'/tail.sub.php');
|
|
||||||
@@ -557,93 +557,6 @@ if (!function_exists('inicis_pro_audit_tables')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('inicis_pro_audit_ensure_tables')) {
|
|
||||||
// 감사 테이블이 없으면 생성한다(스키마는 dbupgrade.php와 동일하게 유지).
|
|
||||||
function inicis_pro_audit_ensure_tables()
|
|
||||||
{
|
|
||||||
$tables = inicis_pro_audit_tables();
|
|
||||||
|
|
||||||
if (!sql_query(" DESC `{$tables['summary']}` ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$tables['summary']}` (
|
|
||||||
`ip_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_auth_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_mid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_environment` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`mb_id` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_amount` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_pay_type` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_easy_pay` varchar(20) NOT NULL DEFAULT '',
|
|
||||||
`ip_device` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`ip_order_type` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`ip_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_result_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_result_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_noti_failed_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_noti_at` datetime DEFAULT NULL,
|
|
||||||
`ip_cancel_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_cancel_checked_at` datetime DEFAULT NULL,
|
|
||||||
`ip_refund_required` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_vbank_due_at` datetime DEFAULT NULL,
|
|
||||||
`ip_expired_at` datetime DEFAULT NULL,
|
|
||||||
`ip_order_exists` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_approved_at` datetime DEFAULT NULL,
|
|
||||||
`ip_ordered_at` datetime DEFAULT NULL,
|
|
||||||
`ip_notified_at` datetime DEFAULT NULL,
|
|
||||||
`ip_canceled_at` datetime DEFAULT NULL,
|
|
||||||
`ip_created_at` datetime DEFAULT NULL,
|
|
||||||
`ip_updated_at` datetime DEFAULT NULL,
|
|
||||||
`ip_ip` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`ip_event_count` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_audit_error` tinyint(4) NOT NULL DEFAULT '0',
|
|
||||||
`ip_alerted_at` datetime DEFAULT NULL,
|
|
||||||
`ip_alert_key` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_amount` int(11) NOT NULL DEFAULT '0',
|
|
||||||
`ip_pg_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_result_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`ip_pg_checked_at` datetime DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`ip_id`),
|
|
||||||
UNIQUE KEY `ip_oid` (`ip_oid`),
|
|
||||||
KEY `ip_tid` (`ip_tid`),
|
|
||||||
KEY `ip_auth_tid` (`ip_auth_tid`),
|
|
||||||
KEY `ip_status` (`ip_status`),
|
|
||||||
KEY `ip_noti_status` (`ip_noti_status`),
|
|
||||||
KEY `ip_cancel_status` (`ip_cancel_status`),
|
|
||||||
KEY `ip_refund_required` (`ip_refund_required`),
|
|
||||||
KEY `ip_updated_at` (`ip_updated_at`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sql_query(" DESC `{$tables['event']}` ", false)) {
|
|
||||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$tables['event']}` (
|
|
||||||
`pe_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`ip_oid` varchar(64) NOT NULL DEFAULT '',
|
|
||||||
`ip_tid` varchar(80) NOT NULL DEFAULT '',
|
|
||||||
`pe_stage` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_status` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_code` varchar(30) NOT NULL DEFAULT '',
|
|
||||||
`pe_message` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`pe_source` varchar(10) NOT NULL DEFAULT '',
|
|
||||||
`pe_ip` varchar(45) NOT NULL DEFAULT '',
|
|
||||||
`pe_created_at` datetime DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`pe_id`),
|
|
||||||
KEY `ip_oid` (`ip_oid`),
|
|
||||||
KEY `ip_tid` (`ip_tid`),
|
|
||||||
KEY `pe_status` (`pe_status`),
|
|
||||||
KEY `pe_created_at` (`pe_created_at`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('inicis_pro_audit_tables_ready')) {
|
if (!function_exists('inicis_pro_audit_tables_ready')) {
|
||||||
function inicis_pro_audit_tables_ready()
|
function inicis_pro_audit_tables_ready()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,15 +41,6 @@ if (get_cart_count($tmp_cart_id) == 0) { // 장바구니에 담기
|
|||||||
alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G5_SHOP_URL.'/cart.php');
|
alert('장바구니가 비어 있습니다.\\n\\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.', G5_SHOP_URL.'/cart.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "select * from {$g5['g5_shop_order_table']} limit 1";
|
|
||||||
$check_tmp = sql_fetch($sql);
|
|
||||||
|
|
||||||
if(!isset($check_tmp['od_other_pay_type'])){
|
|
||||||
$sql = "ALTER TABLE `{$g5['g5_shop_order_table']}`
|
|
||||||
ADD COLUMN `od_other_pay_type` VARCHAR(100) NOT NULL DEFAULT '' AFTER `od_settle_case`; ";
|
|
||||||
sql_query($sql, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 변수 초기화
|
// 변수 초기화
|
||||||
$od_other_pay_type = '';
|
$od_other_pay_type = '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user