Importing from phpBB3

import

(Gerhard Schlager) #214

I’d say you messed something up. :wink:

https://meta.discourse.org/search?q=error%20502


(Todd Taylor) #215

well it seems after rebuilding app, that things are at least working now. However, I’ve got some users to test this and they can’t login with their old passwords…the first one to test had a password less than 10 characters, so he reset the password and it works

I then changed the password min length to 8, and saved. the 2nd testing user has an 8 character password, but he isn’t able to login. From the first reply, it looked like the import moved all the old passwords from phpbb3 over. Is that not the case? How can I check the DB if the passwords exist?


(Jay Pfaffman) #216

I’m pretty sure (but haven’t looked at the code) that password lengths are enforced when creating them, not checking them (one reason not to import passwords :slight_smile:).

Did you install the plugin?


(Gerhard Schlager) #217

That’s right, but the plugin sets the user’s password during login when it matches the imported password hash. :wink: So, in this case the password policy gets checked during login.

You find the imported password hashes in the `` table. You’d need to debug the plugin in order to find the reason why the password isn’t accepted. My guess, if it isn’t password length: The user has a password that is on the list of common passwords. See: 4.7 Why can’t my users login with their old passwords?


(Todd Taylor) #218

I didn’t install any plugins unfortunately…it looked like that plugin was supported in the core importer. How can I install the plugin and reimport everything?

Again…sorry for the lame questions…completely new to this


(Jay Pfaffman) #219

If you told the importer to import passwords, you just need to install the plugin that I linked to.


(Todd Taylor) #220

I did try installing the plugin, using: bundle exec rake plugin:install repo=http://github.com/discoursehosting/discourse-migratepassword

but I’m getting “Could not locate Gemfile”


(Gerhard Schlager) #221

The information you are looking for is all there in the first post of this topic. :wink:


(Jay Pfaffman) #222

That’s very cool indeed. Nice work, @michaeld!


#223

Hi, thanks for this.
I have imported successfully from PHPB 3.0.11 but see a large number of users who have been duplicated with a suffix ‘1’ to the original user id and with an invalid email like anonymous_abaa6b41b52c12208a5sfsfdsdfsdfaaee6@no-email.invalid

Based on some digging around, I found the definition of an anonymous user is whoever has a post - is this correct?

Tried running an import with a change to ‘=’ in script/import_scripts/phpbb3/database/database_3_0.rb
@@ -32,7 +32,7 @@ def count_anonymous_users
count(<<-SQL)
SELECT COUNT(DISTINCT post_username) AS count
FROM #{@table_prefix}posts
- WHERE post_username <> ‘’
+ WHERE post_username = ''
SQL
end

@@ -43,6 +43,7 @@ def fetch_anonymous_users(last_username)
         SELECT post_username, MIN(post_time) AS first_post_time
         FROM #{@table_prefix}posts
         WHERE post_username > '#{last_username}'
+        AND post_username = ''
         GROUP BY post_username
         ORDER BY post_username
         LIMIT #{@batch_size}

Edit:
This change prevents duplicate account creation. However all posts now are attributed to system and none to users. So this does not fix the issue.

Appreciate guidance please.


(Gerhard Schlager) #224

Normally the post_username in the phpbb_post is empty unless the post was created by an anonymous user. In your case it looks like this column has always (?) a value which results in duplicate users. Did you migrate your forum from a different forum software in the past?

The simplest solution would be to remove the post_username from posts created by normal users. This untested SQL should do the trick:

UPDATE phpbb_posts p
SET post_username = ''
WHERE EXISTS (
        SELECT 1
        FROM phpbb_users u
        WHERE p.poster_id = u.user_id AND u.user_type <> 2
    );

#225

@gerhard
You live up to your title ‘Great contributor’; thank you!

Cleanup with your sql helps - no more duplication of existing users.

