• Off-topic
  • PhpBB migrate script - Updated for beta 5

Hello guys love the forum software, I always keen on trying new things and being on the bleeding edge, I know its not ready for production but I wanted to try it out with the data from a phpbb forum that's been running for a couple of years. So I created a little php migration script that will generate a sql file that contains most of the data from phpbb and populate flarum tables with it. I recommend to start with a clean forum setup and the import the data. The script is rough around the edges and not perfect in any means. The main limitation is user data, passwords are not transferable so instead the script will create a user with a random password. which after the migration they would need to reset.


Update 30/03/2016

Script has been tested with a fresh version of Flarum Beta 5 and works ?
Some changes to how the script works it now does a pure DB --> DB migration and does not generate and sql files that you have to re-import into the new db. If your phpbb database is on a unreachable host from where the flarum DB is you will have to do a initial migration of the old PHPBB database into the new host once to perform the migration


Update 3/11/2015

I thought I update the script. It now works with 0.3 release since there was not any major database changes I improved several bugs I found in the code the biggest was the discussion timeline being wrong the new version will also format the posts better any images will now display in the posts and quotes will also work.

The new script is here: https://github.com/robrotheram/phpbb_to_flarum
The last function in the codebbcode_toHTML can easy be expanded adding in bbcodes I have missed.


Update 29/02/16
The script now has a proper home in a repo that you can find here https://github.com/robrotheram/phpbb_to_flarum fork away

For anyone who wants to use the script here are the steps I use
1. Create a fresh forum using the standard install instructions
2. when you create the forum make sure the email is different to the one in phbb otherwise there will be some conflicts
3. run the my script with the correct database parameters for you. (make sure that the script is executable and the directory writable)
4. after the script has run you will see a file called flaurm.sql import that file into your database and all your content will be migrated.
An Example of the export can be see here with all post form a phpbb forum: http://flarum.robrotheram.com

10 days later

How do I use this one? I mean, can you please write down some guide step by step in order to complete the process? Thanks in advance! 🙂

If i'm not mistaken you configure the phpbb database settings in this file and it will generate an export dump, which you have to import into a clean flarum installation.

    Importing using phpMyAdmin, right? Anyway, I'm trying and I'll let you know!

      It creates the .sql file, but when you try to import it into the Flarum db using phpMyAdmin you get this error:

      Query SQL:

      INSERT INTO users (id, username, email, password, is_activated) VALUES (1002, 'glauco', 'email@gmail.com', 'c942464cf2683c1e2b9250a7337f9728335534959', 1)[...]

      Messaggio di MySQL: Documentazione
      #1146 - Table 'flarum2.users' doesn't exist

      you have to put your informations like username, prefix table, password, etc.

        Are there already plans to create an extension for imports? I think that's a rather easy one to do, I could make one.

        I think, I read something about placing this in the installer - but why not just providing an extension?

          Dakoom Dunno, somewhere in the docs or in the repo or in the chat or somewhere else... 😉

            moay Ok, don't worry. I will wait until some extension will be released.

            luceos have to import into a clean flarum installation
            Dakoom

            I told you, the (phpmyadmin) has to be done into a clean flarum install. The user table does not yet exist.

              luceos Oh, you mean prior to install?

              Edit: I get the same error.

              The way I got my script to work is start of with a fresh install of flarum. I would suggest when creating the first admin account to use a different email then the one in phpbb since on import mysql will detect a conflict with the email. After flarum in successfully installed. We can proceed with the migration. I Run the script which generates a sql file that will update all the tables. Since I working on command line. I then do :
              mysql -uUSER -pPASSWORD flarumDBNAME < sqlfile.sql

              I would love to build an extension but sadly do not have a lot of time to invest, the script was a hack together job to get some data quickly into forum it definitely no where a plug and play but it does the job for me and I though I share it to help other people and

                19 days later
                4 days later

                I have updated the top of the post with instructions and a updated scipt that now does formatting and fixes a few bugs.

                • GOD likes this.
                robrotheram changed the title to PhpBB migrate script - Updated for 0.3 and other improvements .

                ozkans You can run the script at anytime to generate the flaurm.sql file. The most reliable way to import the data into flarum is to have a fresh forum with the admin account you setup with a username and email different to any stored in the phpbb database / flaurm.sql.

                I went for a sql file export rather then some direct database changes because some people aka me for example have phpbb running but are testing or have flarum on a different machine but still want to see there phpbb data.

                3 months later

                Thanks for providing this script. Any idea's how to handle attachments? Is there already some kind of plugin/extension for flarum to support attachments?

                  5 days later

                  VTX I have to admit I have not looked at attachments mainly due to the forum I was migrating did not allow attachments to be uploaded only public links to places such as imgur. It would depend on the url phpBB gives for the links. if they are relative such as /uploads/filename.ext then you should be able to copy over the folder and set a static path in apache / nginx config. The other option is change the link URL could be done with some find and replace magic on the resulting sql file. Sadly I don't have the time to investigate further