diff --git a/adm/admin.menu100.php b/adm/admin.menu100.php index f70b68eac..6658e18c5 100644 --- a/adm/admin.menu100.php +++ b/adm/admin.menu100.php @@ -19,5 +19,6 @@ if(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && $menu['menu100'][] = array('100520', '접속로그 변환', G5_ADMIN_URL.'/browscap_convert.php', 'cf_visit_cnvrt'); } +$menu['menu100'][] = array('100410', 'DB업그레이드', G5_ADMIN_URL.'/dbupgrade.php', 'db_upgrade'); $menu['menu100'][] = array('100400', '부가서비스', G5_ADMIN_URL.'/service.php', 'cf_service'); ?> \ No newline at end of file diff --git a/adm/dbupgrade.php b/adm/dbupgrade.php new file mode 100644 index 000000000..528f84fb5 --- /dev/null +++ b/adm/dbupgrade.php @@ -0,0 +1,88 @@ +현재 DB 업그레이드가 완료된 상태입니다.'; +?> + +
+

+ +

+
+ + \ No newline at end of file diff --git a/g4_import.php b/g4_import.php index 3e4f67ac2..86a8745bd 100644 --- a/g4_import.php +++ b/g4_import.php @@ -11,6 +11,8 @@ if(get_session('tables_copied') == 'done') if($is_admin != 'super') alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL); + +include_once(G5_PATH.'/head.php'); ?> - -
-

+
+

+ 이 프로그램은 그누보드5 설치 후 바로 실행하셔야만 합니다.
+ 만약 그누보드5 사이트를 운영 중에 이 프로그램을 실행하시면 DB 데이터가 망실되거나 데이터의 오류가 발생할 수 있습니다.
+ 또한 중복해서 실행하실 경우에도 DB 데이터의 오류가 발생할 수 있으니 반드시 한번만 실행해 주십시오. +

+

프로그램을 실행하시려면 그누보드4의 config.php 파일 경로를 입력하신 후 확인을 클릭해 주십시오.

- - -
- - - -
- 사이트 내 전체검색 -
- - - - - -
- - -
- - - -
- - - - -
+
+ +
+ + +
+
-
+

+ 경로는 그누보드5 설치 루트를 기준으로 그누보드4의 config.php 파일의 상대경로입니다.
+ 예를 들어 그누보드4를 웹루트에 설치하셨고 그누보드5를 g5라는 하위 폴더에 설치하셨다면 입력하실 경로는 ../config.php 입니다. +

- -
- - -
- - -
-
- -
-
-
- -
-

- 이 프로그램은 그누보드5 설치 후 바로 실행하셔야만 합니다.
- 만약 그누보드5 사이트를 운영 중에 이 프로그램을 실행하시면 DB 데이터가 망실되거나 데이터의 오류가 발생할 수 있습니다.
- 또한 중복해서 실행하실 경우에도 DB 데이터의 오류가 발생할 수 있으니 반드시 한번만 실행해 주십시오. -

-

프로그램을 실행하시려면 그누보드4의 config.php 파일 경로를 입력하신 후 확인을 클릭해 주십시오.

- -
- -
- - - -
-
- -

- 경로는 그누보드5 설치 루트를 기준으로 그누보드4의 config.php 파일의 상대경로입니다.
- 예를 들어 그누보드4를 웹루트에 설치하셨고 그누보드5를 g5라는 하위 폴더에 설치하셨다면 입력하실 경로는 ../config.php 입니다. -

- -
- - - -
-
- - - -
- - -
-
<?php echo G5_VERSION ?>
-
-

- Copyright © 소유하신 도메인. All rights reserved.
- 상단으로 -

