inicio mail me! sindicaci;ón

Converting Agora to Kunena – Joomla Migration Tools

I successfully converted our old Agora forum on zentrack.com to a shiny new Kunena forum.

[edit]The Kunena version was 1.0.8; I have no idea what the Agora version was as this took place over two years ago.

Since there weren’t any handy migration scripts, I broke out my trusty, quick and dirty db migrator, and whipped one up.

Here’s what you’d need for these scripts to be useful for your install too:

  • Existing Categories in your Kunena db that mirror the old Agora forums
  • Command Line Access to your server
  • Basic understanding of SQL and shell scripting

Here’s what the scripts do:

  • Works with or without CB
  • Import all posts from Agora to Kunena
  • Convert agora user ids to joomla ids (used by Kunena)
  • Updates post counts by category (Kunenas sync tool doesn’t do well)

Here’s what to do:

  1. Make sure your categories are set up
  2. Download the zip file linked here
  3. Open configure.php
  4. Modify the connection info at the top
  5. Set the forum ids to category ids
  6. Set $fake_inserts = true
  7. Run the script:  php ./converter.php (a test run)
  8. Check out the printed results and make sure they look sensible
  9. Set $fake_inserts = false
  10. Have a go at the real data (you have a backup, right??)

Joomla Experts said,

July 11, 2009 @ 10:43 am

i use to copy these kind of postings to my blog!

hyperionus said,

July 28, 2009 @ 7:49 am

Hello,

what it means when I have that kind of information ? (I have posts, forums and topics in my database)

————————————————-
Migrating values to jos_fb_messages
————————————————-

No rows found, that’s weird so I’m exiting

Michael said,

July 28, 2009 @ 10:49 am

You probably didn’t configure the source table right. It means there are no rows to copy into the new table.

hyperionus said,

July 31, 2009 @ 8:04 am

Hello,

My forum id’s was 6-11 , and I didn’t change values “forum_id < 3″ in query.
Thanks for help, it works great.

Rick said,

August 6, 2009 @ 1:45 am

I really need this to work. Have it partially working I think?

Problem is only the first forum with it’s one message gets converted.

Converted (1) rows successfully.

The output shows the conversion as being successful. “Did not blow up the planet”

But nothing in any of the other forums below.

In agora I have forum ID’s from 1 thru 38. I duplicated this in Kunena. What am I doing wrong? I suspect I need to edit something in the config file but I am not sure what. Do I need to add to the arrays where you have 1 => 1, 2 => 2, etc. ? Also I am not sure what t.forum_id < 3 is referring to.

Any help greatly appreciated. I hate agora and really want Kunena.

Thanks in advance,
Rick

Michael said,

August 6, 2009 @ 7:38 am

Rick, The two things to check are $ag_forums_to_kunena_categories, which will need to have 38 entries for you, and the $tablemap["sourcequery"], which has this clause:

“forum_id < 3″

You can probably remove that

Rick said,

August 7, 2009 @ 1:16 am

Thank you Michael. I have managed to get it to work albeit there were errors. Each message insert had a duplicate entry for key 1 error. However all messages were imported into Kunena. I am happily now using the latest version of Kunena thanks to your conversion script.

Kind Regards,
Rick

leigh godson said,

August 16, 2009 @ 8:29 am

Michael, what version(s) of agora and kunena is this for please? I have filled out the config but am getting errors from line 108. Agora version 3.0.0.1 and kunena 1.5.5

regards

leigh

Michael said,

August 16, 2009 @ 12:59 pm

More importantly, what is the error?

leigh godson said,

August 16, 2009 @ 2:12 pm

To be honest I checked the line and realised that it was a db connection error as I was not working on localhost, that said even after filling out the category map it is still coming up with the no rows error.

leigh

leigh godson said,

August 16, 2009 @ 3:15 pm

Looked over it all again and the categories do indeed correspond to each other in the config file but I am still getting:

————————————————-
Migrating values to jos_fb_messages
————————————————-

No rows found, that’s weird so I’m exiting

any ideas?

leigh

Michael said,

August 17, 2009 @ 7:31 am

Leigh, why don’t you email me your config file (blank out your db passwords) and I’ll have a look at it. Send it to mlr at the domain of this blog.

You can also IM me using the chat widget on this site: http://zenovations.com/contact.php

leigh godson said,

August 17, 2009 @ 3:05 pm

Hi Michael, I emailed you over the file, just checking you got it ok.

leigh

Eclipse Now said,

August 31, 2009 @ 3:24 am

Wondering why you moved from Agora to Kunena? What do you see as the advantages?

Michael said,

August 31, 2009 @ 6:34 am

Simplicity and usability were half the reasons for moving. Agora was confusing to our users and things like paging buttons and new topic icon were hard for folk to find. It was also ugly to look at. I was looking for something fresh and simple and Kunena–though still more complex than our needs–was the closest match with the recent topics page as the default. I’m struggling to remember more details about my usability gripes, but it’s been a while since the move and I can’t recall them precisely anymore.

I do recall that we had continual issues with the user registration process and Agora’s separate user tables. Kunena uses the integrated user tables or works with CB module, which made our lives considerably easier and cut down on bugs and user issues considerably.

Eclipse Now said,

August 31, 2009 @ 5:51 pm

Thanks for that, very valuable.

K_395 said,

January 25, 2010 @ 8:09 pm

Could you please tell where to upload this script?
Thank you

Michael said,

January 26, 2010 @ 7:40 am

@K_395 if you have shell access to your server, you can upload this script anywhere and run it with PHP CLI.

If that is all greek to you (incomprehensible), then you want to upload the scripts to your web directory, such as public_html or wwwroot. Once they are there, you can run them by pointing your web browser at them. Remember to delete them after!

hecki said,

January 28, 2010 @ 4:19 pm

I cannot make this script to work and I have to convert my Agora forum to Kunena ASAP.

Can anybody help?

I tried a couple of times and only converts first 2 forums.

Michael said,

January 28, 2010 @ 10:26 pm

In config.php, in the source_query variable, take out this: AND t.forum_id < 3

Michael said,

January 28, 2010 @ 10:28 pm

I’ve uploaded a version with those lines removed; these scripts do assume you read through that array very carefully and set things up the way you want them.

hecki said,

January 30, 2010 @ 3:58 am

Thanks for your help Mike, but, I give up.

I have download the new file, start all over again and the script only converts 1st two categories.

Oh well, at least I tried…

Michael said,

January 30, 2010 @ 9:46 am

Check out this section near the top:

[code]
/**
* Conversion map of Agora's forum ids into Kunena's category ids
*/
$ag_forums_to_kunena_categories = array(
1 => 1,
2 => 2,
3 => 3
);
[/code]

You’ll need to do a bit of research, find out what the ids of all the forums are in agora, and what the categories are that you created in kunena, and then decide where they should move to accordingly.

hecki said,

January 30, 2010 @ 1:08 pm

Nevermind, I am a dumbass :p

Works fine, I was looking at kunena order ID and not forum ID on the right side. Converted and no problems at all. Thank you :)

Michael said,

January 31, 2010 @ 12:51 am

Yay : )

Paul Enderson said,

March 15, 2010 @ 5:05 pm

Brilliant! I only recently decided to move my client’s site from Agora to Kunena (lots of reasons, but primarily issues with the Agora routing)…

Imagine my annoyance when I discovered that there was no official way to migrate in that direction! Thankfully, your article is linked to from the Agora forum – and you’ve saved my bacon, so thanks! :)

llema said,

March 25, 2010 @ 10:44 am

I already had an old version of Kunena (Fireboard actually) BEFORE making the move to Agora…now I just installed the latest Kunena (1.5.9) and the database is still active..all the old posts are back up and working. All that’s missing is the posts that were added while on Agora… will this method simply add the missing posts to my old DB or will it crunch it?

Also, what about attachments in Agora posts…will these carry over and work in Kunena after the migration or will they need to all be fixed manually?

Thanks for any help you can offer.

Michael said,

March 25, 2010 @ 11:27 am

I don’t think that this will help you with attachments, but you should be able to migrate the posts just fine. Make a backup, of course, and be sure to set the starting id to a number higher than your existing Kunena posts.

llema said,

March 25, 2010 @ 11:38 am

I don’t understand where to set the starting ID??? This is in the config file I take it? Can you tell me what statement I’m looking to modify??

Otherwise, what if I were to go in Agora (after backing up db) and doing a cleanup pruning all posts that correspond the old post dates already on the old FB? Then running the script would migrate only the topics/posts that are left, which are all the new ones since the switch…does that make sense?

Michael said,

March 25, 2010 @ 1:57 pm

Looks like I was confused about the starting ID’s–must have been some leakage between the synapses.

If I understand you right, the posts in the Kunena and Agora DB that would have the same ID would, in fact, be the same posts? As in any duplicates could be ignored? If this is the case, you can just run the script with $stop_on_failed_query = false and you’re good to go (make sure you try the fake inserts first!)

If not, we can probably work it out anyways, just have to make a quick tweak to the script. Here’s the basic idea:

// add this near the bottom of the config file
$start_id = 5678;  // the first available ID in the database
function increaseId( $v, $row ) {
   global $start_id;
   return $start_id + $v;
}
 
// then put this in the 'fields' array in place of 'id[1]' => 'id',
   'id[1]' => array('increaseId', 'id'),

llema said,

March 25, 2010 @ 10:20 pm

Just performed the conversion and so far it looks pretty good…still going through and testing, but all in all, I think its ok! :) Thanks… will report back when I know for certain.

Costa Almeria said,

April 26, 2010 @ 6:54 am

FANTASTIC! I honestly felt strangled by the Agora system, and although there is good support from the authors (even if a bit “chip on shoulder”) it seems to take months for the most simple and NECESSARY modifications to be made, with the coder(s) concentrating on new ideas rather than making the basis usable. I’ve had months of listening to people telling me how much they hate our forum software (Agora), and you just gave me the means to finally get away from it!

One thing, the database prefix is hard coded (if such a thing really exists when you have the source), so if you have changed your DB prefix from JOS_ to something else, you will have to mess around a little.

Thanks again for this little utility!

marnes said,

August 11, 2010 @ 12:40 pm

I’m not experienced with running php scripts, but I’ve been trying to get it to work, and I’m pretty sure, I’m doing something basic incorrect. The overall problem is when I run converter.php, it simply dumps out the contents of that file, as if it didn’t try to process anything. It does appear to pause for about 0.5 seconds before dumping the text, no errors/warnings.

At the top of config, I’ve tried a couple different logins — the admin at the base address before the database, and the phpmyadmin level that actually displays all the database entries including joomla and everything inside it — pretty stock install. I’ve spoofed the names/passwords:

First try
$from_db_connection = array(‘https://mywebsite.com/phpmyadmin', ‘root’, ‘rootpassword’, ‘joomla’);
$to_db_connection = array(‘https://mywebsite.com/phpmyadmin', ‘root’, ‘rootpassword’, ‘joomla’);

Second try
$from_db_connection = array(‘https://mywebsite.com', ‘admin’, ‘adminpassword’, ‘joomla’);
$to_db_connection = array(‘https://mywebsite.com', ‘admin’, ‘adminpassword’, ‘joomla’);

and then when I run the command:> php c:\directory_of_phpfiles\converter.php

..I get a straight dump of the entire file.

// recover query memory
mysql_free_result($result);

// show the user what we did
printIt(“Converted “.($i-$j).” rows”);
if( $j ) { printIt(“!!!! $j errors !!!!!!”); }
}

// actually run the conversions
foreach($tablemap as $t) {
convertTable($t);
}

printIt(“Finished without blowing up the planet”);

?>

So any advice? What am I doing wrong here?

Michael said,

August 11, 2010 @ 3:36 pm

What happens if you just type “php -v”?

Michael said,

August 11, 2010 @ 3:38 pm

Feel free to just send me your files. Zip them up and email them to mlr at this domain. Be sure to obscure your passwords.

marnes said,

August 11, 2010 @ 6:15 pm

Ahh the version is this and I’m running on Windows 7 64 bit ultimate.

PHP 5.3.3 (cli) (built: Jul 21 2010 20:36:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

I was able to run a little php hello world program. The file consisted of this:

#!/usr/bin/php -q

And the output was this:

Hello world of PHP CLI!

As for the settings, all I modified was the header of the config to this:

$from_db_connection = array(‘https://—-.com/v01/phpmyadmin', ‘root’, ‘——–’, ‘joomla’);
$to_db_connection = array(‘https://—-.com/v01/phpmyadmin', ‘root’, ‘——–’, ‘joomla’);

Which points to the phpmyadmin area — although I suspect this might not be the place I should be trying to hook into. I also tried to the root login before the phpmyadmin section, and that also had no effect.

The second section I edited was the category remapping:

/**
* Conversion map of Agora’s forum ids into Kunena’s category ids
*/
$ag_forums_to_kunena_categories = array(
1 => 1,
9 => 2,
7 => 3,
2 => 4,
5 => 5,
4 => 6,
8 => 7,
6 => 8,
3 => 9
);

That is all I’ve edited. So the key parts I’m not sure about are the address to the database, and I’ve assumed that ‘joomla’ is the parent db for both agora and kunena. I downloaded the script files today from here.

It’s just the converter.php doesn’t appear to execute… it’s just so weird.
And convertTable has a bunch of printIts even before it gets to the part where it attempts to login as an admin.

marnes said,

August 11, 2010 @ 6:16 pm

Oops, this was the hello world program that runs no problem for me.

#!/usr/bin/php -q

marnes said,

August 11, 2010 @ 6:16 pm

weird it’s cropping out the echo line…

Michael said,

August 11, 2010 @ 8:01 pm

It seems like there is a stray character, like a quote mark or perhaps an unmatched parenthesis. Send me over the complete file with your config changes and I’ll have a quick peek.

marnes said,

August 12, 2010 @ 11:33 am

Just an update. Michael helped me through a few rounds of email exchanges and graciously helped me to get everything to work, so my gratitude!

Few keynotes:

1. Ultimately my biggest issue was my attempt to connect to a remote server. But adding the scripts to the server and running them using localhost was worked.
2. The credentials that worked were the ones used to access phpmyadmin.
3. Using “joomla” in place of “db-instance” for both agora and kunena was correct for me — and for you, if you do a stock install of both.
4. Once you run a non-trial run, if it doesn’t work properly, running it a second time will fail because it tries to reinsert messages. So after a little digging, and being too scared to delete the database entries directly, I tweaked the code. Specifically changing converter.php line 40 inside the addRow function: query = “INSERT INTO”… by replacing INSERT with REPLACE.

A few things that didn’t work, but I was able to manually overcome them:
1. Account details and avatars didn’t make it.
2. Sticky threads didn’t make it either, so I unstickied them in Agora, then ran the conversion again.
3. Polls didn’t make it. They just got stripped out.

Someone earlier asked why people switched from Agora to Kunena. Well, here’s me unloading fresh:

Overall, I’m really liking Kunena so much better. Compared to Agora, Kunena is far more intuitive and that is a hard thing to describe. More stuff:
* Agora also had the most repulsive list formatting.
* Agora support forums left a bitter taste in my mouth. Seems the team that supports Agora are quite rude and condescending to people asking for help so they really need to improve their image. I never dealt with them, but I didn’t want to either. A lot of people complaining about customer support overall.
* Kunena has very direct thread management tools — one button clicks to subscribing/unsubscribing to threads, sticky controls, etc.. all right there, all inline, while Agora forces you to scroll to the very top and click a drop down menu and select your option. That kills workflow because normally you are always at the bottom of any given thread, so it was a big time sink.
* Kunena has more and better formatting options and inserting images is also cleaner and quicker (and not as hidden).
* Kunena has far more administrative settings and options — haven’t really dug into it deeply yet, but in addition to having 4x the options, the comments for each setting are very well documented and easy to understand what effect it would have if you changed it.
* Kunena has additional tabs for “Recent Discussions” (default), “My Discussions” (threads you are following), and “Categories” (forum tree). Again, compared to Agora, Agora forces you to navigate the tree to look for the colored lights which were not intuitive either. I disliked how sticky threads were “yellow” and active threads were “red” and new posts were “green” and they really should have been separated.
* Agora installation didn’t work out of the box. There’s a few manual hoops an admin has to jump through before you can make Agora show up on your site like creating categories, assigning groups, etc. Kunena works instantly out of the box by setting up a defaults. All you have to do is add it to your main menu.

Hope that helps anyone else considering doing this. I only fired up my website 2 weeks ago and didn’t give much though to which forum tech to use. I initially chose Agora because it’s been around for a long time and at first glance looked really good, while Kunena was “newer” and kind of unproven, but popular. All I have to say is wow — it’s night and day!

marnes said,

August 12, 2010 @ 11:41 am

Btw.. here’s a classic example in the differences in documentation:

Agora Visit Timeout: Number of seconds a user must be idle before his/hers last visit data is updated (primarily affects new message indicators).

Kunena Session Lifetime: Default is 1800 [seconds]. Session lifetime (timeout) in seconds similar to Joomla session lifetime. The session lifetime is important for access rights recalculation, whoisonline display and NEW indicator. Once a session expires beyond that timeout, access rights and the NEW indicator are reset.

To me, Kunena’s is much clearer. Also Agora’s only shows up as a mouse over popup, while Kunena’s is displayed inline… again more intuitive.

kalel06 said,

September 10, 2010 @ 11:54 am

Just did a conversion and all went well. Pretty straight forward once you figure out that getting the array right is the trick to this. Kunena is far superior to Agora.

Thanks for this script.

Marceli said,

February 8, 2011 @ 6:28 am

Hello, I have a question. What if I have some duplicated ID in my Agora forum? I know this is weird (should be unique of course) but can I just correct this manually from PHPMyAdmin? Will this affects something on my forum?
Screen: http://neatgroup.pl/showroom/screen1.jpg

Also, how the situation looks with J1.6? I’ve tried your solution and got some tables replaced but nothing in the backend, Kunena is empty :( Any ideas? Should I install another J1.5.22 try to import my old Agora to new Kunena there, and from there to my 1.6 kunena? Is there any easy way to exporting from kunena to kunena?

Thanks for any help in advance!

Michael said,

February 8, 2011 @ 7:27 am

Duplicate ids would be an issue. There are several tables that link together replies and categories using that ID, so they would be confused by duplicates.

As for J1.6, is there a significant difference in the table structures? I haven’t had to convert between these since, well, yanno, that one time ;)

Kunena to Kunena should be nothing more than a database dump and load, assuming they are both the same version.

Marceli said,

February 8, 2011 @ 8:31 am

Thanks Michael for your very fast response. It seems that you’re this kind of person who is passionate about work – I appreciate it a lot!

I will ask friend of mine who is good in SQL so he would be able to fix my duplication of ID. Then I will try again your solution with J1.6. If won’t work I will do the trick with temporary J1.5 and come back with results.

Have you thought about improving this plugin and make it native to J1.6? I think lots of people might need it now when 1.6 is released and Agora become commercial? If you put it to extensions.joomla you I’m sure ypu will get some donation … (sorry just loose thought)

Speak to you soon.

P.S. I wonder if removing section and adding it again might work in Agora backend to solve ID issue … I will try in the evening.

Michael said,

February 8, 2011 @ 1:25 pm

Posting it as a plugin sounds fun; I’m so busy with work right now that it’s a bit optimistic to find the time. It would be awesome if someone else wanted to invest the effort and grab the credit.

Good luck with your migration. I’d be happy to hear how it goes.

Marceli said,

February 8, 2011 @ 7:38 pm

Just realised that my observation about ID duplication was wrong. I’ve checked DB and top-level rows are placed in agora_categories and the rest is in agora_forums. That’s why I’m getting the same IDs. (categories vs forums)

Anyway I decided to ignore this (can’t touch original Agora) and put =>0 to these IDs

10 => 0,
11 => 14,
12 => 15,
13 => 17,
14 => 0,

12 tables converted and I see my categories in kunena_categories but the kunena_messages table seems to be empty and there is nothing displayed in kunena frontend. In the script I see you used “dest_table” => “jos_fb_messages”, ..does that mean I should have this table in my new joomla and this is target table?

Test made on J1.6 and Kunena 1.6 so doomed to failure but I can’t check on J1.5 because I can’t install bloody Kunena 1.5.14 from http://joomlacode.org/gf/project/kunena/frs/ . I tried two fresh J1.5 and both display error after installation:

Creating version table

Fatal error: Call to a member function getAttribute() on a non-object in /home/…./public_html/test-joomla152/administrator/components/com_kunena/lib/fx.upgrade.class.php on line 255

Problem is unsolved on official forum … wrrr getting annoyed! Does anybody can send me older Kunena than 1.5.14 ?

To sum up, what do you think?
Test failed because I shouldn’t put =>0 in config.php, or because this is J1.6?
First of all I have to make sure that I do everything wright with the script on Joomla 1.5 and Kunena 1.5 because this was your environment, yes?

Michael said,

February 9, 2011 @ 5:20 am

It sounds to me like Kunena has done some renaming and moving of tables in 1.6. So maybe the easiest route would be to simply update the script to work with 1.6?

It occurs to me that your Agora version may also have significant changes.

If you are willing to find out what the new structure is, and provide me a map of Agora -> Kunena tables, I will update the script. As I recall, this was the most consuming portion of the original script–just trying to figure out where the heck everything was getting stored.

Marceli said,

February 10, 2011 @ 2:53 am

Hi Michael, that would be really great!

I installed fresh J1.5 with Agora & J1.6 with Kunena to make sure DB has original structure. Please have a look into screens below and tell me which tables exactly you need to see and what else I can help you with.

agora-j15: http://neatgroup.pl/showroom/test/agora-j15.jpg
kunena-j16: http://neatgroup.pl/showroom/test/kunena-j16.jpg

Michael said,

February 14, 2011 @ 3:37 pm

Been traveling, sorry for the delayed response.

I’m afraid that I don’t have the time to figure out the table structures. Sorry, just barely eeking out 5 hours of sleep a night at current, no time for hobby projects ; (

What I would need is a spreadsheet mapping agora to kunena… something like this:
agora table name | agora table field | agora fkey source | kunena table name | kunena table field | kunena fkey source

It would need to include any conversion info, if the field types are different. The fkey source would be used if the field refers to an ID in another table (it would specify which table/field the ID is retrieved from)

If this isn’t something you have the magic mojo to create, you might be able to get someone in Kunena forums to help you.

Alternately, if you could obtain a list of which fields have changed since the version my script was compatible with, I might be able to work with that, too. Should I get some time in the near future, I may poke around myself, but for now, schedule is booked.

RSS feed for comments on this post · TrackBack URI

Leave a Comment