Importing from phpBB3

Right. They have different import_ids, but the same username. If you want them to be the same user, they’ll need to have the same username (or you can contrive for them to have the same import_id).

Maybe search for

User.where("username like '%1'")

That’ll also catch people who just happened to want to end their username with a 1. .

And that will work perfectly . . . unless their email addresses changed.

However you got about it, you’ll have some stuff like this to resolve by hand.

1 Like

Quite useful. I am moving my gaming forum to discord. The PHPbb hosting (this one: https://www.cloudways.com/en/phpbb-hosting.php ) that I was using doesnt support apps other than PHP. So, I am in the process of exploring another platform for that.

I try to migrate a phpBB 3.2.9 forum to discourse. I have about 2.800 users and nearly 36.000 posts. For the import I use the Git repo of @gerhard with the phpbb3 branch.

The migration of the users and the PNs work fine. But with the posts I have a problem. There are only about 2.800 posts migrated. I got messages like the following one:

    12201 / 35281 ( 34.6%)  [68323 items/min]  Failed to map post with ID 14742
undefined method `name' for nil:NilClass
/var/www/discourse/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb:57:in `visit'
/var/www/discourse/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb:25:in `convert'
/var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:41:in `process_raw_text'
/var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:68:in `process_post'
/var/www/discourse/script/import_scripts/phpbb3/importers/post_importer.rb:35:in `map_post'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:130:in `block (2 levels) in import_posts'
/var/www/discourse/script/import_scripts/base.rb:491:in `block in create_posts'
/usr/local/lib/ruby/gems/2.6.0/gems/rack-mini-profiler-1.1.4/lib/patches/db/mysql2.rb:8:in `each'
/usr/local/lib/ruby/gems/2.6.0/gems/rack-mini-profiler-1.1.4/lib/patches/db/mysql2.rb:8:in `each'
/var/www/discourse/script/import_scripts/base.rb:490:in `create_posts'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:128:in `block in import_posts'
/var/www/discourse/script/import_scripts/base.rb:870:in `block in batches'
/var/www/discourse/script/import_scripts/base.rb:869:in `loop'
/var/www/discourse/script/import_scripts/base.rb:869:in `batches'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:186:in `batches'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:122:in `import_posts'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:33:in `execute'
/var/www/discourse/script/import_scripts/base.rb:47:in `perform'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:22:in `perform'
./script/import_scripts/phpbb3.rb:33:in `<module:PhpBB3>'
./script/import_scripts/phpbb3.rb:14:in `<module:ImportScripts>'
./script/import_scripts/phpbb3.rb:13:in `<main>'
    12202 / 35281 ( 34.6%)  [68322 items/min]  Failed to map post with ID 14744
undefined method `name' for nil:NilClass

I am not a Ruby expert. So I do not realy know how I can debug this. It looks like, that there is missing a method. But how to I get them and why are nearly 2.800 posts migrated?

Any ideas, what creates this problem and of course, how I can fix this?

Thank you!

1 Like

Sometimes there are some gremlins in code or DB goblins.

If your migration halts on error (sound like it does in this case), what I do is look at the error message and go into the offending file in the script and wrap the error in a simple:

begin
   #offending line or lines of ruby code
rescue
   puts "error! in <offending routine> variable #{variable} blab blah my great message"
end

I recently migrated over 1M posts, and trapping errors like in the example above and “moving on” was a lifesaver.

Every migration is different, not that I have so much experience like others, but I have done one about 20 different ways and 100 different times, LOL, and my experience is that the begin rescue end construct is very important.

Of course, you can dig deeper and see if there is a bigger problem later; but sometimes you just want to keep pluggn’ and migrat’n along :slight_smile:

2 Likes

Welcome @TBauer :wave:

Maybe you overlooked this warning in the first post.

2 Likes

@TBauer seems to be using this experimental branch, so I guess this is fine. It’s still not supported, but I’d like to know what’s causing this error anyway.

@TBauer could you please send me the content of the post_text column in the phpbb_posts table for post with ID 14742 in a PM or post it here?

I’m guessing you recently upgraded to phpBB 3.2 and it hasn’t finished converting the old BBCode format to the new one. That’s why it might fail after 2800 posts. If that’s the case, you might want to run the phpBB 3.2+ Text Reparser in a CLI. The import script currently doesn’t support mixing old and new storage formats for BBCodes and the BBCode to Markdown conversion should work a lot better with the new format. :wink:

4 Likes

No, the migration does not halt. The script runs until it regular ends. It only does not migrate a lot of posts. In this case I got the messages like above. I checked a view posts in the database I it looks like that these posts are all old ones without XML-Code.

@Helmi: of course I read this. That’s the reason why I used the experimental branch of the code. :wink:

1 Like

Maybe that’s the solution. I will try this first. I realized, that the failed posts are in BBCode and not in the XML-format… So next try to convert after reparse…

2 Likes

sorry, this wasn’t entirely clear to me when reading your post.

@Helmi: no problem. :smiley:

@gerhard: it worked! After converting the posts into the new format, I was able to import the posts. I only got an exception during the import of four posts, but in my case that’s ok.

   35264 / 35281 (100.0%)  [4879 items/min]  Exception while creating post 39353. Skipping.
unknown attribute 'reply_id' for PostReply.
/usr/local/lib/ruby/gems/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_assignment.rb:53:in `_assign_attribute'
/usr/local/lib/ruby/gems/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_assignment.rb:44:in `block in _assign_attributes'
/usr/local/lib/ruby/gems/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_assignment.rb:43:in `each'
/usr/local/lib/ruby/gems/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_assignment.rb:43:in `_assign_attributes'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/attribute_assignment.rb:22:in `_assign_attributes'
/usr/local/lib/ruby/gems/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/core.rb:326:in `initialize'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/inheritance.rb:70:in `new'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/inheritance.rb:70:in `new'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/reflection.rb:158:in `build_association'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/associations/association.rb:325:in `build_record'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/associations/collection_association.rb:108:in `build'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/associations/collection_proxy.rb:316:in `build'
/var/www/discourse/app/models/post.rb:1064:in `create_reply_relationship_with'
/var/www/discourse/app/models/post.rb:750:in `block in save_reply_relationships'
/var/www/discourse/app/models/post.rb:748:in `each'
/var/www/discourse/app/models/post.rb:748:in `save_reply_relationships'
/var/www/discourse/lib/post_creator.rb:187:in `block in create'
/var/www/discourse/lib/post_creator.rb:360:in `block (2 levels) in transaction'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/lib/post_creator.rb:359:in `block in transaction'
/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'
/var/www/discourse/lib/post_creator.rb:358:in `transaction'
/var/www/discourse/lib/post_creator.rb:168:in `create'
/var/www/discourse/script/import_scripts/base.rb:555:in `create_post'
/var/www/discourse/script/import_scripts/base.rb:503:in `block in create_posts'
/usr/local/lib/ruby/gems/2.6.0/gems/rack-mini-profiler-1.1.4/lib/patches/db/mysql2.rb:8:in `each'
/usr/local/lib/ruby/gems/2.6.0/gems/rack-mini-profiler-1.1.4/lib/patches/db/mysql2.rb:8:in `each'
/var/www/discourse/script/import_scripts/base.rb:490:in `create_posts'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:128:in `block in import_posts'
/var/www/discourse/script/import_scripts/base.rb:870:in `block in batches'
/var/www/discourse/script/import_scripts/base.rb:869:in `loop'
/var/www/discourse/script/import_scripts/base.rb:869:in `batches'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:186:in `batches'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:122:in `import_posts'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:33:in `execute'
/var/www/discourse/script/import_scripts/base.rb:47:in `perform'
/var/www/discourse/script/import_scripts/phpbb3/importer.rb:22:in `perform'
script/import_scripts/phpbb3.rb:33:in `<module:PhpBB3>'
script/import_scripts/phpbb3.rb:14:in `<module:ImportScripts>'
script/import_scripts/phpbb3.rb:13:in `<main>'

Thank you for the importer and the great work! :slight_smile:

3 Likes

Hello @gerhard , we are actually using the script in order to import a very old phpBB forum that needs to be save from being deleted… Everything is going quite fine, but at the end the forum faces issues with encoding. Titles and post content are displaying bad encoding.

Forum was in French, and the SQL dump we download form pBB is UTF-8 encoded, what did we miss please ?

Thanks a lot, this work is awesome ! :open_mouth:

It’s possible that there’s an encoding mismatch somewhere… there’s a reason why someone called it MySQL encoding hell.

A long time ago I created a script to fix databases which contain UTF-8 data inside tables with latin1 encoding. Maybe that helps? Otherwise you’ll need to figure this one out by yourself.

3 Likes

Hi @gerhard and thanks for replying. What should be the format of my SQL dump file please ? Actually VS Code says to me that it is UTF-8. So… it should work no ?

That issues of encoding drive me crazy… :frowning:

@gerhard : EDIT : An example of what I have in the dump file below.

#
# phpBB Backup Script
# Dump of tables for phpbb3_
# DATE : 06-04-2020 08:26:04 GMT
#
# Table: phpbb3_posts
DROP TABLE IF EXISTS phpbb3_posts;
CREATE TABLE `phpbb3_posts` (
  `post_id` mediumint(8) unsigned NOT NULL auto_increment,
  `topic_id` mediumint(8) unsigned NOT NULL default '0',
  `forum_id` mediumint(8) unsigned NOT NULL default '0',
  `poster_id` mediumint(8) unsigned NOT NULL default '0',
  `icon_id` mediumint(8) unsigned NOT NULL default '0',
  `poster_ip` varchar(40) collate utf8_bin NOT NULL default '',
  `post_time` int(11) unsigned NOT NULL default '0',
  `post_approved` tinyint(1) unsigned NOT NULL default '1',
  `post_reported` tinyint(1) unsigned NOT NULL default '0',
  `enable_bbcode` tinyint(1) unsigned NOT NULL default '1',
  `enable_smilies` tinyint(1) unsigned NOT NULL default '1',
  `enable_magic_url` tinyint(1) unsigned NOT NULL default '1',
  `enable_sig` tinyint(1) unsigned NOT NULL default '1',
  `post_username` varchar(255) collate utf8_bin NOT NULL default '',
  `post_subject` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL default '',
  `post_text` mediumtext character set utf8 collate utf8_unicode_ci NOT NULL,
  `post_checksum` varchar(32) collate utf8_bin NOT NULL default '',
  `post_attachment` tinyint(1) unsigned NOT NULL default '0',
  `bbcode_bitfield` varchar(255) collate utf8_bin NOT NULL default '',
  `bbcode_uid` varchar(8) collate utf8_bin NOT NULL default '',
  `post_postcount` tinyint(1) unsigned NOT NULL default '1',
  `post_edit_time` int(11) unsigned NOT NULL default '0',
  `post_edit_reason` varchar(255) collate utf8_bin NOT NULL default '',
  `post_edit_user` mediumint(8) unsigned NOT NULL default '0',
  `post_edit_count` smallint(4) unsigned NOT NULL default '0',
  `post_edit_locked` tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (`post_id`),
  KEY `forum_id` (`forum_id`),
  KEY `topic_id` (`topic_id`),
  KEY `poster_ip` (`poster_ip`),
  KEY `poster_id` (`poster_id`),
  KEY `post_approved` (`post_approved`),
  KEY `tid_post_time` (`topic_id`,`post_time`),
  KEY `post_username` (`post_username`)
) ENGINE=MyISAM AUTO_INCREMENT=33585 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

INSERT INTO phpbb3_posts (post_id, topic_id, forum_id, poster_id, icon_id, poster_ip, post_time, post_approved, post_reported, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, post_username, post_subject, post_text, post_checksum, post_attachment, bbcode_bitfield, bbcode_uid, post_postcount, post_edit_time, post_edit_reason, post_edit_user, post_edit_count, post_edit_locked) VALUES (3, 2, 1, 2, 0, '82.225.50.160', 1135852994, 1, 0, 1, 1, 1, 0, '', 'FORUM EFFACER PAR UN HACKER - Le 28/12/05 !!!', 'Le 28/12/05, le forum a été victime <!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very sad\" /><!-- s:cry: --> de la visite d\'un hacker <!-- s:pan --><img src=\"{SMILIES_PATH}/panpan.gif\" alt=\":pan\" title=\"panpan\" /><!-- s:pan --> peut scrupuleux <!-- s:sick --><img src=\"{SMILIES_PATH}/sick.gif\" alt=\":sick\" title=\"sick\" /><!-- s:sick --> : celui-ci après avoir trouvé le moyen de se connecter au Forum en tant qu?Administrateur du forum a tout simplement supprimé la totalité de nos messages <!-- s:evil: --><img src=\"{SMILIES_PATH}/icon_evil.gif\" alt=\":evil:\" title=\"Evil or Very Mad\" /><!-- s:evil: --> !!! \r\n\r\nMalheureusement et je m\'en excuse <!-- s:oops: --><img src=\"{SMILIES_PATH}/icon_redface.gif\" alt=\":oops:\" title=\"Embarassed\" /><!-- s:oops: -->  (j\'aurai du y penser!!!) aucune sauvegarde du site n\'existait et je n\'ai pu récupérer aucun des anciens messages !!!\r\n\r\n[b:f3vjqlv5]C EST A  NOUS MAINTENANT QU IL APPARTIENT DE FAIRE RENAITRE CE FORUM ET DE MONTRER QUE CE N EST PAS CE GENRE DE TERRORISME QUI EMPECHERA LE DUB ET LES SOUNDS SYSTEM DE PROGRESSER !!![/b:f3vjqlv5]:thumb \r\n\r\nPerdu pour perdu : n\'ayant pu récupérer les messages, j\'ai préféré tout effacer et installer la dernière version logiciel du forum qui corrige un certain nombre de failles de sécurité. Du coup [b:f3vjqlv5]LES ANCIENS MEMBRES DOIVENT CE RE-ENGERISTRER...[/b:f3vjqlv5]\r\n\r\nRespect to All\r\nRed Lion', '', 0, 'QA==', 'f3vjqlv5', 1, 0, '', 2, 0, 0),(5, 3, 4, 3, 0, '82.225.50.160', 1135856969, 1, 0, 1, 1, 1, 1, '', 'DUB FACTORY RED LION SOUND meets IRATION STEPPAS 21/01/06', 'Salut à tous,\r\n\r\nUne grosse soirée Roots Dub &amp; Steppa en soutien au Festival du col des 1000 de l\'association L\'anamounto\r\n\r\nRED LION Sound  accueillent les géants de Leeds:\r\n\r\nIRATION STEPPAS pour une session 100% heavy weight bass....\r\n\r\nBeware!!!\r\n\r\nCa se passe le 21 Janvier à l\'ADAEP à Grenoble...Paf 10euro 22H&gt;&gt;5H\r\n+ d\'infos soon come,\r\nd\'ici là vous pouvez tjrs écouter des extraits de la soirée qui avait lieu à Chalon-s/Saone l\'année dernière:\r\n\r\n<!-- m --><a class=\"postlink\" href=\"http://dubnews.free.fr/iration/irationmix.html\">http://dubnews.free.fr/iration/irationmix.html</a><!-- m -->\r\n\r\na+steph\r\nLions\'Den', '', 0, 'QA==', '2vvambac', 1, 0, '', 3, 0, 0),(6, 2, 1, 5, 0, '172.206.42.240', 1135857292, 1, 0, 1, 1, 1, 1, '', '', 'Aller Hop au boulot !!!\r\n\r\nLion à raison, faut pas perdre espoir et surtout ne pas laisser tomber se forum sous pretexte qu\'il n\'y as plus d\'information, l\'information c\'est nous tous ! \r\n\r\nUnity Again !!! \r\n\r\nRespect To RedLion Crew\r\nBless\r\nBokson', '', 0, 'QA==', '185llc4j', 1, 0, '', 5, 0, 0),(7, 2, 1, 4, 0, '81.56.248.144', 1135857298, 1, 0, 1, 1, 1, 0, '', '', 'misère.... sans deconner......\r\nfaut croire que ça occupe certains de faire chier les autres sans aucun interet....\r\nbon.......\r\nfaudrait pas en plus s\'énerver ni gueuler contre ce hacker, ça risquerait de lui faire plaisir......\r\n\r\nvoilà, je suis réenregistré\r\n\r\nrespects,\r\nmathieu', '', 0, 'QA==', '3ra8xkgy', 1, 0, '', 4, 0, 0),(8, 4, 11, 5, 0, '172.206.42.240', 1135857735, 1, 0, 1, 1, 1, 1, '', 'Relation Amplificateur - Enceintes', 'Irie \r\n\r\nVu qu\'on s\'est fait hacker je repose ma question ! \r\nComment calculer cette histoire d\'impédance ! \r\nSi on bridge l\'ampli, si on l\'utilise en stereo etc... \r\nEt je repose la question, j\'ai 2 enceinte bass reflex 750watts sous 8ohms\r\nmon amplis derrière 2x700 watts sous 8ohms (par exemple) si je le bridge et que j\'arrive a sortir 1x1400 watts que je balance sur 2 caissons vu que je l\'ai bridger il passe en 4ohms mon amplis, donc il faut que les bafles le suporte dérrière mais malheureusement dnas les carastéristique des baffles, il ne suporte pas une impédance de mois 4.75 ohms \r\n\r\nCOmment je fait tu peux expliquet un peu plus lion, se que tu avait commencer (avant le passage du hackers furieux) \r\nEn plus tu me l\'a déja expliquer mais j\'ai un pue zapper des trucs !!!\r\n\r\nThanks\r\nBokson', '', 0, 'QA==', '3bec5jss', 1, 0, '', 5, 0, 0),(9, 5, 3, 5, 0, '172.206.42.240', 1135857870, 1, 0, 1, 1, 1, 1, '', 'Pk l\'homme détruit !', 'Tena y Stellin \r\n\r\nUne question me traverse l\'esprit, je ne peux y répondre seul je crois car trop vaste peut être la réponse ! \r\n\r\nPourquoi les hommes détruise, se que l\'autre à crée ? \r\n\r\nJalousie, frustrations .... Je sais pas j\'arive pas a comprendre.\r\n\r\nBokson', '', 0, 'QA==', '34xwhk4b', 1, 0, '', 5, 0, 0),(10, 2, 1, 6, 0, '82.64.69.118', 1135859358, 1, 0, 1, 1, 1, 1, '', '', 'Bon, on repars à Zéro, c\'est pas une si mauvaise chose <!-- s:) --><img src=\"{SMILIES_PATH}/icon_smile.gif\" alt=\":)\" title=\"Smile\" /><!-- s:) -->\r\n\r\nBig Up !!\r\n\r\n\r\nNao\r\nGuidance,,,,', '', 0, 'QA==', '143421z7', 1, 0, '', 6, 0, 0),(11, 2, 1, 7, 0, '212.147.0.191', 1135861490, 1, 0, 1, 1, 1, 0, '', '', 'Yes content de revoir le forum UP!  <!-- s:) --><img src=\"{SMILIES_PATH}/icon_smile.gif\" alt=\":)\" title=\"Smile\" /><!-- s:) --> \r\n\r\nLongue vie a ce forum très instructif ! \r\n\r\nEach one teach one !\r\n\r\nJ-M', '', 0, 'QA==', '3gohbqv1', 1, 0, '', 7, 0, 0),(12, 2, 1, 8, 0, '82.235.34.36', 1135864108, 1, 0, 1, 1, 1, 0, '', 'ça roule!!', 'Content de voir que vous avez vite resolu le problem!\r\nRespect a toute la bande...\r\na bientot\r\nmanu', '', 0, 'QA==', '3oql1d2j', 1, 0, '', 8, 0, 0),(13, 6, 4, 8, 0, '82.235.34.36', 1135865115, 1, 0, 1, 1, 1, 0, '', 'Dub Addict Sound meets Jr CONY &amp; SHANTI D. 3/02/06', 'Une semaine apres Red Lion et Iration, vous pouvez\r\nvous remettre une couche de bass au RAIL theatre à LYON..\r\non accueil JUNIOR CONY &amp; Shant D...\r\nBoudou et Roots massacre feront leur live, 19Dub a la selection\r\net Phil au chant.\r\nde 21h a 3 h pour 7Eureu\r\n\r\ntchao a tous...', '', 0, 'QA==', '1y0bfm7j', 1, 0, '', 8, 0, 0),(14, 7, 4, 9, 0, '83.156.49.183', 1135865763, 1, 0, 1, 1, 1, 1, '', 'BORDEAUX:Manasseh,Manutension,Iration Steppas &amp; Uzinadub', 'Le 4SANS a Bordeaux présente a partire de 22h 8) :\r\n\r\nLE 21 Janvier <!-- s:hola --><img src=\"{SMILIES_PATH}/fun_59.gif\" alt=\":hola\" title=\"hola\" /><!-- s:hola --> \r\n\r\nMANASSEH feat Brother Culture\r\nMANUTENSION feat MC Tablloyd\r\nCRYSTAL DISTORSION\r\n\r\npour 10euros\r\n\r\n\r\nLE 25 Fevrier <!-- s:hola --><img src=\"{SMILIES_PATH}/fun_59.gif\" alt=\":hola\" title=\"hola\" /><!-- s:hola --> \r\n\r\nIRATION STEPPAS\r\nUZINADUB\r\nGG PROJECT\r\nELISA DO BRASIL\r\n\r\nPour 10euros\r\n\r\nDonc 2 bonne soirées sur Bordeaux pour le début d année 2006 <!-- s:bravo --><img src=\"{SMILIES_PATH}/bravoo.gif\" alt=\":bravo\" title=\"bravo\" /><!-- s:bravo -->', '', 0, 'QA==', '319buiqc', 1, 0, '', 9, 0, 0),(15, 6, 4, 3, 0, '82.225.50.160', 1135865811, 1, 0, 1, 1, 1, 1, '', '', 'et le lendemain  DUB FACTORY N°2 le samedi 4 fevrier de 21H&gt;&gt;5H\r\n\r\n[b:2d4j075e][color=red:2d4j075e]RED LION SOUND feat Sis ilie Meets JAH FREE Feat GARY JAMES[/b:2d4j075e][/color:2d4j075e]\r\n\r\nPaf 10euro\r\nStand Disques UK Dub\r\na+steph', '', 0, 'Qg==', '2d4j075e', 1, 0, '', 3, 0, 0),(16, 6, 4, 9, 0, '83.156.49.183', 1135865981, 1, 0, 1, 1, 1, 1, '', '', 'Sa gère cette soirée avec JAH FREE et RED LION!!!!!!!!!!!! <!-- s:wink: --><img src=\"{SMILIES_PATH}/icon_wink.gif\" alt=\":wink:\" title=\"Wink\" /><!-- s:wink: -->', '', 0, 'Qg==', 'sirogssh', 1, 0, '', 9, 0, 0),(17, 4, 11, 2, 0, '82.225.50.160', 1135866119, 1, 0, 1, 1, 1, 0, '', 'Série et parrallèle', 'Yes Bokson, on va régler cette histoire d?impédance :\r\n\r\nL?impédance étant la résistance (entre autre?) d?un circuit ou d?un composant, il faut te representer ton HP comme une résistance que l?on branche dans un circuit avec la sortie de l?amplis. C?est la totalité de la résistance de se circuit (avec une ou plusieurs résistance branchées entre elle) qui va déterminer la résistance SOUS LAQUELLE va fonctionnée ton amplis.\r\n\r\nPrenons l?exemple de ton amplis : \r\nCaractéristiques  techniques :\r\n750 watts sous 8ohms x 2 (2 canaux)\r\n1400 watts sous 8ohms x 1 (sortie bridgé)\r\n\r\nJe branche 1 HP de 750 watt sous 8 ohms sur un des 2 canaux (mode non bridgé) et tout va bien?\r\nJ?ajoute un 2e HP de 750/8. j?ai 2 solutions : \r\n\r\nSoit je branche le 2e HP sur le 2e canal de l?amplis et j?ai donc 2 HP de 750 W/ 8 Ohms branché sur 2 canaux de 700 W / 8 Ohms\r\n\r\nSoit je décide 	de mettre les 2 HP en série ou en parallèle :\r\n\r\n[b:1ms11ykd] En série :\nquand on branche plusieurs HP en série leur impédance Z d?additionnent[/b:1ms11ykd] ce qui donne : \r\n\r\n[b:1ms11ykd]Zt (sortie ampli) =  Z (hp1) + Z (hp2) + ?[/b:1ms11ykd]\r\n \r\nsoit pour notre exmple :\r\n8 Ohms +  8 Ohms =  16 Ohms \r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W = 1500 W sous 16 Ohms sur un seul canal (si on branche les 2 HP en série et sur un seul canal de l?amplis)\r\n\r\n[b:1ms11ykd] En parralèle :\nquand on branche plusieurs HP en parralèle l?inverse de leur impedance s?additionnent [/b:1ms11ykd] ce qui donnent :\r\n\r\n[b:1ms11ykd]1/Zt = 1/Z (hp1) + 1/Z (hp2) + ?[/b:1ms11ykd]\r\n\r\nsoit dans notre exemple :\r\n1/8 + 1/8 = 2/8  donc Zt= 8/2=4 Ohms\r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W = 1500 W sous 4 Ohms sur un seul canal \r\n(si on branche les 2 HP en parallèle et sur un seul canal de l?amplis)\r\n\r\n\r\nEt si [b:1ms11ykd]je decide de mettre 4 HP sur meme le canal (circuit)[/b:1ms11ykd] j?aurai :\r\n\r\n[b:1ms11ykd]Si tout les HP sont en série :\n\n8 Ohms +  8 Ohms + 8 Ohms +  8 Ohms = 32 Ohms[/b:1ms11ykd]\r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W + 750W + 750W = 3000 W sous 32 Ohms sur un seul canal\r\n \r\n[b:1ms11ykd]Si tout les HP sont en parralèle :\n1/Zt= 1/8+1/8+1/8+1/8= 4/8 Zt=8/4=2 Ohms[/b:1ms11ykd]\r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W + 750W + 750W = 3000 W sous 2 Ohms sur un seul canal\r\n\r\n[b:1ms11ykd]Si 2 x 2 HP couplé en serie sont montés en parralèle :\n1/Zt = 1/(8+8)+1/(8+8)=1/16+1/16= 2/16 Zt = 16/2=8 Ohms[/b:1ms11ykd]\r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W + 750W + 750W = 3000 W sous 8 Ohms sur un seul canal\r\n\r\n[b:1ms11ykd]Pour 2 x 2 HP couplé en parrallèle sont montés en série :\nZt=(1/(1/8+1/8))+(1/(1/8+1/8)=1/(2/8)+1/(2/8)=4+4=8 Ohms[/b:1ms11ykd]\r\n\r\ndonc dans ce cas pour fonctionner correctement ton amplis devra etre capable de fournir 750W + 750W + 750W + 750W = 3000 W sous 8 Ohms sur un seul canal\r\n\r\nPour le cas ou tu as 6 HP je te laisse faire le calcul.\r\n\r\nAprès au niveau te ton amplis tu n\'as aucun réglage a faire (c\'est comment tu vas brancher tes enceintes entre elles qui va faire que ton amplis tournera sous tel ou tel impedance) tu as juste a vérifié dans les spécifications techniques quelles sont les impedances qu\'il peut supporter (et pas la meme occasion quelle puissance il peut délivrer sous chaque impedance)...\r\n\r\nRespect\r\nRed Lion', '', 0, 'QA==', '1ms11ykd', 1, 1136464838, '', 2, 1, 0),(18, 8, 4, 3, 0, '82.225.50.160', 1135866440, 1, 0, 1, 1, 1, 1, '', 'DUB FACTORY 2: RED LION SOUND Meets JAH FREE feat GARY JAMES', '[b:79akxjmn][size=150:79akxjmn]DUB FACTORY N°2 le samedi 4 fevrier de 21H&gt;&gt;5H[/size:79akxjmn][/b:79akxjmn]\r\n\r\n<!-- s:hola --><img src=\"{SMILIES_PATH}/fun_59.gif\" alt=\":hola\" title=\"hola\" /><!-- s:hola --> <!-- s:hola --><img src=\"{SMILIES_PATH}/fun_59.gif\" alt=\":hola\" title=\"hola\" /><!-- s:hola --> <!-- s:hola --><img src=\"{SMILIES_PATH}/fun_59.gif\" alt=\":hola\" title=\"hola\" /><!-- s:hola -->\r\n[b:79akxjmn][color=red:79akxjmn][size=167:79akxjmn]RED LION SOUND feat

...
...
2 Likes

A recent vBulletin import that I did seemed I have different encoding in different posts. I wrote some code that tried multiple encoding coercions.

1 Like

@gerhard : Could I acheive the sanitizing of bad characters encoding after the migration by using the Sidekiq ? I am really new to Discourse to I may not understand of it works.
Or maybe a SQL script directly into the MariaDB ?

Thanks a lot !

Sure! You could also just edit each post by hand. It’s on the order of 10X easier to do it before hand when it’s possible to just start over again.

I tried a bunch of stuff to try to fix up the encoding on the mariadb side, but didn’t come up with a solution. Here’s some code that I used to fix up the encoding on an import that I’m working on.

    ### WIN1252 encoding
    win_encoded = ''
    begin
      win_encoded = raw.force_encoding('utf-8').encode("Windows-1252",
                            invalid: :replace, undef: :replace, replace: ""
                           ).force_encoding('utf-8').scrub
    rescue => e
      puts "\n#{'-'*50}\nWin1252 failed for \n\n#{raw}\n\n"
      win_encoded = ''
    end
1 Like

nice thanks :slight_smile:

1 Like

It was a painful experience. I tried multiple encodings and included multiple ones in the post so that I could compare them. This one seemed to solve most problems most of the time. It took me much longer than I’d have liked to figure out .scrub, as without it I’d end up with strings that could no longer be parsed with gsub.

Does anyone yet have a good solution to import nested lists from phpBB?

I’m not enough of a ruby guy to know how to approach it – sitting over this

 def process_lists(text)
      # convert list tags to ul and list=1 tags to ol
      # list=a is not supported, so handle it like list=1
      # list=9 and list=x have the same result as list=1 and list=a
      text.gsub!(/\[list\](.*?)\[\/list:u\]/mi) do
        $1.gsub(/\[\*\](.*?)\[\/\*(:m)?\]\n*/mi) { "* #{$1}\n" }
      end
      text.gsub!(/\[list=.*?\](.*?)\[\/list:o\]/mi) do
        $1.gsub(/\[\*\](.*?)\[\/\*(:m)?\]\n*/mi) { "1. #{$1}\n" }
      end
    end

Does anyone have an idea how “looping” over a nested list could look like?

Here’s a bbcode example

[list]
   [*]
   [list=a]
      [*]a
      [*]b
      [*]c
      [*]d
      [*]e
   [/list]
   [*]outer list
[/list]
1 Like

@helmi

Have you looked at how this official discourse plugin could help you with LIST tags?

1 Like