Cross Site Forum Sync Admin Function

Cross Site Forum Sync Admin Function

by Jamie Pratt -
Number of replies: 11
Hi all,

I'm interested in being able to have one Moodle sites forum /forums linked to anothers so that every half an hour or on command the forums are synced : new posts from the local Moodle are posted on the remote forum and new posts on the remote forum are fetched and added in the correct place in the forum tree. This would be great where forums on one site might be of interest to users on another and would also enable users with a local copy of Moodle to go online and download and post to forums they are synched to just like fetching their email!

I've been thinking for a while that it would be nice to have a way to get my Forums on my local version of Moodle to synchronize themselves with a remote Moodle's Forum. I was put off working on the idea by the ammount of work involved : the problem would be generating new ids for all the post records and making sure that all references to these ids were also changed.

Since I worked a little with Moodle's course backup and restore functions I have thought of a way of doing these synchronisations fairly easily. Essentially the sync feature would be very similar to the course backup and restore feature! Course backup takes info from a database and serializes it as XML. The XML can then be used to reconstruct table data to insert into another course's or site's database. The course restore code deals with generating new id for the rows of the database and making sure all references to these ids are also changed.

We can refactor this code to use for a course sync utility. The course sync would work like the course backup and restore. We would send XML generated through HTTP from one site to another instead of saving it.

I'm most interested in synchronising Forums but it would also be possible to code functionality to synchronise other activity data.

For forums I'm not sure if the current restore code can deal with merging new posts into an existing forum. If not then we could code this functionality. Then we would need to find a way to refactor the backup code so that we only serialise posts to forums posted after the last sync. We would need an admin page to set up links between our sites forums and anothers, we could select all the forums from another site or just a few. We could have the code running on a cron every half an hour or only on command. In fact the admin page and code for this could probably be based on the code for running backups automatically.

Sending and receiving the XML would work from server to server admins would set up a password so that only a remote server with a password could sync their forums with ours.

We would want to ensure that if there is any interuption in communication our databases won't get messed up. But this would be unlikely to happen as actual modification of the database would not occur until all of the sync data had been fetched.

I'm keen on working on this sometime in the next 6 months. If someone is willing to provide funding for me to work on this idea then I could probably fit it in between my Flash work and have it done within the next couple of months. I would love to have a 1000 dollars to cover my living expenses while I work on this.

Jamie
Average of ratings: -
In reply to Jamie Pratt

Re: Cross Site Forum Sync Admin Function

by Robert Lefebvre -
I too have need of some type of synchronization you discuss.  What I'm planning is to set up computer labs in various developing world countries (India included). By using LTSP ( Linux Thin Server Project) hopefully we will be able to find anduse free computers (like 486s or PIs) for the labs. The need for the synchronization arises from the fact that the Internet service in many developing world locations are very expensive or non-existant. For those locations without Internet I would like to establish a "sneaker" net for the locations that don't have internet. This would entail them saving the files to storage medium, physically carrying the medium to another location, and ftp it to an Internet based Moodle (and downloading and storing the new files from the Internet Moodle). Might that be as easy to accomplish as changing the chron to a once a day event and using the chron file, table, log, whatever it is, to then update and synchonize??
     If one was to code it in php my initial thought would be to that it would be tricky. By this I mean that before being synchonized the tables in each server will only have half the correspondence. While one side is responing to a post the other side will be responding to other posts. The script should recreate the same sequence of exchange as on a regular Moodle. If you asked me a question we would have to have my response entered right after it, not six entries down.
    You mention that your main aim is to use this new feature in conjunction with forums. If you just changed the "mail to" address of your local machine to your online machine then all new posts would be sent as soon as you get online. Once they all get posted you could then use the backup feature to copy all the updated forums to your local machine. Both would be updated?
In reply to Robert Lefebvre

Re: Cross Site Forum Sync Admin Function

by W Page -
Hi Robert!

I think Martin D is planning some type of connection software between Moodle sites with the release of v1.5 or a later version.  This might be helpful in what you are trying to do.

Hopefully he will see this thread and comment on it.

WP1
In reply to Robert Lefebvre

Re: Cross Site Forum Sync Admin Function

by Jamie Pratt -
I think this feature would be very useful where one Moodle is running on a local system which won't always have connection to the internet.

Also it would be of use to Moodlers who want to share a forum for example across two sites. This might for example be useful where a language teacher is cooperating with several other language teachers who are also running Moodles. Forums from one Moodle could be shared across sites.

I'm probably not going to be working on this in the near future but this is how I think it could be done (I guess this is really hot air but Robert emailed me and asked me about this ) :

Essentially I think this would be an extension of the course back up and restore functionality. Course back up and restore is already being used to save course contents and load them up in another Moodle.

Course back up already serialises data from the Moodle db tables. We would need to change it so that only changes to the db tables since a given date are serialised. For example for the forum module we would want forum posts after a certain date.

