نقل منتدى phpBB3 إلى Discourse

I had this same error. I believe it happens when one gets a stale shared/standalone/import/mysql/imported file. Deleting that file cleared the error.

إعجابَين (2)

Migrating passwords apparently didn’t work for me.

I set passwords: true in shared/standalone/import/settings.yml before importing from a phpbb 3.0 dump. I have this in containers/app.yml

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discoursehosting/discourse-migratepassword.git

and I ran ./launcher rebuild app after the import. The import seems to have worked entirely, except that I cannot log in with my password from phpbb. There weren’t any relevant error messages that I spotted from the import, and the password is 20 characters long, so should clear the minimum length limit.

What should I be looking for to troubleshoot this?

A bit more information: I see import_pass entries in the user_custom_fields table of the database that match password hashes that were in the phpbb database, so that part seems to have worked?

Edit: Oh ho, I figured out what happened. I had completely forgotten that we had switched to LDAP authentication for phpbb… The passwords I imported were totally fine, just 15 years old! So now I need to knock something together to extract the password hashes from LDAP instead… :slight_smile:

إعجاب واحد (1)

Hi everyone,

Did someone made an import with attachment recently?

The users, posts work perfectly but the attachment don’t get added to the posts

I still have the bbcode in some posts

attachment

The weird thinh is that the content of the files folder get transferred in the discourse’s uploads folder

First, I though it was because the 3.0.12 phpbb’s version was too old but I upgraded phpBB to 3.0.14, cleaned Discourse and uploads folder, and tried the import again. No luck.

I upgraded the phpbb version to 3.2.0 (after running their support toolkit to clean the database of the mods) on a test server, still no luck.

Before investigating further on my database, I wanted to be sure that the script works for everyone

I don’t think I’ve made a mistake on my settings file, but maybe a fresh look on this might help

# This is an example settings file for the phpBB3 importer.

database:
  type: MySQL # currently only MySQL is supported
  host: localhost
  port: 3306
  username: root
  password:
  schema: phpbb
  table_prefix: phpbb_ # Change this, if your forum is using a different prefix. Usually all table names start with phpbb_
  batch_size: 1000 # Don't change this unless you know what you're doing. The default (1000) should work just fine.

import:
  # Set this if you import multiple phpBB forums into a single Discourse forum.
  #
  # For example, when importing multiple sites, prefix all imported IDs
  # with 'first' to avoid conflicts. Subsequent import runs must have a
  # different 'site_name'.
  #
  # site_name: first
  #
  site_name:

  # Create new categories
  #
  # For example, to create a parent category and a subcategory.
  #
  # new_categories:
  # - forum_id: foo
  #   name: Foo Category
  # - forum_id: bar
  #   name: Bar Category
  #   parent_id: foo
  #
  new_categories: []

  # Category mappings
  #
  # For example, topics from phpBB category 1 and 2 will be imported
  # in the new "Foo Category" category, topics from phpBB category 3
  # will be imported in subcategory "Bar category", topics from phpBB
  # category 4 will be merged into category 5 and category 6 will be
  # skipped.
  #
  # category_mappings:
  #   1: foo
  #   2: foo
  #   3: bar
  #   4: 5
  #   6: SKIP
  #
  category_mappings: {}

  # Tag mappings
  #
  # For example, imported topics from phpBB category 1 will be tagged
  # with 'first-category', etc.
  #
  # tag_mappings:
  #   1:
  #   - first-category
  #   2:
  #   - second-category
  #   3:
  #   - third-category
  #
  tag_mappings:

  # Rank to trust level mapping
  #
  # Map phpBB 3.x rank levels to trust level
  # Users with rank at least 3000 will have TL3, etc.
  #
  # rank_mapping:
  #   trust_level_1: 200
  #   trust_level_2: 1000
  #   trust_level_3: 3000
  #
  rank_mapping:

  # WARNING: Do not activate this option unless you know what you are doing.
  # It will probably break the BBCode to Markdown conversion and slows down your import.
  use_bbcode_to_md: false

  # This is the path to the root directory of your current phpBB installation (or a copy of it).
  # The importer expects to find the /files and /images directories within the base directory.
  # You need to change this to something like /var/www/phpbb if you are not using the Docker based importer.
  # This is only needed if you want to import avatars, attachments or custom smilies.
  phpbb_base_dir: /shared/import/data

  site_prefix:
    # this is needed for rewriting internal links in posts
    original: ***.com   # without http(s)://
    new: https://****.org       # with http:// or https://

  # Enable this, if you want to redirect old forum links to the the new locations.
  permalinks:
    categories: true  # redirects   /viewforum.php?f=1            to  /c/category-name
    topics: true      # redirects   /viewtopic.php?f=6&t=43       to  /t/topic-name/81
    posts: false      # redirects   /viewtopic.php?p=2455#p2455   to  /t/topic-name/81/4
    # Append a prefix to each type of link, e.g. 'forum' to redirect /forum/viewtopic.php?f=6&t=43 to /t/topic-name/81
    # Leave it empty if your forum wasn't installed in a subfolder.
    prefix:

  avatars:
    uploaded: true  # import uploaded avatars
    gallery: false   # import the predefined avatars phpBB offers
    remote: false   # WARNING: This can considerably slow down your import. It will try to download remote avatars.

  # When true: Anonymous users are imported as suspended users. They can't login and have no email address.
  # When false: The system user will be used for all anonymous users.
  anonymous_users: true

  # Enable this, if you want import password hashes in order to use the "migratepassword" plugin.
  # This will allow users to login with their current password.
  # The plugin is available at: https://github.com/discoursehosting/discourse-migratepassword
  passwords: false

  # By default all the following things get imported. You can disable them by setting them to false.
  bookmarks: true
  attachments: true
  private_messages: false
  polls: false

  # When true: each imported user will have the original username from phpBB as its name
  # When false: the name of each imported user will be blank unless the username was changed during import
  username_as_name: false

  # Map Emojis to smilies used in phpBB. Most of the default smilies already have a mapping, but you can override
  # the mappings here, if you don't like some of them.
  # The mapping syntax is: emoji_name: 'smiley_in_phpbb'
  # Or map multiple smilies to one Emoji: emoji_name: ['smiley1', 'smiley2']
  emojis:
    # here are two example mappings...
    smiley: [':D', ':-D', ':grin:']
    heart: ':love:'
