Converting from IPB 3.4

Converting from other board software? Good decision! Need help? Have a question about a convertor? Wish to offer a convertor package? Post here.
User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Mon Jan 22, 2018 2:51 pm

HTML to BBcode conversion is in the function phpbb_prepare_message() in ./install/convertors/functions_ipb_34.php

The first $bbcodes array holds these lines that handle the quotes:

Code: Select all

'#<blockquote(?:\s)+class="ipsBlockquote" data\-author="(.*?)"(?:.*?)>(?:\s)+<div>(.*?)</div>(?:\s)+</blockquote>#s' => '[quote="$1"]$2[/
'#<blockquote(?:\s)+class="ipsBlockquote" data\-author="(.*?)"(?:.*?)>(?:\s)+<p>(.*?)</p>(?:\s)+</blockquote>#s' => '[quote="$1"]$2[/quote]',
'#<blockquote(.*?)>(.*?)</blockquote>#s' => '[quote]$2[/quote]',
Those work for me, IIRC the original convertor from Prototech didn't handle all possibilities.

The latest should handle any remaining quote, ditching all the extra information in it and just keep the formatting.
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Mon Jan 22, 2018 2:55 pm

Ger wrote:
Mon Jan 22, 2018 2:51 pm
HTML to BBcode conversion is in the function phpbb_prepare_message() in ./install/convertors/functions_ipb_34.php

The first $bbcodes array holds these lines that handle the quotes:

Code: Select all

'#<blockquote(?:\s)+class="ipsBlockquote" data\-author="(.*?)"(?:.*?)>(?:\s)+<div>(.*?)</div>(?:\s)+</blockquote>#s' => '[quote="$1"]$2[/
'#<blockquote(?:\s)+class="ipsBlockquote" data\-author="(.*?)"(?:.*?)>(?:\s)+<p>(.*?)</p>(?:\s)+</blockquote>#s' => '[quote="$1"]$2[/quote]',
'#<blockquote(.*?)>(.*?)</blockquote>#s' => '[quote]$2[/quote]',
Those work for me, IIRC the original convertor from Prototech didn't handle all possibilities.

The latest should handle any remaining quote, ditching all the extra information in it and just keep the formatting.
Oh my god you are fast as a lightning, thanks for the fast answer. :lol:
So basically I should edit Prototech convertor and run the migration again or is there some trick that I could use to run that function on the updated 3.2 phpBB installation?

User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Mon Jan 22, 2018 3:49 pm

Yeah, I've done quite some customising to that original convertor. Take a look here:
https://gist.github.com/GerB/dfbcbd5124 ... 8d9a47ffa8

With this convertor though I have taken some shortcuts and ditch some information not relevant for me but that might be interesting for you. If I were you, I'd compare both Prototech's and my version and make the best of it for your use case.
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Mon Jan 22, 2018 4:56 pm

Ger wrote:
Mon Jan 22, 2018 3:49 pm
Yeah, I've done quite some customising to that original convertor. Take a look here:
https://gist.github.com/GerB/dfbcbd5124 ... 8d9a47ffa8

With this convertor though I have taken some shortcuts and ditch some information not relevant for me but that might be interesting for you. If I were you, I'd compare both Prototech's and my version and make the best of it for your use case.
Thank you for linkin me your convertor, I really appreciate it since you put some real work in it.
The fact is that the one from Prototech worked as intended, at least for the most part.
The actual problem is that even if the bbcode is correct sometimes it's not being interpreted. If I edit a post with bbcodes that have not been parsed and then save it the bbcodes start working again. I've tried to delete phpBB's cache and then run the reparser but without any luck and at this point I don't really know what to do.

User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Tue Jan 23, 2018 10:36 am

Can you paste the following for me:
  1. A raw message text from the IPB database ipb_posts.posts that bugs you as you described
  2. The resulting content in phpBB database phpbb_posts.post_text after converting to phpBB 3.0.12
  3. The resulting content in phpBB database phpbb_posts.post_text after converting to phpBB 3.2x
  4. The phpbb_prepare_message() function content in your convertor
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Tue Jan 23, 2018 12:18 pm

1. Here is the IPB post

Code: Select all