Then we would need functionality that would extend the course restore features that would deserialise the data and then insert it in the database with the correct pointer to the parent message to which this is a reply.

This could be triggered by a cron or manually by the admin.

I think we would need a new table to translate forum ids from one site to another sites ids.

It will get complex when we have to resolve conflicts between user names where the same user name is registered on both sites. I've some ideas for that maybe we should decide that someone with the same user name and md5ed password on the two different sites is the same user.




In reply to Jamie Pratt

Re: Cross Site Forum Sync Admin Function

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Goodness, what a nightmare!  wink   Why not just use one site?

Two things that may be related:

  1. You can use RSS as a one way feed of information if you need to - Moodle 1.5 has an RSS client in it and 1.6 may even have a full aggregator.  Feel free to find other ways to deal with RSS feeds.

  2. Moodle 1.5 will also have an email-to-Moodle interface - as time goes by all modules will be able to "catch" incoming mail and deal with it.  So for some purposes people "off the site" can still use Moodle within a comfortable interface (eg a mailer).


In reply to Martin Dougiamas

Re: Cross Site Forum Sync Admin Function

by Zbigniew Fiedorowicz -
There were some ideas along these lines tossed around in the following discussion:
http://moodle.org/mod/forum/discuss.php?d=6487
Perhaps the metacourse notion might have some kind of "metaserver" analog.
In reply to Zbigniew Fiedorowicz

Re: Cross Site Forum Sync Admin Function

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Crosslisting of courses - maybe, and sharing of accounts - sure, but synchronising a forum bi-directionally?  Sticky webs of information ... good luck with that! smile
In reply to Martin Dougiamas

Re: Cross Site Forum Sync Admin Function

by Robert Lefebvre -
>>Why not just use one site?

Hello Martin,

As I mentioned, I'm attempting to get a system for crossing the digital divide and getting computer labs set up in the developing world. There are numerous obstacles to overcome. Their infrastructure barely functions, their budgets non-existant, their tech support, well, they try smile. So if I use one site it would be relegated to that environement and many of Moodle's feautures would be difficult to use at all. And I don't need to remind anyone that in these areas we are talking poor, really poor, and the phone company charges them by the hour to be online. It makes for some tough decisions for them such as do they go online to learn about crop production or disease provention or do they buy food?? If we can get them one site, operating offline, it will let those of us with cheap Internet connections to make courses and download the study material and resources and burn it all to cd for shipment to them. I call it "Internet in a can" (gives a whole new meaning to the term "Spam", doesn't it smile . Much of the time the people in those places use cybercafes for their correspondence. It's almost like a sort of Moodle based correspondence course. In another way I'm using Moodle as the protocol between the groups on each side of the divide.
You are right about it being a nightmare. One site or the other has to be the "master" site. A question, can an RSS feed be reduced to one single outgoing file that could be transported on a floppy, for example, and "transmitted" from another location (such as a cybercafe)? And another, what happens to outgoing emails if the mail is undeliverable for any reason. Does it get stored in a folder until it can be sent (as the "Outbox" in Outlook Express would do)? If so that file could be brought to a cybercafe and mailed in one shot, couldn't it?
    
In reply to Robert Lefebvre

Re: Cross Site Forum Sync Admin Function

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Fair enough, I understand the situation a little better now.

For content I would certainly look at something like a Knoppix CD with Moodle pre-installed, or even a USB stick. You could send further CDs with course backup files and instructions on how to install them in their Moodle.

For communications I would stick to normal email. Moodle 1.6 (maybe 1.5) will support email-to-forums. So these users would subscribe (or be subscribed) to Moodle forums on a central internet-based server. When they go online they can download all their mail, then go offline to read them, making replies as necessary. When they go online their replies will go to the server and be inserted in the forums.   Another solution if you simply need this now is just to set up a completely separate non-Moodle mailing list ... see Yahoo Groups for example.
In reply to Martin Dougiamas

Re: Cross Site Forum Sync Admin Function

by Robert Lefebvre -
It sounds like that feature will certainly take care of the situation. Thank you and all the fantastic developers that bring this about.


In reply to Jamie Pratt

Re: Cross Site Forum Sync Admin Function

by Martín Langhoff -
Definitely RSS. Publish the RSS on one site, display it on the other using RSS client blocks (1.5).

As to Moodle-to-Moodle connectivity, I was going to write an auth plugin to keep 2 Moodles with the same user data, but that's been shelved.

A brief chat with MD pointed me to more elegant alternatives for running things within one Moodle install. Don't cry though -- we'll be doing other kinds of cool stuff instead, and the Auth plugin wasn't such a good idea to start with.
In reply to Jamie Pratt

Re: Cross Site Forum Sync Admin Function

by Martín Langhoff -
If you do end up sending backup XML files around, use md5sum to create a small file with the known-good checksum, and transfer the files plus the file with the checksums.

Then you can run md5sums to validate that the files are complete and correct before importing them.

Still, it's an overcomplicated approach. RSS is your Really Simple Solution in this case.