Simple Machines Community Forum

SMF Support => Converting to SMF => phpBB => Topic started by: Catsmother on August 25, 2020, 07:06:55 AM

Title: Converting To Simple Machines From PhpBB 3.3.1
Post by: Catsmother on August 25, 2020, 07:06:55 AM
Hello there.

I have someone helping me and I am wanting to convert to SM but we're getting loads of errors. Is there a way this can be done please?
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Doug Heffernan on August 25, 2020, 07:14:42 AM
Quote from: Catsmother on August 25, 2020, 07:06:55 AM
Hello there.

I have someone helping me and I am wanting to convert to SM but we're getting loads of errors. Is there a way this can be done please?

What errors are you getting?
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Catsmother on August 25, 2020, 07:18:07 AM
Quote from: Doug Heffernan on August 25, 2020, 07:14:42 AM
Quote from: Catsmother on August 25, 2020, 07:06:55 AM
Hello there.

I have someone helping me and I am wanting to convert to SM but we're getting loads of errors. Is there a way this can be done please?

What errors are you getting?

I have just asked the person who is trying to install it to come and reply here.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: boro_boy on August 25, 2020, 07:33:46 AM
Hello,

I was getting errors on mybb. With simple machines I couldn't find anything to use, to transfer from phpBB to simple machines. Is there a migration / import script that will work? Like I say, I had a look but couldn't find anything.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: boro_boy on August 25, 2020, 08:29:05 AM
Just tried a converter for phpbb 3.2 but got this error:

Converting ranks... Unsuccessful!
This query:
DELETE FROM `forumfor_smf843`.smfif_membergroups
WHERE groupName LIKE 'phpBB %';
Caused the error:
1054

So not sure where to go with this!
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: vbgamer45 on August 25, 2020, 08:59:10 AM
What SMF version? That looks like SMF 1.1.x above

Did you grab the convertor from the site here? We don't yet have one for 3.3.  3.2 has conversion issues with posts.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: boro_boy on August 25, 2020, 09:03:38 AM
Hello and thank you for your reply, I got the converter from here:

https://download.simplemachines.org/index.php?converters;id=69

I may just have to wait until a converter is available.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Doug Heffernan on August 25, 2020, 10:18:45 AM
I think another way to go about this is to convert first to MyBB and then from that you can convert to Smf. Smf has a converter that supports the latest version of MyBB to Smf 2.0.17. I think that it is worth a try.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 08:44:14 AM
Quote from: vbgamer45 on August 25, 2020, 08:59:10 AMWe don't yet have one for 3.3.  3.2 has conversion issues with posts.

That means you don't have one for 3.2 either. And 3.2 is years old.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: vbgamer45 on August 28, 2020, 08:46:39 AM
Correct hopefully someone can help fix that issue one day. Maybe you can give it a shot.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 09:02:48 AM
I don't know anything about converters.

If the phpBB 3.2/3.3 to MyBB ** converter works, and the MyBB ** to SMF 2.0.x converter works, then frankly doing it that way would probably be easier than fixing the phpBB 3.2 to SMF 2.0.x converter. Probably worth a quick test run.

**Don't know offhand what the latest version of MyBB is, not ever having been interested in using it.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 10:17:23 AM
Just looking at a db dump from phpBB 3.2.9. The tags that are causing the problems with post conversion seem pretty straightforward to get rid of. If the conversion script doesn't require the phpBB forum to be actually running (ie: just needs the database) it would be possible to kill the unwanted tags in a code editor just with find/replace. There aren't that many of them (AFAICT at the moment):

<E> </E>
<r> </r>
<s> </s>
<t> </t>


Quote appear to be done with uppercase for parent quotes and lowercase for nested quotes:

<QUOTE author=\"whoopee\"><s>[quote=\"yeeha\"]

There are also some line break codes that are not standard HTML, but are perfectly obvious.

\n

Beats me why they need two different syntaxes to do line breaks, but whatever. :P

Then there are some odd emoji tags, but in theory you could do a code replace on those too:

<EMOJI seq=\"1f609\">:wink:</EMOJI>

Url formatting inside posts (ie: bbc_link class in SMF) is really bizarre:

<URL url=\"http://www.example.com/about.htm\"><s>[url=http://www.example.com/about.htm]</s>this page<e>[/url]</e></URL>

