Giter VIP home page Giter VIP logo

discourse-import-phpbb's Introduction

[Obsolete]

The purpose of this repo was to import posts and users from phpBB forums into Discourse. This task is now better done using the official solution from the Discourse team themselves.

This repo will stay up for posterity; the original readme is kept intact below.

@rikkit


Note

I (@cfstras) don't have the time to work on this actively anymore. Since Discourse is still in early beta, this importer might not even work anymore. If you want to take over the project, I'll give up this repository to anyone who sends useful and sane pull requests. For more details and discussion, see this thread on Discourse Meta.

What is this?

This rake task will import all threads and posts of a phpBB3 Forum into Discourse.

  • post dates and authors are preserved
  • user accounts are created from phpBB users, they have no login capability, but the mail addresses are set, so they can regain control and gravatar works, if they have one
  • there is a test-mode which will just connect to mysql and read posts
  • post bodies are sanitized:
    • youtube and soundcloud tags are removed (because discourse does oneboxing for them)
    • bbcode tags are cleaned up
    • newlines are converted to markdown syntax
    • [code] tags are converted to markdown syntax
    • CAPSLOCK and \(^-^)/ symbol-only messages are prefixed with <capslock> and <symbols>

Use at your own risk! Please test on a dummy Discourse install first.

Instructions

  • Important: disable your e-mail configuration or you will spam users with hundreds of mails:

    Add this to your environment config:

    config.action_mailer.delivery_method = :test
    config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }

    Start mailcatcher to see when all mails have been sent:

    gem install mailcatcher && mailcatcher --http-ip 0.0.0.0
  • Be sure to have at least one user in your discourse. If not, create one and set his username in config/import_phpbb.yml.

  • Gemfile: add entry

    gem 'mysql2', require: false
    gem 'ruby-bbcode-to-md', require: false
    
  • Install header files for mysql, ex. on Debian: sudo apt-get install libmysqlclient-dev

  • Install gems: gem install mysql2 and gem install ruby-bbcode-to-md

  • Edit config/import_phpbb.yml: insert database connection and discourse_admin username

  • Place config/import_phpbb.yml in your discourse/config folder

  • Place lib/tasks/import_phpbb.rake in your discourse/lib/tasks folder

  • In case of multisite prepend next command with: export RAILS_DB=<your database>

  • Now you need to add two columns to your PHPbb table. In the mysql console, run:

ALTER TABLE phpbb_topics ADD COLUMN discourse_id INT NOT NULL DEFAULT '0';
ALTER TABLE phpbb_posts ADD COLUMN discourse_id INT NOT NULL DEFAULT '0';
  • Finally, run rake import:phpbb
  • If everything worked, reset your config and tell your people to reset their password on the new site.

ToDo

  • Add required tables automatically in the script

Notes

If you find this helpful or can't get it to work, feel free to pop me a message!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.