News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[SMF Converter] phpBB3

Started by JayBachatero, January 23, 2008, 04:49:39 AM

Previous topic - Next topic

noon3

Yes I finally got everything correct after working on the permissions.

Thanks for the help and SMF!

rockstar1

I try to install phpbb3_login_fix.tgz, but when I try to upload using the packge menu, the system say that the file is corrupted, I try to uncompress phpbb3_login_fix.tgz with my computer, I can't.
How can I resolve this problem?

JBlaze

Quote from: rockstar1 on August 07, 2009, 01:52:38 AM
I try to install phpbb3_login_fix.tgz, but when I try to upload using the packge menu, the system say that the file is corrupted, I try to uncompress phpbb3_login_fix.tgz with my computer, I can't.
How can I resolve this problem?

You can try uncompressing it on your hard drive, then recompressing it with either .zip or .tar.gz as those are the only extensions SMF allows via the Package Manager.

Seems odd that it is in .tgz format :S
Jason Clemons
Former Team Member 2009 - 2012

ThorstenE


JBlaze

Jason Clemons
Former Team Member 2009 - 2012

rockstar1

Thanks, I download the .zip file, and I can run the mod.

Hostile

I have a quick question, sorry if it's been covered but this is a pretty big thread.

I'm about to run a test conversion from phpBB 3.0.5 to SMF 1.1.10. 

Will this convert.php just copy the data from the phpBB tables, leaving the original data intact?  I don't want to disrupt my users while I'm playing around with a test site.

Thanks!

ThorstenE

Quote from: Hostile on August 26, 2009, 11:51:00 AM
Will this convert.php just copy the data from the phpBB tables, leaving the original data intact? 
yes, the data from phpBB is only copied to a new SMF forum. Your phpBB will remain unaffected.

Hostile

#648
EDIT: Thanks TE, you responded while I was typing this post. :)

Well I just went ahead and backed up the database and gave it a shot.  I'm getting the following error:


Converting...
Recalculating forum statistics... Successful.
Unsuccessful!
This query:

    REPLACE INTO settings (variable, value)
    VALUES ('conversion_time', 1251304070),
    ('conversion_from', 'phpbb3_to_smf.sql');

Caused the error:

    No database selected


I click on the Try again button and the page just refreshes with the same error but a different string of numbers.

I wasn't prompted for the database, and both the phpBB3 and SMF forums were working properly before I started the conversion.

I've tried logging into the SMF forum now and it looks like my forums and posts got copied over but my admin account from phpBB does not have admin access.  Changing my group_id to 1 in phpmyadmin did the trick.

(BTW - I have the password converter package installed and it seems to work.)

ThorstenE

QuoteRecalculating forum statistics... Successful
This is the last important step from convert.php, don't care about the error (it's a bug in convert.php and already fixed in our SVN).

Hostile

Cool, thanks for the quick replies TE. :)

Elberet

Hi SMF crowd, thought you guys might be interested in this.

I'm in the process of converting a phpBB3 forum to SMF2 and worked on the conversion script a bit:

- phpBB3 [size] tag fixed. phpBB3 uses percentile sizes, SMF expects pixels. [size=80] looks rather intimidating after conversion. The fix tries to guess an appropriate pixel size as intval(11.0*($phpBBsize / 100.0))
- some other BBC regex patterns fixed.
- Smileys in messages and signatures should now work.
- Avatars fixed, Avatar filenames in phpBB3's users table are apparently not identical to filenames on disk (requests to avatar images are routed through ./downloads/file.php which finds the appropriate file and sends it, preventing hotlinking).

And here's the diff:

--- phpbb3_to_smf.sql.org 2008-09-02 23:26:02.000000000 +0200
+++ phpbb3_to_smf.sql 2009-09-15 02:17:08.000000000 +0200
@@ -121,6 +121,14 @@
LIMIT 1");
$phpbb_avatar_upload_path = $_POST['path_from'] . '/' . convert_result($request2, 0, 'config_value');
convert_free_result($request2);
+
+ $request2 = convert_query("
+ SELECT config_value
+ FROM {$from_prefix}config
+ WHERE config_name = 'avatar_salt'
+ LIMIT 1");
+ $phpbb_avatar_salt = convert_result($request2, 0, 'config_value');
+ convert_free_result($request2);
}