[quote name=&#39;Hale&#39; timestamp=&#39;1366473099&#39; post=&#39;272041&#39;]<br />
Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c&#39;avessi i soldi mi comprerei anche i dvd, ma ...<br />
[/quote]<br />
Mi sono chiesto spesso anch&#39;io perché non chiudano siti che violano palesemente il diritto d&#39;autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  <img src='http://localhost/forum/public/style_emoticons/<#EMO_DIR#>/003.gif' class='bbc_emoticon' alt=';-)' /> Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.<br />
Poi l&#39;obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: &quot;non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia.&quot;<br />
Poi c&#39;è sempre chi si giustifica con l&#39;argomentazione seguente: &quot;Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. &quot;
2. Here is the phpBB 3.0.12 post

Code: Select all

[quote name=&#39;Hale&#39; timestamp=&#39;1366473099&#39; post=&#39;272041&#39;]

Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c&#39;avessi i soldi mi comprerei anche i dvd, ma ...

[/quote]

Mi sono chiesto spesso anch&#39;io perché non chiudano siti che violano palesemente il diritto d&#39;autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  &lt;img src='http://localhost/forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif' class='bbc_emoticon' alt=';-)' /&gt; Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.

Poi l&#39;obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: &quot;non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia.&quot;

Poi c&#39;è sempre chi si giustifica con l&#39;argomentazione seguente: &quot;Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. &quot;
3. Here is the phpBB 3.2 post

Code: Select all

<r>[quote name='Hale' timestamp='1366473099' post='272041']<br/>
<br/>
Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c'avessi i soldi mi comprerei anche i dvd, ma ...<br/>
<br/>
[/quote]<br/>
<br/>
Mi sono chiesto spesso anch'io perché non chiudano siti che violano palesemente il diritto d'autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  &lt;img src='<URL url="http://localhost/forum/public/style_emoticons/%3C#EMO_DIR#%3E/003.gif"><LINK_TEXT text="http://localhost/forum/public/style_emo ... #&gt;/003.gif">http://localhost/forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif</LINK_TEXT></URL>' class='bbc_emoticon' alt=';-)' /&gt; Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.<br/>
<br/>
Poi l'obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: "non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia."<br/>
<br/>
Poi c'è sempre chi si giustifica con l'argomentazione seguente: "Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. "</r>
4. Here is the phpbb_prepare_message() function

User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Tue Jan 23, 2018 12:37 pm

I think adding this line to the $bbcodes array should do the trick:

Code: Select all

'#\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]#' => '[quote="$1"]$3[/quote]',
You'll loose the timestamp and author link though, but phpBB 3.0 didn't have that feature. It should therefore result in:

Author name wrote:Quoted text
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Tue Jan 23, 2018 12:52 pm

Ger wrote:
Tue Jan 23, 2018 12:37 pm
I think adding this line to the $bbcodes array should do the trick:

Code: Select all

'#\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]#' => '[quote="$1"]$3[/quote]',
You'll loose the timestamp and author link though, but phpBB 3.0 didn't have that feature. It should therefore result in:

Author name wrote:Quoted text
With the expression that you provided I keep getting the following error:
PHP Warning: in file [ROOT]/install/convertors/functions_ipb34.php on line 960: preg_replace(): Unknown modifier '3'

User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Tue Jan 23, 2018 12:54 pm

LookedPath wrote:
Tue Jan 23, 2018 12:52 pm
Ger wrote:
Tue Jan 23, 2018 12:37 pm
I think adding this line to the $bbcodes array should do the trick:

Code: Select all

'#\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]#' => '[quote="$1"]$3[/quote]',
You'll loose the timestamp and author link though, but phpBB 3.0 didn't have that feature. It should therefore result in:

Author name wrote:Quoted text
With the expression that you provided I keep getting the following error:
PHP Warning: in file [ROOT]/install/convertors/functions_ipb34.php on line 960: preg_replace(): Unknown modifier '3'
Urgh, you're right. Didn't think of the delimiter and the &#39. Try this one:

Code: Select all

'|\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]|' => '[quote="$1"]$3[/quote]',
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Tue Jan 23, 2018 2:51 pm

I just finished running the convertor with your expression, I've updated to 3.1, updated to 3.2 and then reparsed the bbcodes but without any luck.
Before running the reparse the content of that post was the following:

Code: Select all

[quote name=&#39;Hale&#39; timestamp=&#39;1366473099&#39; post=&#39;272041&#39;]

Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c&#39;avessi i soldi mi comprerei anche i dvd, ma ...

[/quote]

Mi sono chiesto spesso anch&#39;io perché non chiudano siti che violano palesemente il diritto d&#39;autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  &lt;img src='http://localhost/forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif' class='bbc_emoticon' alt=';-)' /&gt; Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.

Poi l&#39;obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: &quot;non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia.&quot;

Poi c&#39;è sempre chi si giustifica con l&#39;argomentazione seguente: &quot;Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. &quot;
After running the reparse the content was the following:

Code: Select all

<r>[quote name='Hale' timestamp='1366473099' post='272041']<br/>
<br/>
Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c'avessi i soldi mi comprerei anche i dvd, ma ...<br/>
<br/>
[/quote]<br/>
<br/>
Mi sono chiesto spesso anch'io perché non chiudano siti che violano palesemente il diritto d'autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  &lt;img src='<URL url="http://localhost/forum/public/style_emoticons/%3C#EMO_DIR#%3E/003.gif"><LINK_TEXT text="forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif">http://localhost/forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif</LINK_TEXT></URL>' class='bbc_emoticon' alt=';-)' /&gt; Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.<br/>
<br/>
Poi l'obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: "non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia."<br/>
<br/>
Poi c'è sempre chi si giustifica con l'argomentazione seguente: "Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. "</r>
If I edit and then immediately save the message the quote starts working and this is what happens to the message:

Code: Select all

<r><QUOTE><s>[quote name='Hale' timestamp='1366473099' post='272041']</s>
<br/>
Sì, ma come mai non chiudono siti come TNT ecc se è illegale, e poi, io c'avessi i soldi mi comprerei anche i dvd, ma ...<br/>

<e>[/quote]</e></QUOTE>

Mi sono chiesto spesso anch'io perché non chiudano siti che violano palesemente il diritto d'autore, ma non ho mai trovato la risposta. Certo che, potevi chiederglielo tu visto che hai avuto la fortuna di incontrarli.  &lt;img src='<URL url="http://localhost/forum/public/style_emoticons/%3C#EMO_DIR#%3E/003.gif"><LINK_TEXT text="forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif">http://localhost/forum/public/style_emoticons/&lt;#EMO_DIR#&gt;/003.gif</LINK_TEXT></URL>' class='bbc_emoticon' alt=';-)' /&gt; Probabilmente hanno le loro priorità. Penso che prima della pirateria, si concentrino sulla lotta contro la pedopornografia.<br/>
<br/>
Poi l'obiezione che spesso viene fatta a chi scarica illegalmente e si giustifica dicendo di non avere molti soldi è: "non si tratta di beni di prima necessità: puoi farne benissimo a meno. In tempi di crisi si deve tirare la cinghia."<br/>
<br/>
Poi c'è sempre chi si giustifica con l'argomentazione seguente: "Chi scarica illegalmente, non sarebbe comunque disposto a pagare per quei prodotti. Per cui il danno in realtà non esiste. "</r>

User avatar
Ger
Recognised Extension Developer
Posts: 1486
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Converting from IPB 3.4

Post by Ger » Tue Jan 23, 2018 2:59 pm

I guess single line flag is required:

Code: Select all

'|\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]|s => '[quote="$1"]$3[/quote]',
Tested here: https://regex101.com/r/4Mkmcy/1
My extensions: Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update and Modern Quote
Newest: Quoted Where + anonymize

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Tue Jan 23, 2018 7:33 pm

Ger wrote:
Tue Jan 23, 2018 2:59 pm
I guess single line flag is required:

Code: Select all

'|\[quote name=&#39;(.+?)&#39;(.*?)\](.*?)\[/quote\]|s => '[quote="$1"]$3[/quote]',
Tested here: https://regex101.com/r/4Mkmcy/1
This one replaced the quote with the one in the right form, so it worked as intended but the problem persists.
The bbcode is not parsed and I've already ran the reparser but, as always, if I edit the message and save it without touching the text it works.

User avatar
JoshyPHP
Code Contributor
Posts: 934
Joined: Mon Jul 11, 2011 12:28 am

Re: Converting from IPB 3.4

Post by JoshyPHP » Tue Jan 23, 2018 7:52 pm

That quote format shouldn't prevent quotes from working, as you can see below:

Code: Select all

[quote name='Hale' timestamp='1366473099' post='272041']...[/quote]
...
The attribute names differ but if you remap them you can preserve the same info:

Code: Select all

[quote author='Hale' time='1366473099' post_id='272041']...[/quote]
Hale wrote:
Sat Apr 20, 2013 3:51 pm
...
I wrote the thing that does BBCodes in 3.2.

LookedPath
Registered User
Posts: 10
Joined: Mon Jan 22, 2018 2:00 pm

Re: Converting from IPB 3.4

Post by LookedPath » Tue Jan 23, 2018 7:57 pm

JoshyPHP wrote:
Tue Jan 23, 2018 7:52 pm
That quote format shouldn't prevent quotes from working, as you can see below:

Code: Select all

[quote name='Hale' timestamp='1366473099' post='272041']...[/quote]
...
The attribute names differ but if you remap them you can preserve the same info:

Code: Select all

[quote author='Hale' time='1366473099' post_id='272041']...[/quote]
Hale wrote:
Sat Apr 20, 2013 3:51 pm
...
You are right, in fact my doubt is that the forum is not parsing the bbcode as it should.
The fact that everything starts working if I edit the post and save seems like if the reparser isn't working as expected and that only the save action triggers the bbcode parser.

User avatar
JoshyPHP
Code Contributor
Posts: 934
Joined: Mon Jul 11, 2011 12:28 am

Re: Converting from IPB 3.4

Post by JoshyPHP » Tue Jan 23, 2018 8:02 pm

If you didn't run the reparser in command line, it takes a while to convert everything in the background. It works in reverse chronological order so the most recent posts should get reparsed first.
I wrote the thing that does BBCodes in 3.2.

Post Reply

Return to “[3.2.x] Convertors”

Who is online

Users browsing this forum: No registered users and 6 guests