إعجاب واحد (1)

This specifically happens if import_phpbb3.sh doesn’t find the phpbb_mysql.sql file in the correct path.

إعجاب واحد (1)

I presume this applies to phpBB too, as I’m trying to import dumps ranging from v3.2.x to v3.3.3 but missing parent posts are in the thousands. Even with multiple runs and multiple sequential version backups. For debug simplicity the script could output the url for the message ID to the old forum for reference checking. (… viewtopic.php?p=57912)

إعجاب واحد (1)

Actually since we’re at this, why not log all failed import rows with their error messages in a dump file to share for analysis… just a thought…

At least one occasion is where there is a topic viewtopic.php?f=3&t=1472 but the first post viewtopic.php?p=145185 has been deleted/removed/etc and now the first post for the topic is viewtopic.php?p=145186 which is “a reply”

Maybe for clarity actually state whether the parent topic is literally not found in the dump or just haven’t been imported to the reconstruction.

إعجاب واحد (1)

I’d still take a little feedback to know if everyone managed to do a full import with attachments recently. I can’t make this work.

Right now, I just don’t know if it comes from the script or the database from the phpbb forum :pray:

إعجاب واحد (1)

Did you download the images and put them in the right place?

I’ve not don’t it lately, but I’d be surprised if it doesn’t work.

إعجاب واحد (1)

Yes I double checked the folders and the settings file, the weird thing is that they are getting imported in the default/original folders, but not integrated in the posts.

It was a really old phpbb, with some plugins. I did a little cleanup and successfully upgraded from phpbb 3.0.12 to the latest 3.1 or 3.2, tested an import for each version, but it didn’t work. It may be an issue with the database. That’s why, if you manage to succeed in a full import next time, that would be helpful to hear from you. If it’s the database from phpbb, I’ll do some heavy digging with some help, if it’s the script, I can wait. Thanks for your message!

إعجاب واحد (1)

I don’t remember the last time I did a phpBB3 import, I suspect (but have no way of knowing) because the script works so well.

Since they are getting uploaded to discourse the issue is likely how they are referred to in the posts in phpbb. Do you see any errors when it runs? They could offer hints. Or maybe the plugins changed how they are in the posts and /or database. You’ll probably have to do some digging.

إعجابَين (2)

I had a few “missing files”, “bad post time”, I had these during my previous imports so I don’t think it’s a big issue. I also have a lot of “Parent post doesn’t exist” on the first run, but it was mentionned earlier in this thread, and a second run of the script fix this.

Other than that, the script ran pretty good, without any major issue.

There was a plugin (mostly a htaccess file apparently, I didn’t run this forum) to arrange the files in subfolders (per months and year), but I organized it on the same folder and the upgrades on a clean version of phpbb worked fine. All the imported files were active on a phpbb 3.1, 3.2.

I’ll dig a little bit deeper on the database, I might have a sql file from an old import. I’ll compare the attachments and posts tables on my test server. Maybe there’s a thing I missed.

4 إعجابات

You’re correct, there has been a bug in TextProcessor::process_attachments that causes attachments to not get embedded in the post Markdown. I’ve filed a PR.