// time_offset = phpBB user TZ - phpBB board TZ.
@@ -132,7 +140,11 @@
elseif ($row['user_avatar_type'] == 1 && strlen($row['avatar']) > 0)
{
$smf_avatar_filename = 'avatar_' . $row['id_member'] . strrchr($row['avatar'], '.');
- @copy($phpbb_avatar_upload_path . '/' . $row['avatar'], $avatar_dir . '/' . $smf_avatar_filename);
+ $phpbb_avatar_ext = substr(strchr($row['avatar'], '.'), 1);
+ @copy(
+ $phpbb_avatar_upload_path . '/' . $phpbb_avatar_salt . '_' . $row['id_member'] . '.' . $phpbb_avatar_ext,
+ $avatar_dir . '/' . $smf_avatar_filename
+ );

convert_query("
INSERT INTO {$to_prefix}attachments
@@ -154,6 +166,9 @@
if ($row['signature_uid'] != '')
$row['signature'] = preg_replace('~(:u:|:1:|:)' . preg_quote($row['signature_uid'], '~') . '~i', '', $row['signature']);

+if(!function_exists("percent_to_px")) {function percent_to_px ($str) {
+ return intval(11*(intval($str)/100.0));
+}}
$row['signature'] = preg_replace(
array(
'~\[quote="(.+?)"(:.+?)?\]~is',
@@ -165,25 +180,26 @@
'~\[/i(:.+?)?\]~is',
'~\[u(:.+?)?\]~is',
'~\[/u(:.+?)?\]~is',
- '~\[url:(.+?)\]~is',
- '~\[/url:(.+?)?\]~is',
- '~\[url=(.+?):(.+?)\]~is',
- '~\[/url:(.+?)?\]~is',
+ '~\[url(:.+?)\]~is',
+ '~\[/url(:.+?)?\]~is',
+ '~\[url=(.+?)(:.+?)?\]~is',
+ '~\[/url(:.+?)?\]~is',
'~\<a(.+?) href="(.+?)">(.+?)</a>~is',
- '~\[img:(.+?)?\]~is',
- '~\[/img:(.+?)?\]~is',
- '~\[size=(.+?):(.+?)\]~is',
+ '~\[img(:.+?)?\]~is',
+ '~\[/img(:.+?)?\]~is',
+ '~\[size=(.+?)(:.+?)?\]~ise',
'~\[/size(:.+?)?\]~is',
- '~\[color=(.+?):(.+?)\]~is',
+ '~\[color=(.+?)(:.+?)?\]~is',
'~\[/color(:.+?)?\]~is',
- '~\[code=(.+?):(.+?)?\]~is',
+ '~\[code=(.+?)(:.+?)?\]~is',
'~\[code(:.+?)?\]~is',
'~\[/code(:.+?)?\]~is',
- '~\[list=(.+?):(.+?)?\]~is',
+ '~\[list=(.+?)(:.+?)?\]~is',
'~\[list(:.+?)?\]~is',
'~\[/list(:.+?)?\]~is',
'~\[\*(:.+?)?\]~is',
'~\[/\*(:.+?)?\]~is',
+ '~<!-- s(.+?) --><img .+? /><!-- s(.+?) -->~is',
'~<!-- (.+?) -->~is',
),
array(
@@ -203,7 +219,7 @@
'[url=$2]$3[/url]',
'[img]',
'[/img]',
- '[size=$1px]',
+ '"[size=".percent_to_px("\1")."px]"',
'[/size]',
'[color=$1]',
'[/color]',
@@ -215,12 +231,13 @@
'[/list]',
'[li]',
'[/li]',
+ '$1',
'',
), $row['signature']);

-$row['signature'] = preg_replace('~\[size=(.+?)px\]~is', "[size=" . ('\1' > '99' ? 99 : '"\1"') . "px]", $row['signature']);
+/*$row['signature'] = preg_replace('~\[size=(.+?)px\]~is', "[size=" . ('\1' > '99' ? 99 : '"\1"') . "px]", $row['signature']);*/

-// This just does the stuff that it isn't work parsing in a regex.
+// This just does the stuff that it isn't work parsing in a regex. #'
$row['signature'] = strtr($row['signature'], array(
'[list type=1]' => '[list type=decimal]',
'[list type=a]' => '[list type=lower-alpha]',
@@ -458,6 +475,9 @@

---* {$to_prefix}messages 200
---{
+if(!function_exists("percent_to_px")) {function percent_to_px ($str) {
+ return intval(11*(intval($str)/100.0));
+}}
// This does the major work first
$row['body'] = preg_replace(
array(
@@ -470,25 +490,26 @@
'~\[/i(:.+?)?\]~is',
'~\[u(:.+?)?\]~is',
'~\[/u(:.+?)?\]~is',
- '~\[url:(.+?)\]~is',
- '~\[/url:(.+?)?\]~is',
- '~\[url=(.+?):(.+?)\]~is',
- '~\[/url:(.+?)?\]~is',
+ '~\[url(:.+?)?\]~is',
+ '~\[/url(:.+?)?\]~is',
+ '~\[url=(.+?)(:.+?)?\]~is',
+ '~\[/url(:.+?)?\]~is',
'~\<a(.+?) href="(.+?)">(.+?)</a>~is',
- '~\[img:(.+?)?\]~is',
- '~\[/img:(.+?)?\]~is',
- '~\[size=(.+?):(.+?)\]~is',
+ '~\[img(:.+?)?\]~is',
+ '~\[/img(:.+?)?\]~is',
+ '~\[size=(.+?)(:.+?)?\]~ise',
'~\[/size(:.+?)?\]~is',
- '~\[color=(.+?):(.+?)\]~is',
+ '~\[color=(.+?)(:.+?)?\]~is',
'~\[/color(:.+?)?\]~is',
- '~\[code=(.+?):(.+?)?\]~is',
+ '~\[code=(.+?)(:.+?)?\]~is',
'~\[code(:.+?)?\]~is',
'~\[/code(:.+?)?\]~is',
- '~\[list=(.+?):(.+?)?\]~is',
+ '~\[list=(.+?)(:.+?)?\]~is',
'~\[list(:.+?)?\]~is',
'~\[/list(:.+?)?\]~is',
'~\[\*(:.+?)?\]~is',
'~\[/\*(:.+?)?\]~is',
+ '~<!-- s(.+?) --><img .+? /><!-- s(.+?) -->~is',
'~<!-- (.+?) -->~is',
),
array(
@@ -508,7 +529,7 @@
'[url=$2]$3[/url]',
'[img]',
'[/img]',
- '[size=$1px]',
+ '"[size=".percent_to_px("\1")."px]"',
'[/size]',
'[color=$1]',
'[/color]',
@@ -520,12 +541,13 @@
'[/list]',
'[li]',
'[/li]',
+ '$1',
'',
), $row['body']);

-$row['body'] = preg_replace('~\[size=(.+?)px\]~is', "[size=" . ('\1' > '99' ? 99 : '"\1"') . "px]", $row['body']);
+/*$row['body'] = preg_replace('~\[size=(.+?)px\]~is', "[size=" . ('\1' > '99' ? 99 : '"\1"') . "px]", $row['body']);*/

-// This just does the stuff that it isn't work parsing in a regex.
+// This just does the stuff that it isn't work parsing in a regex. #'
$row['body'] = strtr($row['body'], array(
'[list type=1]' => '[list type=decimal]',
'[list type=a]' => '[list type=lower-alpha]',
@@ -674,4 +696,4 @@
post_msg_id AS id_msg, download_count AS downloads,
real_filename AS filename, physical_filename, filesize AS size
FROM {$from_prefix}attachments;
----*
\ Kein Zeilenumbruch am Dateiende.
+---*

Norv

Thank you!
I'm sure it will be useful, and taking the time to share it is very appreciated!

Thanks again :)
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

Elberet

So...

I'm working on fixing attachmens as well, but the converter PHP file is giving me a hard time. As there's apparently no documentation as to what is expected of converter SQL scripts, I've been running on guesses, good-will, reverse engineering and lots of trial & error, but I think I've hit a dead end.

Here's an excerpt of what I'm trying to do:

---* {$to_prefix}attachments
---{
/* lots of php code here. among other things, it does: */
$row['some_id'] = fiddle_with_ids($row['other_data']);
unset($row['other_data']); /* clean non-SMF columns from $row */
---}
SELECT post_msg_id AS id_msg, junk AS trash, foo AS bar
FROM {$from_prefix}attachments
ORDER BY attach_id;
---*


I've verified that $row contains sensible data right after entering and just before leaving my code, e.g.:

Array
(
    [id_msg] => 2640
    [id_member] => 0
    [filename] => logo.png
    [downloads] => 16
    [fileext] => png
    [mime_type] => image/png
    [size] => 31632
    [id_thumb] => 0
    [attachment_type] => 0
    [id_folder] => 1
    [approved] => 1
    [file_hash] => 0d5ef322d1bd7ab7bf967e7ff492529b838e8867
    [width] => 450
    [height] => 90
)


Also, $to_prefix and $from_prefix are set properly, the tables exist and contain the columns one would expect. SHOW CREATE TABLE smf_attachments says:
CREATE TABLE `smf_attachments` (
  `id_attach` int(10) unsigned NOT NULL auto_increment,
  `id_thumb` int(10) unsigned NOT NULL default '0',
  `id_msg` int(10) unsigned NOT NULL default '0',
  `id_member` mediumint(8) unsigned NOT NULL default '0',
  `id_folder` tinyint(3) NOT NULL default '1',
  `attachment_type` tinyint(3) unsigned NOT NULL default '0',
  `filename` tinytext NOT NULL,
  `file_hash` varchar(40) NOT NULL default '',
  `fileext` varchar(8) NOT NULL default '',
  `size` int(10) unsigned NOT NULL default '0',
  `downloads` mediumint(8) unsigned NOT NULL default '0',
  `width` mediumint(8) unsigned NOT NULL default '0',
  `height` mediumint(8) unsigned NOT NULL default '0',
  `mime_type` varchar(20) NOT NULL default '',
  `approved` tinyint(3) NOT NULL default '1',
  PRIMARY KEY  (`id_attach`),
  UNIQUE KEY `id_member` (`id_member`,`id_attach`),
  KEY `id_msg` (`id_msg`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8


The converter, however, seems to be blind, as it tells me that "The database value you're trying to insert does not exist: id_msg". I traced that error back to a regex callback function in Sources/Subs-Db-mysql.php; the regex is apparently being fed a string containing "{id_msg}", while the corresponding $values array doesn't contain that particular key.

So.

Am I just being stupid and missing the obvious? I mean, I could go on tracing through the database libraries, but not knowing the code all too well makes this feel like a particularily painful and unusual punishment...  ;)

SleePy

Elberet,
http://www.simplemachines.org/community/index.php?topic=333570.0

It doesn't include your fixes though.  The attachment section at the end is what you would want to look at for the .sql file :)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Elberet

I'm not entirely sure what's going on in the thread you linked; does convert.php contain magic that treats certain SMF tables, e.g. the attachments table, specially?

Anyway... I actually gave up and decided to just workaround whatever problem I had run into, by setting $no_add and inserting columns into the attachments table manually.

This leaves just one issue open: BBCode in private messages isn't being fixed. However, my converted forum has gone live yesterday, so I guess I won't fix that now. ^^

The attached file contains the fixes I posted as a diff earlier, as well as my shot at getting attachments to work...

SleePy

Convert.php does handle attachments specially, but due to an issue with the 2.0 converters it may not work right.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Benneh

Hi,

Im converting from phpbb3 to smf 1.1.10.

After running the conversion, obviously I cannot log on, so I reset the password on my admin account, this works fine, I then run the phpBB3_Login_Fix file (tired the tgz and the zip file) both say they have worked, but the test account I created before the transfer still cannot log on without performing a reset via email.

Is this correct or should they just ben able to then log in?  If they should be able to log in, any idea whats going wrong?

Norv

After applying the login fix on 1.1.10, the passwords for the phpbb account should be recognized correctly. However, in case there are still problems, perhaps it will help to clear the browser cache and saved passwords, then try again.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

ingamer

Hello,

I have been attempting to convert my database from PHPBB3 to SMF 1.1.10

I have read through most of the articles on this support forums and still haven't found an answer

My previous forums PHPBB3 is running english_us, after using convert.php (using default UTF-8 setting) it converts with non-critcial errors (missing attachments / getsize errors & sql bug at the end) , the forums, users and apparently most everything is completed successfully

The previous forum - the user we're able to use custom bbcodes such as [youtube] and [collegehumor] for example (I was going to use the bbcode mod to patch this once it was converted)

For some reason the conversion has caused the bbcodes to have random characters inside the blocks [bbcode:#random chracters#] (/bbcode:#random chracters#)for example:

[youtube:1gofbzek]http://www.youtube.com/watch?v=t0QVH3-npD0 [nofollow][/youtube:1gofbzek]
[youtube:3cu70r59]http://www.youtube.com/watch?v=Mim5HjpQhjU [nofollow][/youtube:3cu70r59]
or
[collegehumor:3n6t2v8f]http://www.collegehumor.com/video:1922189 [nofollow][/collegehumor:3n6t2v8f]
[collegehumor:277x384u]http://www.collegehumor.com/video:1917906 [nofollow][/collegehumor:277x384u]

[always random characters]

- I am stumped as to why this is happening only to bbcodes , I would think that the rest of the posts would be messed up also but it appears to have something to do with the [] brackets (this happens with all bbcodes from the looks of it)


any suggestions? I have tried different *character sets* while converting with the same result

Thank you for any suggestions!

Advertisement: