[分享]punbb轉換至phpBB3
發表於 : 2008-12-04 12:57
在此分享punbb轉換至phpBB3的程序以及心得。
punbb轉移程序大致如下:![ㄏㄏㄏ :mrgreen:](./images/smilies/icon_mrgreen.gif)
punbb轉移程序大致如下:
- 利用phpMyAdmin輸出punbb資料庫。
- 安裝phpBB2
- 上傳punbb→phpBB2 pun2phpbb 檔並執行轉換作業。
- 安裝phpBB3
- 執行phpBB2 →phpBB3 轉換作業
- 利用phpMyAdmin 輸出punbb資料庫,並儲存於您的電腦。
phpMyAdmin 的輸出作業可參考http://phpbb-tw.net/phpbb/viewtopic.php?f=98&t=13125 - 安裝phpBB2討論區。
- 因為phpBB2預設有文章標題字數的限制,為了到時轉換不會發生文章標題無法完全顯示的問題,
請依照下列方式進行phpBB2資料庫修改:此文章出處為~http://phpbb-tw.net/phpbb/viewtopic.php ... 7%E6%95%B8代碼: 選擇全部
將 phpbb_posts_text 資料表內欄位 post_subject 型態 varchar(60) -> varchar(240) 將 phpbb_topics 資料表內欄位 topic_title 型態 varchar(60) -> varchar(240)
- 登入phpBB2資料庫,載入 步驟1 所備份的punbb資料。
- 依照你的punbb版本下載官方提供的轉換工具[SUPPORT] PunBB to phpBB convertor
- 解壓縮後打開pun2phpbb/conf.php 修改punbb_為你的punbb資料表頭名稱;
例如你的punbb資料表頭名稱是forum_〞則改為修改後儲存並上傳覆蓋。代碼: 選擇全部
$pun_prefix = "forum_";
PS.如果你的punbb 資料表頭已經是"punbb_"則無需更改。 - 上傳pun2phpbb至phpBB2/* ,並執行http://yourdomane/phpBB2/pun2phpbb/,依流程指示執行轉換作業。
- 因為punbb編碼方式有所不同,所以轉換至phpBB2後會發生密碼無法登入之狀況,請打開phpBB2/login.php
找到在之後加上代碼: 選擇全部
$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : ''; $password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
上傳覆蓋,並試著登入進行測試是否無誤。代碼: 選擇全部
//*** start punnbb to phpbb password converter *** //this extra bit of code checks if the pass is from punbb then //updates the password to something phpbb would understand. There //are other ways to do this but i believe that this requires the least //amount of editing (and understanding) of phpbbs original code. ;') $sql = "SELECT user_id, username, user_password FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $username) . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql); } //lets just make sure the user exists $count = $db->sql_numrows($result); if ( $count == 1 ) { //users exists so lets grab their info if( $row = $db->sql_fetchrow($result) ) { //if a sha1 encryption is equal to the pass in the database then its left over from punbb //also its only 32 chars long since they were truncated in the dump if ( substr( sha1( $HTTP_POST_VARS['password'] ), 0, 32) == substr( $row['user_password'], 0, 32) ) { //take the subbed pass and put a md5 encryption on it and insert it into the database $sql = "UPDATE phpbb_users SET user_password = '" . md5( $HTTP_POST_VARS['password'] ) . "' WHERE user_id = '" . $row['user_id'] . "'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Password Error:<br />Please contact your board administrator immediately.', '', __LINE__, __FILE__, $sql); } } } } //we are updating the database password (if neccessary) before phpbb has a //chance to check it. the rest of the code should just run as if normally. //coded by: sporkit @ www.sporkit.com © 2005 //*** end punnbb to phpbb password converter ***
此步驟擷取自:http://www.phpbb.com/community/viewtopi ... 0#p1656990 - 安裝phpBB3並進行 phpBB2轉換至phpBB3之作業。
轉換作業請參考:http://phpbb-tw.net/phpbb/viewtopic.php?f=118&t=50704
![ㄏㄏㄏ :mrgreen:](./images/smilies/icon_mrgreen.gif)