-
\ No newline at end of file diff --git a/g4_import_run.php b/g4_import_run.php index fa101017f..259832777 100644 --- a/g4_import_run.php +++ b/g4_import_run.php @@ -3,17 +3,9 @@ include_once('./_common.php'); ob_end_clean(); -include_once(G5_LIB_PATH.'/connect.lib.php'); -include_once(G5_LIB_PATH.'/outlogin.lib.php'); - set_time_limit ( 0 ); ini_set('memory_limit', '50M'); -$g5['title'] = '그누보드4 DB 데이터 이전'; -include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/head.sub.php'); - -echo ''; - if(empty($_POST)) alert('올바른 방법으로 이용해 주십시오.', G5_URL); @@ -41,6 +33,9 @@ if(!is_file($g4_config_file)) alert('입력하신 경로에 config.php 파일이 존재하지 않습니다.'); $is_euckr = false; + +$g5['title'] = '그누보드4 DB 데이터 이전'; +include_once(G5_PATH.'/head.php'); ?> - + } - + $sql_common .= $comma . " $key = '".addslashes($val)."' "; -
- - - - -
-
+ $comma = ','; + } -
+ sql_query(" INSERT INTO {$g5['board_table']} SET $sql_common "); - + // 게시판 테이블 생성 + $bo_table = $row['bo_table']; + $file = file(G5_ADMIN_PATH.'/sql_write.sql'); + $sql = implode($file, "\n"); + + $create_table = $g5['write_prefix'] . $bo_table; + + $source = array('/__TABLE_NAME__/', '/;/'); + $target = array($create_table, ''); + $sql = preg_replace($source, $target, $sql); + + // 게시글 복사 + if(sql_query($sql, FALSE)) { + $write_table = $g4['write_prefix'].$bo_table; + $columns2 = sql_field_names($create_table); + + $sql3 = " select * from $write_table "; + $result3 = sql_query($sql3); + + for($k=0; $row3=sql_fetch_array($result3); $k++) { + if($is_euckr) + $row3 = array_map('iconv_utf8', $row3); + + $comma3 = ''; + $sql_common3 = ''; + + foreach($row3 as $key=>$val) { + if(!in_array($key, $columns2)) + continue; + + $sql_common3 .= $comma3 . " $key = '".addslashes($val)."' "; + + $comma3 = ','; + } + + // 첨부파일개수 + $wr_id = $row3['wr_id']; + $sql4 = " select count(*) as cnt from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' "; + $row4 = sql_fetch($sql4); + + $sql_common3 .= " , wr_file = '{$row4['cnt']}' "; + + sql_query(" INSERT INTO $create_table SET $sql_common3 "); + } + + echo '
  • '.str_replace(G5_TABLE_PREFIX.'write_', '', $create_table).' 게시글 복사
  • '; + } +} + +unset($columns); +unset($fiels); + +// 그외 테이블 복사 +$tables = array('board_file', 'board_new', 'board_good', 'mail', 'memo', 'group_member', 'auth', 'popular', 'poll', 'poll_etc', 'scrap'); + +foreach($tables as $table) { + $columns = sql_field_names($g5[$table.'_table']); + + $src_table = $g4[$table.'_table']; + $dst_table = $g5[$table.'_table']; + $sql = " select * from $src_table "; + $result = sql_query($sql); + for($i=0; $row=sql_fetch_array($result); $i++) { + if($is_euckr) + $row = array_map('iconv_utf8', $row); + + $comma = ''; + $sql_common = ''; + + foreach($row as $key=>$val) { + if(!in_array($key, $columns)) + continue; + + $sql_common .= $comma . " $key = '".addslashes($val)."' "; + + $comma = ','; + } + + $result2 = sql_query(" INSERT INTO $dst_table SET $sql_common ", false); + + if(!$result2) + continue; + } + + echo '
  • '.$table.' table 복사
  • '.PHP_EOL; +} + +unset($columns); +unset($fiels); + +echo ''.PHP_EOL; + +echo '
    그누보드4 DB 데이터 이전 완료
    '.PHP_EOL; + +// 실행완료 세션에 기록 +set_session('tables_copied', 'done'); +?>
    - - -
    - - -
    -
    - -
    -
    -
    - -
    -
      - $val) { - if($key == 'mb_no') - continue; - - if(!in_array($key, $columns)) - continue; - - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['member_table']} SET $sql_common "); - } - - echo '
    1. member table 복사
    2. '.PHP_EOL; - unset($columns); - unset($fiels); - - // point table 복사 - $sql = " select * from {$g4['point_table']} "; - $result = sql_query($sql); - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - if($key == 'po_id') - continue; - - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['point_table']} SET $sql_common "); - } - echo '
    3. point table 복사
    4. '.PHP_EOL; - - // login table 복사 - $sql = " select * from {$g4['login_table']} "; - $result = sql_query($sql); - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - // 중복체크 - $sql2 = " select count(*) as cnt from {$g5['login_table']} where lo_ip = '{$row['lo_ip']}' "; - $row2 = sql_fetch($sql2); - if($row2['cnt']) - continue; - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['login_table']} SET $sql_common "); - } - echo '
    5. login table 복사
    6. '.PHP_EOL; - - // visit table 복사 - $sql = " select * from {$g4['visit_table']} "; - $result = sql_query($sql); - - // g5_visit 테이블 초기화 - sql_query(" delete from {$g5['visit_table']} "); - - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - // 중복체크 - /* - $sql2 = " select count(*) as cnt from {$g5['visit_table']} where vi_ip = '{$row['vi_ip']}' and vi_date = '{$row['vi_date']}' "; - $row2 = sql_fetch($sql2); - if($row2['cnt']) - continue; - */ - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['visit_table']} SET $sql_common "); - } - echo '
    7. visit table 복사
    8. '.PHP_EOL; - - // visit sum table 복사 - $sql = " select * from {$g4['visit_sum_table']} "; - $result = sql_query($sql); - - // g5_visit_sub 테이블 초기화 - sql_query(" delete from {$g5['visit_sum_table']} "); - - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - // 중복체크 - /* - $sql2 = " select count(*) as cnt from {$g5['visit_sum_table']} where vs_date = '{$row['vs_date']}' "; - $row2 = sql_fetch($sql2); - if($row2['cnt']) - continue; - */ - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['visit_sum_table']} SET $sql_common "); - } - echo '
    9. visit sum table 복사
    10. '.PHP_EOL; - - // group table 복사 - $columns = sql_field_names($g5['group_table']); - - $sql = " select * from {$g4['group_table']} "; - $result = sql_query($sql); - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - // 중복체크 - $sql2 = " select count(*) as cnt from {$g5['group_table']} where gr_id = '{$row['gr_id']}' "; - $row2 = sql_fetch($sql2); - if($row2['cnt']) - continue; - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - if(!in_array($key, $columns)) - continue; - - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['group_table']} SET $sql_common "); - } - - echo '
    11. group table 복사
    12. '.PHP_EOL; - unset($columns); - unset($fiels); - - // board 복사 - $columns = sql_field_names($g5['board_table']); - - $sql = " select * from {$g4['board_table']} "; - $result = sql_query($sql); - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - // 중복체크 - $sql2 = " select count(*) as cnt from {$g5['board_table']} where bo_table = '{$row['bo_table']}' "; - $row2 = sql_fetch($sql2); - if($row2['cnt']) - continue; - - $comma = ''; - $sql_common = ''; - - // 모바일 스킨 디렉토리 - if( ! isset($row['bo_mobile_skin']) ){ - $row['bo_mobile_skin'] = 'basic'; - } - - // 모바일 제목 길이 - if( ! isset($row['bo_mobile_subject_len']) ){ - $row['bo_mobile_subject_len'] = '30'; - } - - // 모바일 페이지당 목록 수 - if( ! isset($row['bo_mobile_page_rows']) ){ - $row['bo_mobile_page_rows'] = '15'; - } - - // 갤러리 이미지 폭 ( 리스트 ) - if( ! isset($row['bo_gallery_width']) ){ - $row['bo_gallery_width'] = '174'; - } - - // 갤러리 이미지 높이 ( 리스트 ) - if( ! isset($row['bo_gallery_height']) ){ - $row['bo_gallery_height'] = '124'; - } - - // 모바일 갤러리 이미지 폭 ( 리스트 ) - if( ! isset($row['bo_mobile_gallery_width']) ){ - $row['bo_mobile_gallery_width'] = '125'; - } - - // 모바일 갤러리 이미지 높이 ( 리스트 ) - if( ! isset($row['bo_mobile_gallery_height']) ){ - $row['bo_mobile_gallery_height'] = '100'; - } - - foreach($row as $key=>$val) { - if(!in_array($key, $columns)) - continue; - - if($key === 'bo_notice'){ - $val = str_replace("\n", ",", $val); - - if( substr($val, -1) === ',' ){ - $val = substr($val, 0, -1); - } - } - - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - sql_query(" INSERT INTO {$g5['board_table']} SET $sql_common "); - - // 게시판 테이블 생성 - $bo_table = $row['bo_table']; - $file = file(G5_ADMIN_PATH.'/sql_write.sql'); - $sql = implode($file, "\n"); - - $create_table = $g5['write_prefix'] . $bo_table; - - $source = array('/__TABLE_NAME__/', '/;/'); - $target = array($create_table, ''); - $sql = preg_replace($source, $target, $sql); - - // 게시글 복사 - if(sql_query($sql, FALSE)) { - $write_table = $g4['write_prefix'].$bo_table; - $columns2 = sql_field_names($create_table); - - $sql3 = " select * from $write_table "; - $result3 = sql_query($sql3); - - for($k=0; $row3=sql_fetch_array($result3); $k++) { - if($is_euckr) - $row3 = array_map('iconv_utf8', $row3); - - $comma3 = ''; - $sql_common3 = ''; - - foreach($row3 as $key=>$val) { - if(!in_array($key, $columns2)) - continue; - - $sql_common3 .= $comma3 . " $key = '".addslashes($val)."' "; - - $comma3 = ','; - } - - // 첨부파일개수 - $wr_id = $row3['wr_id']; - $sql4 = " select count(*) as cnt from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' "; - $row4 = sql_fetch($sql4); - - $sql_common3 .= " , wr_file = '{$row4['cnt']}' "; - - sql_query(" INSERT INTO $create_table SET $sql_common3 "); - } - - echo '
    13. '.str_replace(G5_TABLE_PREFIX.'write_', '', $create_table).' 게시글 복사
    14. '; - } - } - - unset($columns); - unset($fiels); - - // 그외 테이블 복사 - $tables = array('board_file', 'board_new', 'board_good', 'mail', 'memo', 'group_member', 'auth', 'popular', 'poll', 'poll_etc', 'scrap'); - - foreach($tables as $table) { - $columns = sql_field_names($g5[$table.'_table']); - - $src_table = $g4[$table.'_table']; - $dst_table = $g5[$table.'_table']; - $sql = " select * from $src_table "; - $result = sql_query($sql); - for($i=0; $row=sql_fetch_array($result); $i++) { - if($is_euckr) - $row = array_map('iconv_utf8', $row); - - $comma = ''; - $sql_common = ''; - - foreach($row as $key=>$val) { - if(!in_array($key, $columns)) - continue; - - $sql_common .= $comma . " $key = '".addslashes($val)."' "; - - $comma = ','; - } - - $result2 = sql_query(" INSERT INTO $dst_table SET $sql_common ", false); - - if(!$result2) - continue; - } - - echo '
    15. '.$table.' table 복사
    16. '.PHP_EOL; - } - - unset($columns); - unset($fiels); - - echo '
    '.PHP_EOL; - - echo '
    그누보드4 DB 데이터 이전 완료
    '.PHP_EOL; - - // 실행완료 세션에 기록 - set_session('tables_copied', 'done'); - ?> -
    - -
    -
    - - - -
    - - -
    -
    <?php echo G5_VERSION ?>
    -
    -

    - Copyright © 소유하신 도메인. All rights reserved.
    - 상단으로 -

    -
    -
    - - \ No newline at end of file