@Gamienator Sorry, just didn’t get to take a closer look at this up until today. I think you’ve done a pretty good job considering this is your first time using PHP!
Thinking more about the scenario you have I was wondering if there is a more apropriate way to do this. I don’t understand why you’d want to have users (I suppose you mean admins) start the transfers manually. What I mean is: Someone needs to have image X on FOG server in location Y and so he opens your special website, selects image, clicks send and needs to wait for it to finish before a host can be deployed at location Y. But why is this interaction needed at all I wonder? If I’d be you I’d try to have it all automated as much as possible.
One way would be to just replicate all images to the servers in all locations. Though images might not be needed and it would therefore waste a lot of bandwith to transfer the huge images to locations where they might not be used at all. So I thought about miss-using FOG’s concept of storage groups could be useful for you. Define a storage group for every location you have. Then edit the image settings -> tab “Storage Group” and assign the location/storage group where you want the image to be used. I’d suggest you leave the pre defined “default” Storage Group as is for every image but only add the new “location storage groups” as needed.
Now combine the stuff you’ve come up with already with the settings I mention above: Create a cronjob on your main server that will query the the “Storage Group” information of every image from the database and do the replication to the other servers automatically based on this information. So when people create a new image definition and add the correct “Storage Group” to it the image will be automatically replicated as soon as the image is being captured.
This is all about the raw image data replication. Now for the database there are two scenarios I can imagine. One would be to use MySQL’s capability of replicating (syncing) databases automatically. One of our users just wrote a tutorial on this topic. I’d suggest to not replicate all tables but only sync the images table by using replication filter rules.
The other option is to add a simple mysqldump through SSH tunnel command that grabs all the information from the images table and push it to the other server’s database. It would be wise to also base this on the “Storage Group” information described above so you’d only have the image defintions needed in all the locations.
That’s just my point of view. See what you think and let me know if you need help with this.