Multiple Moodles at one site
Number of replies: 2
I'm setting up multiple moodles on one site. I'm wondering if changing $CFG->dataroot = "/home/workform/moodledata";
by changing moodledata to a variable and feeding the value of it with an include of a custom page and would let me add courses to all the sites from one folder and file. I was thinking to make a custom page that would either set as a unique moodledata folder for each MOODLE or it would set one folder as the source for all the sites. Again, I'm hoping it would let me add new courses to all the sites by doing a restore backup from the one file.
Is ayone running multiple Moodles on one site? Do you have to add a new course to one Moodle at a time?
Thanks
Re: Multiple Moodles at one site
"dataroot" only holds documents, pictures and the like, not the main structure of a course. Most of the data for courses is stored in the database, and "multiple sites" means multiple databases (or one database, but with each table for a site starting with a separate prefix, such as "mdl_" "mdl2_" or whatever).
Each site must have a data folder with a discrete name because the data for each course is stored in a folder that simply has the number of the course as its name. Thus, if you have four sites, there will be four courses with the number '3'.
Now, if you are only concerned about being able to create multiple instances of the same course in different sites, you can upload the course backup .zip file to one of the courses, do the restore and then move the file to the corresponding location in another site's data directory and do a restore again.
Another more permanent solution would be like this:
Say you have this file structure
home/public_html/moodle
home/moodledata1
home/moodledata2
home/moodledata3 (one of these for each site)
You can place the backup file inside home and rename it 'backup.zip':
home/backup.zip
Then, in each of the moodledata areas, you can create a softlink to this file. Go to any course numbered file, and if there is no directory called "backupdata" inside it, create one. Then go inside it and create a softlink (shortcut) to the backup.zip file.
In unix you would say at the prompt: ln -s ../../../backup.zip backup.zip
(There are three sites of "../" because the original file is three levels up.)
Once you have done this for one course in each site, you can then go to that course, click on 'restore' in the admin area and you should see the original backup.zip file and can restore from it.
If you have a second course that you want to recreate in several sites, you can delete the original backup.zip file and rename the new file to "backup.zip" and the links should now point to the new file.
I've tried this on Unix and it works. It doesn't work on Macs if you create a Mac alias but it does work if you create the alias via linux (in terminal mode).
I hope this is what you wanted to know, and I hope it works for you!
Each site must have a data folder with a discrete name because the data for each course is stored in a folder that simply has the number of the course as its name. Thus, if you have four sites, there will be four courses with the number '3'.
Now, if you are only concerned about being able to create multiple instances of the same course in different sites, you can upload the course backup .zip file to one of the courses, do the restore and then move the file to the corresponding location in another site's data directory and do a restore again.
Another more permanent solution would be like this:
Say you have this file structure
home/public_html/moodle
home/moodledata1
home/moodledata2
home/moodledata3 (one of these for each site)
You can place the backup file inside home and rename it 'backup.zip':
home/backup.zip
Then, in each of the moodledata areas, you can create a softlink to this file. Go to any course numbered file, and if there is no directory called "backupdata" inside it, create one. Then go inside it and create a softlink (shortcut) to the backup.zip file.
In unix you would say at the prompt: ln -s ../../../backup.zip backup.zip
(There are three sites of "../" because the original file is three levels up.)
Once you have done this for one course in each site, you can then go to that course, click on 'restore' in the admin area and you should see the original backup.zip file and can restore from it.
If you have a second course that you want to recreate in several sites, you can delete the original backup.zip file and rename the new file to "backup.zip" and the links should now point to the new file.
I've tried this on Unix and it works. It doesn't work on Macs if you create a Mac alias but it does work if you create the alias via linux (in terminal mode).
I hope this is what you wanted to know, and I hope it works for you!
Re: Multiple Moodles at one site
Hello Thomas,
Thanks for the reply and it did help a lot. At least I seem to be on the right page.
I followed everything you wrote until I got to the part about a "softlink".
" In unix you would say at the prompt: ln -s ../../../backup.zip backup.zip"
I code some in php but haven't ever used anything like that. I'm on a shared server; is that why?
If you or someone can guide me through that a little more then that is exactly the ticket.
Thanks for the reply and it did help a lot. At least I seem to be on the right page.

I followed everything you wrote until I got to the part about a "softlink".
" In unix you would say at the prompt: ln -s ../../../backup.zip backup.zip"
I code some in php but haven't ever used anything like that. I'm on a shared server; is that why?
If you or someone can guide me through that a little more then that is exactly the ticket.