마이그레이션 Tip & Tech
사소한 것이라도 올려주시면 누군가에겐 큰 도움이 된답니다.
우선 새로운 사이트에 제로보드 XE 0.2.7을 설치하여 메뉴와 게시판을 생성합니다.
FTP로 접속하여 제로보더 홀더를 0.2.3 버젼으로 덮어쓰기하여 다운그레이드 하고
기존 제로보드가 설치된 사이트에 다운받은 마이그레이션 툴을 올려서 게시판 데이터를 XML로 백업받습니다
XE가 설치된 사이트로 XML파일을 올려서 마이그레이션을 실행하고
그런다음 다시 XE 0.2.7버젼을 덮어써서 업그레이드하면 됩니다.
------------------------------
위의 방법이 첨부파일이 있는 경우 마이그레션 가능한 방법입니다.
첨부파일이 10개인 게시판은
아래의 내용대로 마이그레이션툴 안에있는 export_board.php 파일을 수정하셔서
사용하시면 될 것입니다.
단 사진은 올라오지만 사진의 주석(설명)은 각 사진 밑으로 붙지는 않습니다.
전 급한대로 마이그레이션 한 후 필요한 게시물만 수정해서 사용했습니다.
export_board.php 파일을 아래와 같이 붉은색 부분 추가합니다
<?php
set_time_limit(0);
include "lib.php";
$filename = $_POST['filename'];
$url = $_POST['url'];
$category_srl = $_POST['category_srl'];
if(substr($url,-1)!='/') $url .= '/';
// id를 구함
$id = ereg_replace('^module\_','',$target_module);
// 게시판 정보를 구함
$query = "select * from zetyx_admin_table where name='".$id."'";
$result = mysql_query($query) or die(mysql_error());
$module_info = mysql_fetch_object($result);
// 특정 카테고리가 지정되어 있지 않다면 카테고리를 사용시에 카테고리 정보를 구함
if($module_info->use_category && !$category_srl) {
$query = "select * from zetyx_board_category_".$id;
$result = mysql_query($query) or die(mysql_error());
while($tmp = mysql_fetch_object($result)) {
$category_list[$tmp->no] = $tmp->name;
}
}
// 다운로드 헤더 출력
printDownloadHeader($filename);
// 게시물의 수를 구함
$query = sprintf("select count(*) as count from zetyx_board_%s", $id);
if($category_srl) $query .= " where category = ".$category_srl;
$count_result = mysql_query($query) or die(mysql_error());
$count_info = mysql_fetch_object($count_result);
$total_count = $count_info->count;
// 게시물을 구함
$query = sprintf('select a.*, b.user_id from zetyx_board_%s a left outer join zetyx_member_table b on a.ismember = b.no %s order by a.headnum desc, a.arrangenum desc', $id, $category_srl?"where category = ".$category_srl:"");
$document_result = mysql_query($query) or die(mysql_error());
// 헤더 정보 출력
printf("<root type=\"%s\" id=\"%s\" count=\"%d\">", 'module', $id, $total_count);
// 카테고리를 사용중이면 카테고리 정보 출력
if($module_info->use_category && !$category_srl && count($category_list)) {
print("<categories>\n");
foreach($category_list as $key => $val) {
printf("<category>%s</category>", addXmlQuote($val) );
}
print("</categories>\n");
}
$xml_buff = '';
$sequence = 0;
while($document_info = mysql_fetch_object($document_result)) {
$document_buff = null;
// 기본 정보
if($document_info->headnum <= -2000000000) $document_buff .= sprintf("<is_notice>Y</is_notice>\n");
if($document_info->is_secret) $document_buff .= sprintf("<is_secret>Y</is_secret>\n");
if($module_info->use_category && $document_info->category && $category_list[$document_info->category]) {
$document_buff .= sprintf("<category>%s</category>\n", addXmlQuote($category_list[$document_info->category]));
}
$document_buff .= sprintf("<title>%s</title>\n", addXmlQuote(strip_tags($document_info->subject)));
$document_buff .= sprintf("<readed_count>%d</readed_count>\n", $document_info->hit);
$document_buff .= sprintf("<voted_count>%d</voted_count>\n", $document_info->vote);
$document_buff .= sprintf("<comment_count>%d</comment_count>\n", $document_info->total_comment);
$document_buff .= sprintf("<password>%s</password>\n", addXmlQuote($document_info->password));
$document_buff .= sprintf("<user_id>%s</user_id>\n", addXmlQuote($document_info->user_id));
if($document_info->user_id) $document_buff .= sprintf("<user_name>%s</user_name>\n", addXmlQuote($document_info->name));
$document_buff .= sprintf("<nick_name>%s</nick_name>\n", addXmlQuote($document_info->name));
$document_buff .= sprintf("<email_address>%s</email_address>\n", addXmlQuote($document_info->email));
$document_buff .= sprintf("<homepage>%s</homepage>\n", addXmlQuote($document_info->homepage));
$document_buff .= sprintf("<regdate>%s</regdate>\n", date("YmdHis", $document_info->reg_date));
$document_buff .= sprintf("<ipaddress>%s</ipaddress>\n", $document_info->ip);
$document_buff .= sprintf("<allow_comment>%s</allow_comment>\n", 'Y');
$document_buff .= sprintf("<lock_comment>%s</lock_comment>\n", 'N');
$document_buff .= sprintf("<allow_trackback>%s</allow_trackback>\n", 'Y');
// 첨부파일 정리와 내용 변경을 위한 작업들..
$content = stripslashes($document_info->memo);
if($document_info->sitelink1) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink1, $document_info->sitelink1, $content);
if($document_info->sitelink2) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink2, $document_info->sitelink2, $content);
if($document_info->sitelink3) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink3, $document_info->sitelink3, $content);
if($document_info->sitelink4) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink4, $document_info->sitelink4, $content);
if($document_info->sitelink5) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink5, $document_info->sitelink5, $content);
if($document_info->sitelink6) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink6, $document_info->sitelink6, $content);
if($document_info->sitelink7) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink7, $document_info->sitelink7, $content);
if($document_info->sitelink8) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink8, $document_info->sitelink8, $content);
if($document_info->sitelink9) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink9, $document_info->sitelink9, $content);
if($document_info->sitelink10) $content = sprintf('<a href="%s">%s</a>%s<br />', $document_info->sitelink10, $document_info->sitelink10, $content);
$member_srl = $document_info->ismember;
/**
* 추가 변수에 대한 정리
* 필요에 따라 추가하면 됨
**/
if($document_info->x) $document_buff .= sprintf("<extra_vars1>%s</extra_vars1>\n", addXmlQuote($document_info->x));
if($document_info->y) $document_buff .= sprintf("<extra_vars2>%s</extra_vars2>\n", addXmlQuote($document_info->y));
// use_html옵션에 따른 컨텐츠 정리
switch($document_info->use_html) {
case 2 :
// pass
break;
default :
$content = nl2br($content);
break;
}
// 그림창고를 이용한 파일 첨부 내용을 찾음
$attach_files = array();
if($member_srl) {
$match_count = preg_match_all('/\[img:([^\.]*)\.(jpg|gif|png|jpeg)([^\]]*)\]/i', $content, $matches);
if($match_count) {
for($i=0;$i<$match_count;$i++) {
$image_filename = sprintf('%s.%s', $matches[1][$i], $matches[2][$i]);
$attach_files[] = array('filename'=>sprintf('icon/member_image_box/%d/%s', $member_srl, $image_filename),"download_count"=>0);
}
}
// content의 내용을 변경
$content = preg_replace('/\[img:([^\.]*)\.(jpg|gif|png|jpeg),align=([^,]*),width=([^,]*),height=([^,]*),vspace=([^,]*),hspace=([^,]*),border=([^\]]*)\]/i', '<img src="\\1.\\2" align="\\3" width="\\4" height="\\5" border="\\8" alt="\\1.\\2" />', $content);
}
if($document_info->file_name1) {
$attach_files[] = array("filename"=>$document_info->file_name1,"download_count"=>$document_info->download1);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name1)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name1, $document_info->s_file_name1, $content);
}
if($document_info->file_name2) {
$attach_files[] = array("filename"=>$document_info->file_name2,"download_count"=>$document_info->download2);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name2)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name2, $document_info->s_file_name2, $content);
}
if($document_info->file_name3) {
$attach_files[] = array("filename"=>$document_info->file_name3,"download_count"=>$document_info->download3);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name3)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name3, $document_info->s_file_name3, $content);
}
if($document_info->file_name4) {
$attach_files[] = array("filename"=>$document_info->file_name4,"download_count"=>$document_info->download4);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name4)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name4, $document_info->s_file_name4, $content);
}
if($document_info->file_name5) {
$attach_files[] = array("filename"=>$document_info->file_name5,"download_count"=>$document_info->download5);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name5)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name5, $document_info->s_file_name5, $content);
}
if($document_info->file_name6) {
$attach_files[] = array("filename"=>$document_info->file_name6,"download_count"=>$document_info->download6);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name6)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name6, $document_info->s_file_name6, $content);
}
if($document_info->file_name7) {
$attach_files[] = array("filename"=>$document_info->file_name7,"download_count"=>$document_info->download7);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name7)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name7, $document_info->s_file_name7, $content);
}
if($document_info->file_name8) {
$attach_files[] = array("filename"=>$document_info->file_name8,"download_count"=>$document_info->download8);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name8)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name8, $document_info->s_file_name8, $content);
}
if($document_info->file_name9) {
$attach_files[] = array("filename"=>$document_info->file_name9,"download_count"=>$document_info->download9);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name9)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name9, $document_info->s_file_name9, $content);
}
if($document_info->file_name10) {
$attach_files[] = array("filename"=>$document_info->file_name10,"download_count"=>$document_info->download10);
if(eregi('(jpg|gif|jpeg|png)$', $document_info->file_name10)) $content = sprintf('<img src="%s" border="0" alt="%s" /><br />%s', $document_info->s_file_name10, $document_info->s_file_name10, $content);
}
$uploaded_count = count($attach_files);
// 첨부된 파일 또는 이미지박스를 이용한 파일목록을 구함
$document_buff .= sprintf("<uploaded_count>%d</uploaded_count>\n", $uploaded_count);
$document_buff .= sprintf("<content>%s</content>\n", addXmlQuote($content));
// 첨부파일을 읽어서 xml파일에 추가
$attaches_xml_buff = null;
for($i=0;$i<$uploaded_count;$i++) {
$attach_file = $attach_files[$i]['filename'];
if(!file_exists($path.'/'.$attach_file)) continue;
$tmp_arr = explode('/',$attach_file);
$attach_filename = $tmp_arr[count($tmp_arr)-1];
$attaches_xml_buff .= sprintf("<file><filename>%s</filename>\n<path>%s</path>\n<download_count>%d</download_count>\n</file>\n", addXmlQuote($attach_filename), addXmlQuote($attach_file), $attach_files[$i]['download_count']);
}
$document_buff .= sprintf("<files count=\"%d\">\n%s</files>\n", $uploaded_count, $attaches_xml_buff);
// 코멘트 목록을 구해옴
$query = sprintf('select a.*, b.user_id from zetyx_board_comment_%s a left outer join zetyx_member_table b on a.ismember = b.no where a.parent = %d', $id, $document_info->no);
$comment_result = mysql_query($query) or die(mysql_error());
$comment_xml_buff = '';
while($comment_info = mysql_fetch_object($comment_result)) {
$comment_buff = '';
$comment_buff .= sprintf("<content>%s</content>\n", addXmlQuote(nl2br($comment_info->memo)));
$comment_buff .= sprintf("<password>%s</password>\n", addXmlQuote($comment_info->password));
$comment_buff .= sprintf("<user_id>%s</user_id>\n", addXmlQuote($comment_info->user_id));
if($comment_info->user_id) $comment_buff .= sprintf("<user_name>%s</user_name>\n", addXmlQuote($comment_info->name));
$comment_buff .= sprintf("<nick_name>%s</nick_name>\n", addXmlQuote($comment_info->name));
$comment_buff .= sprintf("<member_srl>%d</member_srl>\n", $comment_info->ismember);
$comment_buff .= sprintf("<ipaddress>%s</ipaddress>\n", addXmlQuote($comment_info->ip));
$comment_buff .= sprintf("<regdate>%s</regdate>\n", date('YmdHis', $comment_info->reg_date));
$comment_xml_buff .= sprintf("<comment>%s</comment>\n", $comment_buff);
}
$document_buff .= sprintf("<comments count=\"%d\">\n%s</comments>\n", $document_info->total_comment, $comment_xml_buff);
printf("<document sequence=\"%d\">\n%s</document>\n"."\n", $sequence++, $document_buff);
}
print '</root>';
?>
제발 도와주세요.
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 54
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 55
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 56
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 57
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 58
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 59
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 61
Warning: Cannot modify header information - headers already sent by (output started at /home/bonsai/zeroboard4_migration/export_board.php:1) in /home/bonsai/zeroboard4_migration/lib.php on line 62


