[工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

在这里讨论从其他论坛程序转换到PHPBB的话题
User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

[工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by IOsetting » 2008-02-14 13:02

DZ6.0到PHPBB3的转换工具, 支持Discuz6.0到phpBB3.0.0的论坛数据转换.
转换的内容包括:
用户, 版面, 主题, 文章, 短信, 版主, 部分头像, 附件

下载地址

使用方法:
将压缩包中的文件解开放入install/convertors目录下.
全新安装phpBB3,
安装结束后, 不要急着进入控制面板, 点击左上角的"转换/Convert"进入转换界面, 如果上一步操作无误的话, 能看到Discuz的转换选项. 点击右边的链接继续.
安装完如果不小心跳过, 可以输入http://您的论坛地址/install/ 直接进入上一步所述界面
随后的界面中, 需要填入discuz所在的相对路径, 以及其数据库服务器的连接参数, 如果不正确, 在继续时会有错误提示.

注意: 转换的过程中不会对原discuz的数据做任何修改, 如果中途出错请不要担心. 但是为保险起见, 请在尝试转换前备份所有discuz的论坛数据, 切记.

转换之后需要自己动手将Discuz的附件复制到新的论坛目录下. 操作为:
复制<Discuz安装目录>/attachments/* 到 <phpBB安装目录>/files/dz_files/*
其中 dz_files 目录是不存在的, 需要自己创建

为了能够正常显示和下载原先Discuz论坛的附件, 需要对phpBB3进行如下修改, 此修改不影响phpBB3自身附件的正常使用. 在phpBB3每次升级后, 都需要应用此修改才能正常使用原先Discuz的附件.

##########################################################
打开 download/file.php

找到

Code: Select all

$attachment['physical_filename'] = basename($attachment['physical_filename']);
在前面添加

Code: Select all

$attachment['physical_foldername'] = dirname($attachment['physical_filename']);
找到

Code: Select all

redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_filename']);
替换成

Code: Select all

redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_foldername'] . '/' . $attachment['physical_filename']);
找到

Code: Select all

$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];
替换成

Code: Select all

$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_foldername'] . '/' . $attachment['physical_filename'];

打开
includes/functions_admin.php

找到

Code: Select all

return @unlink($phpbb_root_path . $config['upload_path'] . '/' . $filename);
替换成

Code: Select all

return @unlink($phpbb_root_path . $config['upload_path'] . '/' . dirname($filename) . '/' . $filename);
打开
includes/functions_content.php

找到

Code: Select all

$filename = $phpbb_root_path . $config['upload_path'] . '/' . basename($attachment['physical_filename']);
$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . basename($attachment['physical_filename']);
替换成

Code: Select all

$filename = $phpbb_root_path . $config['upload_path'] . '/' . dirname($attachment['physical_filename']) . '/' . basename($attachment['physical_filename']);
$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/' . dirname($attachment['physical_filename']) . '/thumb_' . basename($attachment['physical_filename']);
对于某些PHP版本, 如果发现无法正确显示中文附件名, 请继续如下两步修改:
找到

Code: Select all

'DOWNLOAD_NAME'		=> basename($attachment['real_filename']),
替换成

Code: Select all

'DOWNLOAD_NAME'		=> mybasename($attachment['real_filename']),
找到

Code: Select all

/**
 * Check if extension is allowed to be posted.
在前面添加

Code: Select all

function mybasename($path)
{
   $paths = explode('/', $path);
   $temps = explode('\\', $paths[count($paths)-1]);
   $basename = $temps[count($temps)-1];
   return $basename;
}

airwin
初来乍到
初来乍到
Posts: 1
Joined: 2008-02-13 14:39

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by airwin » 2008-02-14 16:12

好东西!
“这下大家满足了吧”~! ;)
情人节老大还不休息

iaihah
初来乍到
初来乍到
Posts: 2
Joined: 2007-11-27 22:30

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by iaihah » 2008-02-15 2:30

一般错误
SQL ERROR [ mysql4 ]

MySQL server has gone away [2006]

SQL

UPDATE phpbb_config SET config_value = 'a:3:{s:4:\"step\";s:38:\"&current_table=6&skip_rows=403\";s:12:\"table_prefix\";s:4:\"cdb_\";s:3:\"tag\";s:8:\"discuz60\";}' WHERE config_name = 'convert_progress'

BACKTRACE


FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 148
CALL: dbal_mysql->sql_query()

FILE: installed/install_convert.php
LINE: 1540
CALL: set_config()

FILE: installed/install_convert.php
LINE: 1418
CALL: install_convert->save_convert_progress()

FILE: installed/install_convert.php
LINE: 203
CALL: install_convert->convert_data()

FILE: installed/index.php
LINE: 402
CALL: install_convert->main()

FILE: installed/index.php
LINE: 274
CALL: module->load()

iaihah
初来乍到
初来乍到
Posts: 2
Joined: 2007-11-27 22:30

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by iaihah » 2008-02-15 2:56

改下msyql的参数就好了。
max_allowed_packet=192M
iaihah wrote:一般错误
SQL ERROR [ mysql4 ]

MySQL server has gone away [2006]

SQL

UPDATE phpbb_config SET config_value = 'a:3:{s:4:\"step\";s:38:\"&current_table=6&skip_rows=403\";s:12:\"table_prefix\";s:4:\"cdb_\";s:3:\"tag\";s:8:\"discuz60\";}' WHERE config_name = 'convert_progress'

BACKTRACE


FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 148
CALL: dbal_mysql->sql_query()

FILE: installed/install_convert.php
LINE: 1540
CALL: set_config()

FILE: installed/install_convert.php
LINE: 1418
CALL: install_convert->save_convert_progress()

FILE: installed/install_convert.php
LINE: 203
CALL: install_convert->convert_data()

FILE: installed/index.php
LINE: 402
CALL: install_convert->main()

FILE: installed/index.php
LINE: 274
CALL: module->load()

海水焰
学有小成
学有小成
Posts: 171
Joined: 2008-02-12 1:44

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 海水焰 » 2008-02-15 5:53

以后这东西说不定会是PHPBB在中国的镇山之宝

叶知秋
学有小成
学有小成
Posts: 111
Joined: 2007-07-29 1:41

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 叶知秋 » 2008-02-15 23:30

:grin: :grin: :grin:
测试 测试

User avatar
sirtoozee
初来乍到
初来乍到
Posts: 5
Joined: 2007-12-12 10:44

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by sirtoozee » 2008-02-17 21:46

应叶子的需求 http://trac.lcuc.org.cn/public/linuxfans/ticket/1

PHP脚本copy附件文件到<phpBB3 installed directory>/files/yearmonth/*, for example, /var/www/localhost/htdocs/phpbb3/files/200802/*

SVN地址 https://svn.lcuc.org.cn/public/svn-linu ... onvertors/

大家来测试一下,如果发现BUG或有任何建议,请提交ticket到 http://trac.lcuc.org.cn/public/linuxfans/newticket

User avatar
sirtoozee
初来乍到
初来乍到
Posts: 5
Joined: 2007-12-12 10:44

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by sirtoozee » 2008-02-17 21:52

所以,我还和叶子(LCUC的npcomet)说我们用MySQL的C API,写一个binary的程序吧,后来想想工作量不是一般的大++
iaihah wrote:改下msyql的参数就好了。
max_allowed_packet=192M
iaihah wrote:一般错误
SQL ERROR [ mysql4 ]

MySQL server has gone away [2006]

SQL

UPDATE phpbb_config SET config_value = 'a:3:{s:4:\"step\";s:38:\"&current_table=6&skip_rows=403\";s:12:\"table_prefix\";s:4:\"cdb_\";s:3:\"tag\";s:8:\"discuz60\";}' WHERE config_name = 'convert_progress'

BACKTRACE


FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 148
CALL: dbal_mysql->sql_query()

FILE: installed/install_convert.php
LINE: 1540
CALL: set_config()

FILE: installed/install_convert.php
LINE: 1418
CALL: install_convert->save_convert_progress()

FILE: installed/install_convert.php
LINE: 203
CALL: install_convert->convert_data()

FILE: installed/index.php
LINE: 402
CALL: install_convert->main()

FILE: installed/index.php
LINE: 274
CALL: module->load()

叶知秋
学有小成
学有小成
Posts: 111
Joined: 2007-07-29 1:41

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 叶知秋 » 2008-02-18 15:30

出现常规错误
未知编码gbk,修改functions_discuz60.php
return utf8_recode($text, 'gbk');
中的gbk为gb2312或者gb18030
上个版本也存在此问题,希望尽快修正。
dz使用的gbk编码有的程序根本不认识,推荐使用gb18030。

321
初来乍到
初来乍到
Posts: 3
Joined: 2008-02-18 14:34

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 321 » 2008-02-18 19:56

已跟了全部修改

為何咐件仍然轉不了

當看咐件帖時 會出現如下
阿莎芬堡約翰尼斯堡
[attach]66[/attach]

巴伐利亞新天鵝堡
[attach]61[/attach]

還有一些Discuz! 代碼
[img=580,385]http://img220.imageshack.us/img220/9400 ... 985zw4.jpg[/img]

User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by IOsetting » 2008-02-18 23:04

只有以默认粘贴的附件能显示, 目前的转换程序还不能处理dz代码, 所以按这样显示的附件不能显示在文中.

321
初来乍到
初来乍到
Posts: 3
Joined: 2008-02-18 14:34

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 321 » 2008-02-18 23:25

為什麼我不能顯示dz 的圖片咐件

煩請看看↓名:test 密:test
http://discuz.sytes.net/dz/viewtopic.php?f=36&t=558


dz原本的↓名:test 密:test
http://www.byaudi.com/ek/thread-558-1-2.html

User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by IOsetting » 2008-02-19 0:22

你确信按照上面所说的对phpbb进行修改了吗? 如果修改不正确的话, 即使转换过后也是无法看到附件的.

321
初来乍到
初来乍到
Posts: 3
Joined: 2008-02-18 14:34

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by 321 » 2008-02-19 10:04

試過多次转换了

總是無法成功转换的

這刻重新转换又出現如下 error

Code: Select all

安裝過程出現致命錯誤
安裝過程出現致命錯誤

functions_convert.php [ 2406 ]

請首先確保這些資料夾存在並且可以被網絡伺服器寫入,然後重試:
?./../images/avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery
images/avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery/dz_avatars/gallery

yinhua
初来乍到
初来乍到
Posts: 3
Joined: 2008-02-19 15:51

Re: [工具]DZ6.0到PHPBB3的转换程序 - 包含附件转换

Post by yinhua » 2008-02-19 15:53

出现这个情况是怎么回事?
一般错误
SQL ERROR [ mysqli ]

Incorrect string value: '\xCE\xE5\xCB\xC4\xA1\xEF...' for column 'config_value' at row 1 [1366]

SQL

UPDATE phpbb_config SET config_value = 'Υ˄?﹤??????›̳' WHERE config_name = 'sitename'

BACKTRACE


FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/functions.php
LINE: 148
CALL: dbal_mysqli->sql_query()

FILE: includes/functions_convert.php
LINE: 1288
CALL: set_config()

FILE: install/install_convert.php
LINE: 987
CALL: restore_config()

FILE: install/install_convert.php
LINE: 203
CALL: install_convert->convert_data()

FILE: install/index.php
LINE: 402
CALL: install_convert->main()

FILE: install/index.php
LINE: 274
CALL: module->load()

Post Reply