Not sure if there are any other odd ones (cbf'd doing too much digging at this time of night) but again it's probably possible to sort a generic find/replace for these. And I would expect that if it can be done with a basic code editor, it could also be done with SQL queries.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: vbgamer45 on August 28, 2020, 10:23:27 AM
Yeah some are very odd. MyBB doesn't look it handles it either their convertor is old as well but haven't tried using it. I just refer to other convertors when updating ours
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 10:36:21 AM
Yeah I took a quick squiz at the MyBB support forum and it looks like people are having issues with phpBB to MyBB too. Not necessarily insurmountable issues, but not a no-brainer either. So going that route is probably just adding in extra problems in the long run.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: shadav on August 28, 2020, 01:27:59 PM
not that it's really any much help but I was able to convert phpbb 3.3. (2 or 3 I forget which it was) to smf 2.0.17
and well....it mostly works....
the avatar folder was not converted, so you'll have to add that back in and then I was nice and went through and reuploaded users avs for them
and all of the mumbo jumbo in the posts was annoying
as mentioned a lot of <e>,<r>, <s>, <t> and <n> tags for no real reason
which could probably all be removed with some find and replaces
and most of the bbcode was converted to html...again some find and replaces would be a quick fix to that

the biggest issue I had was with links (either url or image) but I think that that was mostly due to installed extensions ... probably would be best to remove any extension from phpbb first....then you should be able to just do some find and replaces to fix all of the other issues with posts

I'm not gonna say it was easy....there was over 600 posts that I had to go through manually and fix, but again I think if you removed any extensions first it'd be a lot easier and should just be able to do find and replaces
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Dav999 on August 28, 2020, 06:41:51 PM
My interpretation of the weird tags is that they're just trying to make converting post contents to HTML as cheap as possible.

For example the URL tags:

Quote from: Antechinus on August 28, 2020, 10:17:23 AM
Url formatting inside posts (ie: bbc_link class in SMF) is really bizarre:

<URL url=\"http://www.example.com/about.htm\"><s>[url=http://www.example.com/about.htm]</s>this page<e>[/url]</e></URL>

My guess is: any BBCode is placed between <s></s> and <e></e> ("start" and "end"?). So that for displaying the post, it doesn't need to do a full conversion from BBCode every time and it just strips those tags out, and when editing/quoting the post it strips all the HTML out. Though it does have some very non-standard HTML tags (QUOTE, EMOJI, URL), maybe that's still computationally cheaper for it to convert that to actual HTML in some way, or it does it in client-side Javascript? Maybe these tags are a middle ground where validity checks have already been done?
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 07:41:15 PM
I agree about "start" and "end". The same thought had occurred to me. For our purposes it doesn't much matter why they did it. We just need to get rid of them (which isn't hard).

Quote from: shadav on August 28, 2020, 01:27:59 PM
not that it's really any much help but I was able to convert phpbb 3.3. (2 or 3 I forget which it was) to smf 2.0.17
and well....it mostly works....
Which means it doesn't. :D

Quotethe avatar folder was not converted
That should be fixable. In principle it's just a matter of associating the correct images with the relevant usernames, all of which will already be in the database.

Quoteand all of the mumbo jumbo in the posts was annoying
as mentioned a lot of <e>,<r>, <s>, <t> and <n> tags for no real reason
There is obviously a reason for them. The phpBB devs may have an eccentric way of looking at things, but they're not stupid as such.

Quoteand most of the bbcode was converted to html...again some find and replaces would be a quick fix to that
Yup. First step is to catalogue all the possible glitches with tags.

QuoteI'm not gonna say it was easy....there was over 600 posts that I had to go through manually and fix, but again I think if you removed any extensions first it'd be a lot easier and should just be able to do find and replaces
Manual editing of posts is out of the question. It has to be done en masse.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 28, 2020, 09:20:39 PM
Y'know, it just occurred to me (d'oh) that there should be a handy list of all these funny bits somewhere in the phpBB docs. I'm gonna do a bit of digging.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on August 29, 2020, 06:11:44 AM
Righty-o then. Docs don't appear to be comprehensive and/or entirely up to date. Yay! :P

Anyway, line breaks are coded as:
<br/>\n
Which needs a simple replace with:
<br/>

Bold is done as:
<B><s>[b]</s>bold text here<e>[/b]</e></B>

Italic is:
<I><s>[i]</s>italic text here<e>[/i]</e></I>

Bold nested inside italic is:
<I><s>[i]</s><B><s>[b]</s>bold italic text here<e>[/b]</e></B><e>[/i]</e></I>

Standard smileys use an uppercase E tag around the smiley code:
<E>:lol:</E>

BBC colours are:
<COLOR color=\"red\"><s>[color=red]</s>red text here<e>[/color]</e></COLOR>

Code boxes are:
<CODE><s>[code]</s>00 00 02 00   00 00 00 00   00 00 00 00   00 04 00 04\n20 xx <e>[/ code]</e></CODE>