You are very correct - I am migrating from SMF -> PHPBB -> Discourse
I am facing an issue with direct conversion from SMF with message “undefined method `persisted?’ for nil:NilClass” : Importer for Simple Machines 2 forums
This doesn’t let my attachments imported and I think personal messages are anyway not part of the SMF conversion script.

I am only unsure if going the phpBB route may not create good redirects from SMF. Any thoughts on the downsides of this approach please?

Thanks.


(Gerhard Schlager) #226

Thanks for the compliment! :slight_smile:

Unfortunately I’m not familiar with SMF and its URL structure. So, you’ll have to figure this out for yourself.
But here are a few tips:

  • In order to create permalinks that redirect your old SMF URLs to the new Discourse URLs you’ll need to change the PermalinkImporter. Redirects for the phpBB specific URLs won’t do you any good.
  • Make sure that the import from SMF to phpBB stores all the information needed to create permalinks. E.g. mapping of topic and post IDs in SMF to the corresponding IDs in phpBB.

#227

@gerhard
I am close to completing my transition using your phpbb importer due the issues noted with the SMF importer. The additional advantage is the import of PMs, other than importing images correctly.

On permalinks, I realized it is not a huge issue since I am moving to a different subdomain with discourse. I had to write a few redirects and a couple of rewrite rules in the apache htaccess on the old subdomain and that takes care of all the redirection.

Thanks again for the importer and for your support.


(Etienneburdet) #228

Same problem here… except I don’t really understand how you fixed it. The import is breaking at categories import. After that, the catégories are effective, but there’s nothing in it (since it broke…).

After digging a bit it seems that the fact we have many «archive» sub-(sub)-categories (don’t ask…). I have nothing against scrapping them all actually, either by skipping their entire content or by making the topic unclassified.

Any idea where I should start ? Thanks !

P.S : awesome work with this plugin and tutorial !


(Etienneburdet) #229

Ok so I spotted the problem : I had multiples level3/4 (sub-sub-sub) subcategories with the same name, which were imported as level1 (normal) subcategories.

I solved the problem by just renaming them, and the import launches normally. Still a slight bug in the importer. Maybe it doesn’t check for duplicates in deeper levels subcategories ?


(Jay Pfaffman) #230

Fixing the database before import is generally the way to solve such problems.

I suspect if you submitted a PR that solved the problem it’d be accepted, but since you’ve already solved your problem, you’re probably not going to be the one to do it. :slight_smile:


(Gerhard Schlager) #231

Oh, yeah, that could be the cause of those import errors. I’ll fix it in the next few days. Thanks for reporting this!


(Todd Taylor) #232

Hi again…

I’ve started again with a fresh import to fix my password problems, and now I’m getting this error when running the import script. Any idea what is causing this, and/or how to fix it?:

creating topics and posts
Skipping 1000 already imported posts
Skipping 1000 already imported posts
Skipping 1000 already imported posts
Skipping 1000 already imported posts
Skipping 1000 already imported posts
5061 / 37159 ( 13.6%) [1172758 items/min] /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:50:in gsub!': invalid byte sequence in UTF-8 (ArgumentError) from /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:50:inclean_bbcodes’
from /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:21:in process_raw_text' from /var/www/discourse/script/import_scripts/phpbb3/support/text_processor.rb:33:inprocess_post’
from /var/www/discourse/script/import_scripts/phpbb3/importers/post_importer.rb:33:in map_post' from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:138:inblock (2 levels) in import_posts’
from /var/www/discourse/script/import_scripts/base.rb:432:in block in create_posts' from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-0.10.5/lib/patches/db/mysql2.rb:6:ineach’
from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-0.10.5/lib/patches/db/mysql2.rb:6:in each' from /var/www/discourse/script/import_scripts/base.rb:431:increate_posts’
from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:137:in block in import_posts' from /var/www/discourse/script/import_scripts/base.rb:784:inblock in batches’
from /var/www/discourse/script/import_scripts/base.rb:783:in loop' from /var/www/discourse/script/import_scripts/base.rb:783:inbatches’
from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:187:in batches' from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:131:inimport_posts’
from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:31:in execute' from /var/www/discourse/script/import_scripts/base.rb:45:inperform’
from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:20:in perform' from script/import_scripts/phpbb3.rb:31:inmodule:PhpBB3
from script/import_scripts/phpbb3.rb:12:in <module:ImportScripts>' from script/import_scripts/phpbb3.rb:11:in


(Jay Pfaffman) #233

I think it means that the message has some stuff in it that’s not UTF-8.