[分享]punbb轉換至phpBB3

phpBB 3 Conversion Support
phpBB 2 轉換 (升級) 到 phpBB 3 之問題討論!

版主: 版主管理群

版面規則
本區是討論關於 phpBB 2 轉換升級到 phpBB 3 之問題討論!

參考連結:
官方 phpbb.com 自訂資料庫已收錄之轉換器
主題已鎖定
頭像
rex
版面管理員
版面管理員
文章: 501
註冊時間: 2001-11-01 15:28
來自: 竹貓星球
聯繫:

[分享]punbb轉換至phpBB3

文章 rex »

在此分享punbb轉換至phpBB3的程序以及心得。
punbb轉移程序大致如下:
  1. 利用phpMyAdmin輸出punbb資料庫。
  2. 安裝phpBB2
  3. 上傳punbb→phpBB2 pun2phpbb 檔並執行轉換作業。
  4. 安裝phpBB3
  5. 執行phpBB2 →phpBB3 轉換作業
轉換詳細作業如下:
  1. 利用phpMyAdmin 輸出punbb資料庫,並儲存於您的電腦。
    phpMyAdmin 的輸出作業可參考http://phpbb-tw.net/phpbb/viewtopic.php?f=98&t=13125
  2. 安裝phpBB2討論區。
  3. 因為phpBB2預設有文章標題字數的限制,為了到時轉換不會發生文章標題無法完全顯示的問題,
    請依照下列方式進行phpBB2資料庫修改:

    代碼: 選擇全部

    將 phpbb_posts_text 資料表內欄位 post_subject 型態 varchar(60) -> varchar(240)
    將 phpbb_topics 資料表內欄位 topic_title 型態 varchar(60) -> varchar(240) 
    此文章出處為~http://phpbb-tw.net/phpbb/viewtopic.php ... 7%E6%95%B8
  4. 登入phpBB2資料庫,載入 步驟1 所備份的punbb資料。
  5. 依照你的punbb版本下載官方提供的轉換工具[SUPPORT] PunBB to phpBB convertor
  6. 解壓縮後打開pun2phpbb/conf.php 修改punbb_為你的punbb資料表頭名稱;
    例如你的punbb資料表頭名稱是forum_〞則改為

    代碼: 選擇全部

    $pun_prefix = "forum_";
    修改後儲存並上傳覆蓋。
    PS.如果你的punbb 資料表頭已經是"punbb_"則無需更改。
  7. 上傳pun2phpbb至phpBB2/* ,並執行http://yourdomane/phpBB2/pun2phpbb/,依流程指示執行轉換作業。
  8. 因為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
  9. 安裝phpBB3並進行 phpBB2轉換至phpBB3之作業。
    轉換作業請參考:http://phpbb-tw.net/phpbb/viewtopic.php?f=118&t=50704
以上為小弟大至整理出來的轉換重點,如有不足或是相關疑問歡迎提出討論,謝謝。 :mrgreen:
全面支援 phpBB3.3.x 版本虛擬空間

台灣[不限流量]虛擬主機
*可自由調整php 版本。
*免費 SSL 簽章。
https://kukan.tw/
主題已鎖定

回到「[3.0.x] 轉換」