With the line breaks inside code tags apparently being done with \n rather than the standard HTML br tag. Which is a trap for young players. It means you can't just delete all instances of \n in the posts table. You'd only want to delete the ones that are directly preceded by a br tag.

Inline attachments are:
<ATTACHMENT filename=\"massive_lolcat.jpg\" index=\"0\"><s>[attachment=0]</s>massive_lolcat.jpg<e>[/attachment]</e></ATTACHMENT>


Most of these are pretty easy to deal with. The tricky ones are going to be in-post links, which are going to have varying url's in the middle of the gobbledegook.

<URL url=\"http://www.example.com/about.htm\"><s>[url=http://www.example.com/about.htm]</s>this page<e>[/url]</e></URL>
That's going to require a wildcard search to knock out the superfluous url tag in front of the s tag.

And then there's this weird shiznit:
<URL url=\"http://example.com/forums/viewtopic.php?f=67&amp;t=811&amp;start=170#p42039\"><LINK_TEXT text=\"viewtopic.php?f=67&amp;t=811&amp;start=170#p42039\">http://example.com/forums/viewtopic.php?f=67&amp;t=811&amp;start=170#p42039</LINK_TEXT></URL>

Not sure WTF that is supposed to be. :)
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on September 14, 2020, 06:55:00 PM
Just looking through Dougie's suggestions in this thread: Some easy fixes to the phpBB 3 to SMF 2 converter.... (https://www.simplemachines.org/community/index.php?topic=508551.0#quickreply)

Quote from: dougiefresh on July 28, 2013, 10:04:58 AM
In phpBB, the size bbcode is used to specify what size the font should be in the form of a percentage.  SMF doesn't support this form and the converter tries to convert everything to pixels, which results in VERY LARGE letters!  So to fix this, we need to do a few things....

In phpbb3_to_smf.sql, find this:
'[size=$1px]',
Replace this line with the following:
'[size=$1]',
This changes the default "translation" of the size bbcode back to what it is in the phpBB board.....

There is a problem with doing this, as SMF doesn't recognize this usage of the size bbcode.  So, we have to add the phpBB-style Font Size BBCode (http://custom.simplemachines.org/mods/index.php?mod=3714) mod in order to fix this minor issue.

Other alternative, which would most likely be fine in 99.9% of cases, and would save having to use the mod, would be to simply use this:

Code (Find) Select
'[size=$1px]',
Code (Replace) Select
'[size=1em]',

That way everything just becomes standard font-size. If you happen to notice anything particularly important that needs the font size different, it will be easy to edit. If you don't notice, it wasn't important anyway.
Title: Re: Converting To Simple Machines From PhpBB 3.3.1
Post by: Antechinus on September 14, 2020, 10:47:53 PM
Hey hang on a minute. Re this conversion of font sizes, IanL added this to his phpBB => Elk 1.0 script (which should also work on SMF 2.0):

function percent_to_px($percent)
{
return intval(11 * (intval($percent) / 100.0));
}


With that applying to this bit where the size tags are defined:

'[size=' . percent_to_px("\1") . 'px]',
'[/size]',


Looking at the default Subs.php array for font size...

array(
'tag' => 'size',
'type' => 'unparsed_equals',
'test' => '([1-9][\d]?p[xt]|small(?:er)?|large[r]?|x[x]?-(?:small|large)|medium|(0\.[1-9]|[1-9](\.[\d][\d]?)?)?em)\]',
'before' => '<span style="font-size: $1;" class="bbc_size">',
'after' => '</span>',
),


Alrighty, as far as I can tell that says it will do sizes in pt, keyword, or em. Cool. However, I can't get it to parse if I use a < 1 decimal value of em. Using 1.00em or 1.15em works just fine, but for some reason using .85em or 0.85em doesn't work. It just spits out the raw BBC, instead of turning it into a span with font-size set inline. IOW, it renders exactly as if you had wrapped it in a .bbc_code tag.

Why? Decimal values < 1 are perfectly valid values in HTML. Surely Subs.php should  be able to handle them. If it can't handle them, what's stopping it?

Reason I'm asking is because if the SMF 2.0.x array can be made to handle < 1 decimal values of em, converting straight from phpBB values to SMF-compatible values would be a piece of cake. You'd just use a function like this:

function percent_to_em($percent)
{
return ($percent / 100.0);
}


With that applying to...

'[size=' . percent_to_em("\1") . 'em]',
'[/size]',


That would give an exact conversion regardless of what weird size someone had entered in phpBB (and they do enter weird sizes, coz I've looked in a save of the db I admin).