Drupal-Joomla Forum Importator
This is a PHP script to help you migrate forums from Joomla Simple Board to Drupal Forums. This script uses concepts and methods described in the Drupal Help Files located on this site.
- Tested on PHP 5.2.x
- Tested on Apache 2.x
- Tested on Drupal 6.x
- Forums module must be activated
- Comments module must be activated
- You must already have Joomla users migrated (See: http://drupal.org/node/249643)
- You must have read permissions to the Joomla DB
Extract and upload all the files to to your web server that is hosting the Drupal Installation you'd like to migrate to. In this example, Drupal is located in "/usr/www/data/mywebsite/drupal". We will upload them to "/usr/www/data/mywebsite/importator".
It's critical that you first enable the forums and comments modules. Do this by logging in as an administrator and go to the modules area and enable them. Secondly, you must already have your Joomla users imported. Take a look at the Joomla Converter module for Drupal located here: http://drupal.org/node/249643.
Once you have that stuff taken care of, open up "config.php" and edit as needed.
<?phpdefine("IMPORTATOR_DRUPAL_DIR", "../drupal");define("JOOMLA_DB_NAME", "joomla_dev");define("JOOMLA_DB_USER", "root");define("JOOMLA_DB_PASS", "");define("JOOMLA_DB_HOST", "localhost");//Decide whether or not to actually write data.$TEST = false;?>
- IMPORTATOR_DRUPAL_DIR: The directory in which the Drupal installation resides, can be relative to the import script or absolute
- JOOMLA_DB_NAME: Joomla Database Name.
- JOOMLA_DB_USER: Joomla Database User that has complete read access.
- JOOMLA_DB_PASS:Joomla Database Password.
- JOOMLA_DB_HOST: Joomla Database Host, usually localhost, but it can be a remote database as long as you have correct permissions setup.
- $TEST : Allows you to test you settings before doing any actual modifications. (You may see errors if you change this to "true".)
Save the config.php file.
Backup Your Drupal Database!
Although much testing has going into making this script, their is a chance that this import script will destroy your Drupal database. Backup your Drupal database.
Let it Begin
Open up the web browser (Firefox is recommended) and navigate to where you uploaded the script. For example, http://www.unibia.org/importator. The import process will begin. First it will create a new container then the forums inside that container. After that it will attempt to migrate the forum topics. Finally, it will copy over the topic replies/threads.
You backed up your database? Right?
If all goes well, you'll see:
The "index.php" script will automatically execute the needed steps in order. However, you can also run each step individually.
- importForums.php: This create a unique named forum container and migrates the Joomla Simple Board categories. Drupal treats these and Vocabulary and Terms.
- importTopics.php: Migrates the Joomla Simple Board top level messages, aka Forum Topics. Drupal treats these as Nodes
- importReplies.php: Migrates the Joomla Simple Board child messages, aka Forum Replies. Drupal stores these as Node Comments
This script will not duplicate data. So you can re-run the script or any part of the script as much as you'd like. Running the components out of order will produce unknown results, so do so at your own risk.
Additionally, this script will convert PHPBB code that is used in Joomla Simple Board into standard HTML. It will also try to convert non-HTML characters into their HTML code equivalents.
Since this script will prevent it's self from creating duplicate data, In rare instances this may cause certain topics to be lost/merged during migration if the Joomla topics have the same EXACT subject. In the even more rare instance, comments might suffer this same issue. In a way this is probably a good thing.
Another issue may be with text encoding and special non-HTML characters. This script may have some trouble migrating topics or replies with strange/exotic characters. The result will be truncated bodies and it will possibly be duplicated (if it has replies). If you run into this, you need to find out what character is causing the problem, find it's HTML equivalent and let me know.
In the instance where a topic/reply can't get matched up with an author/creator, this script will fall back to the first user (uid = 1).
Lastly, if you have a very large forum to migrate, you might need to give PHP more memory (in the php.ini file). The amount of memory you need depends of how big the forums are. If you run out of memory, the script will crash. If this happens, close you browser, edit your php.ini, reload your webserver and try again. The script will skip over the items that where already imported.