5 إعجابات

Great job, after the two passes, the import looks great. Thanks!

4 إعجابات

Hi, I just imported about 35k posts; during import I noticed a lot of “Parent post XXXXXX doesn’t exist. Skipping”, and when process ended, in the Discourse forum I had all (I think) the “topics”, but with no answer at all. Practically, it imported just the topic, not the posts (except for the first one with the text of the topic itself).
Also, no avatar was imported, event though I put them in the correct tree under “import” folder.

The original forum was in phpBB2, regularly imported and visible with all its posts in phpBB3, but I deleted many old messages previously; however, all seems ok in phpBB3.

Any suggestion? Is there some import script I can check?

إعجاب واحد (1)

It’s been like that since a few weeks/months, but don’t worry, the import will be completed after running the import_phpbb3.sh command again

3 إعجابات

Thanks a lot! It worked for the posts, not for avatars. I continue looking for a fix.

إعجاب واحد (1)

لقد قرأت الموضوع عدة مرات وأجريت بعض عمليات الترحيل، ولكن في كل مرة كنت مرتبكًا بشأن هذه الإضافة وواجهت أخطاء مماثلة. أنا في عملية الترحيل الثالثة وهذا جعلني مجنونًا. أعتقد أن طريقة عمل هذه الإضافة يمكن أن تربك المستخدمين الذين يقومون بعمليات الترحيل.

يجب تحديد مكان ما بأن الإضافة يجب تفعيلها على Discourse بعد عملية الترحيل. إذا كان هذا مكتوبًا بالفعل في مكان ما، فقد أكون قد فاتني ذلك وربما يجب التأكيد على هذه المعلومات.

يرجى تصحيحي إذا كنت مخطئًا. :slight_smile:

إعجاب واحد (1)

أبلغ عن إصلاح لتحويل الرموز التعبيرية للاستيراد من phpBB 3.0.7.

  • لم يتم تحويل بعض الرموز التعبيرية بشكل صحيح إلى Discourse:


    (ولكن ليس دائمًا، لسبب ما؛ تم عرض بعض الرموز التعبيرية المتطابقة أحيانًا، وأحيانًا لا. بدا الأمر عشوائيًا في البداية)

  • أيضًا، اختفت بعض الرموز التعبيرية ببساطة:
    phpBB:
    image
    Discourse:
    image

جاءت المشكلة من التعبير النمطي المستخدم في replace_smilies(text) من

التعبير النمطي الخاطئ:

<!-- s(\S+) --><img src="{SMILIES_PATH}/.+?" alt=".*?" title=".*?" /><!-- s?:\S+ -->

لاحظ كيف أن بداية التعبير النمطي لا تفترض وجود حرف “:” بعده:

<!-- s

ولكنها تفترض وجوده في نهاية التعبير النمطي:

<!-- s?:

(أيضًا أتساءل لماذا يوجد “?” يطابق 0 أو 1 من الحرف “s” في نهاية التعبير النمطي، حيث لا يوجد في بداية التعبير النمطي)

لقد قمت بإزالة هذا “:” من التعبير النمطي وبدت مشكلتا الرموز التعبيرية الخاصتان بي محلولتين تمامًا.

في منتدى phpbb الخاص بي، بدأت العديد من الرموز التعبيرية بالفعل بـ “:” مثل “:mrgreen:” أو “:evil:”، ولكن بعضها لم يبدأ بذلك، مثل 8-) أو ;)
أدى التعبير النمطي القديم إلى التقاطات خاطئة للرموز التعبيرية. على سبيل المثال، تم التقاط رموز تعبيرية متعددة بجانب بعضها البعض كرمز تعبيري واحد.


التعبير النمطي الثابت:

<!-- s(\S+) --><img src="{SMILIES_PATH}/.+?" alt=".*?" title=".*?" /><!-- s?\S+ -->

أنا لا أقوم بإصلاح الكود مباشرة في مستودع Discourse لأنني لست معتادًا على استخدام git، وأيضًا لست متأكدًا مما إذا كان سيؤثر على الاستيرادات من إصدارات phpBB الأخرى. لا أريد أن أفسد أي شيء.


على أي حال، إذا واجه الأشخاص نفس المشكلات التي واجهتها، فإليك الحل.

4 إعجابات

تم إصلاح مشكلة أخرى يمكن أن تساعد الأشخاص في حالتي أثناء ترحيل phpBB 3.0.7.

لسبب ما، كانت محتويات منشورات منتديات phpBB الخاصة بي تحتوي أحيانًا على مسافات متعددة تتبع المحتوى في بداية الأسطر. أشك في أن بعض المستخدمين “يحبون” الضغط على مفتاح المسافة بشكل محموم دون الانتباه عند كتابة رسالتهم، ولم يكن لذلك أهمية لأن الصفحة “المعروضة” تجاهلت هذه المسافات المتعددة:

محتوى نص phpBB الخام:

Salut tous  :)
  
     Alors voilà, le combi n'a pas roulé beaucoup ces derniers temps cause CT pas OK  :evil: mais il a fait ces 2000 kms sans broncher  ;)  
Maintenant le CT est OK . Merci L'Atelier Du Raz  8-')

    Je dois donc changer le joint-spi au bout de 40 000 kms en 10 ans  :roll: 
C'est un silicone et j'ai vu qu'il y avait des "doubles lèvres " !? 
What's About ?

             Je trouve ça un peu limte  :evil: 
Merci tous, fred

الصفحة المعروضة في المتصفح:


ولكن أثناء استيراد phpBB → Discourse، تم تحويل هذه المسافات الموجودة إلى كتل رمزية:

هكذا يجب أن يتم عرضه:


لقد أصلحت ذلك عن طريق إضافة تعبير عادي (regex) يزيل المسافات في بداية كل سطر

 text.gsub!(/^[^\\S\\r\\n]+/, "\\n")

أضفت هذا قبل process_smilies(text) مباشرة في هذا الملف:


مشكلة أخرى واجهتني.
في هذا الرمز (لا يزال في text_processor.rb):

    def clean_bbcodes(text)
      # Many phpbb bbcode tags have a hash attached to them. Examples:
      #   [url=https://google.com:1qh1i7ky]click here[/url:1qh1i7ky]
      #   [quote="cybereality":b0wtlzex]Some text.[/quote:b0wtlzex]
      text.gsub!(/:(?:\\w{8})\\]/, ']')

في قاعدة البيانات الخاصة بي، تتراوح أطوال هذه التجزئات بين 5 و 8 أحرف، لكن التعبير العادي يزيل فقط التجزئات التي يبلغ طولها 8 أحرف بالضبط. لذلك، احتفظ استيرادي بالتجزئات الأقصر بدلاً من إزالتها.
لقد أصلحت هذا عن طريق تغيير التعبير العادي إلى:

text.gsub!(/:(?:\\w{5,8})\\]/, ']')

أضفت مشكلة بسيطة أخرى، لا تزال في نفس الملف. يتوقع التعبير العادي الذي يزيل علامات BBCode [color] قيمة سداسية عشرية مسبوقة بـ # إلزامي. ولكن [color] يقبل أيضًا سلاسل مثل “red” و “blue” وما إلى ذلك، كقيم. لذلك قمت بتعديل التعبير العادي الأصلي:

      # remove color tags
      text.gsub!(/\\[\\/?color(=#[a-z0-9]*)?\\]/i, "")

عن طريق إضافة ? بعد # لجعل # اختياريًا.
الكود الثابت:

      # remove color tags
      text.gsub!(/\\[\\/?color(=#?[a-z0-9]*)?\\]/i, "")

لا أعرف ما إذا كانت مشاكلي شائعة في عمليات استيراد phpBB، أو ما إذا كانت خاصة جدًا بحالتي. إذا كانت الحالة الأخيرة، آمل ألا تكون تفسيراتي هنا غير مرحب بها أو زائدة عن الحاجة. فقط أخبرني إذا كان الأمر كذلك حتى لا يكون الأمر محرجًا. :grinning_face_with_smiling_eyes:


تعديل: هل من الممكن جعل جميع المواضيع الموجودة تُضبط على أنها “مقروءة” لكل مستخدم موجود بعد الترحيل؟

الهدف هو منع المستخدمين الحاليين من الانتقال إلى الرسالة الأولى في هذه المواضيع التي قرأوها بالفعل قبل الترحيل، عند النقر على المواضيع الموجودة (والقديمة أحيانًا) بعد الترحيل.

من الناحية المثالية، سيفتح المستخدمون الحاليون عند النقر على المواضيع الموجودة، ليس الرسالة الأولى، بل الأخيرة (منذ نهاية الترحيل، بالطبع).

إنها مشكلة صغيرة تتعلق بجودة الحياة (وستختفي بشكل طبيعي بعد بضعة أسابيع مع استخدام المستخدمين للمنتدى وقراءة المواضيع)، ولكن تم سؤالي عن هذا الاقتراح.

7 إعجابات

شكراً لمشاركة هذه الإصلاحات!
لقد اضطررت إلى إجراء تعديلات مماثلة على التعبيرات النمطية (regexes) لعمليات الترحيل السابقة، لذا ستكون هذه مفيدة لعمليات استيراد phpbb المستقبلية.

قد يكون هذا الموضوع مفيدًا How to mark imported posts as read - #2 by stuwest

3 إعجابات