Cohort external database

Administration tool ::: tool_cohortdatabase
Maintained by Dan Marsden, Catalyst IT
This plugin creates site-level cohorts using a connection to an external database. (similar to enrol_database plugin but instead of creating enrolments it creates site-level cohorts.)
Latest release:
139 sites
122 downloads
24 fans
Current versions available: 3

This plugin creates site-level cohorts using a connection to an external database. 

  • Can be triggered via CLI and/or scheduled task.
  • Creates site-level cohorts
  • Syncronises users in cohorts
  • Optionally auto create users

Screenshots

Screenshot #0

Contributors

Dan Marsden (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Dan Marsden
    Thu, 31 Mar 2022, 4:28 AM
    @Otaku Dude - this plugin does not support the use of CSV files - it requires access to a database server and queries the database server directly for the information - thanks.
  • Otaku Dude
    Thu, 31 Mar 2022, 4:31 AM
    Thank you for the response Dan. I saw the csv option in the drive list and had hoped it was a file.
  • Dan Marsden
    Thu, 31 Mar 2022, 5:17 AM
    I haven't used the adodb CSV connnector before - not sure if it works, but you could give it a go - it might be ok - just sounds extremely fragile.
  • Otaku Dude
    Fri, 1 Apr 2022, 4:48 PM
    Thank you @Dan, one last question if I may, if we can sort out a db connection, if a student is listed twice with 2 or more different cohort requirements, will the plugin create all cohorts?
  • Dan Marsden
    Mon, 4 Apr 2022, 6:58 AM
    @Otaku - yes. Probably best that you try it out and see if it meets your needs. smile
  • Otaku Dude
    Fri, 13 May 2022, 6:40 PM
    Hiya @Dan we are now trialing the plugin. We have everything set up correctly I think, but we are not getting any cohorts created. I can ping between servers OK, so connection seems to be fine. We are using mssql and have use sybase quite enabled. I have set it to email admin with errors but I am not receiving anything. Is there any troubleshooting documentation, please.
  • Dan Marsden
    Mon, 16 May 2022, 11:30 AM
    @Otaku, Make sure cron is running and check the output of the cohortdatabase task - also try turning on $CFG->showcrondebugging = true; in your config.php to get more output in the cron task.
  • Otaku Dude
    Mon, 16 May 2022, 11:01 PM
    Thank you @Dan, I appreciate your time on this. The only error we see is in task_log table is:
    Starting cohort synchronisation...
    Error while communicating with external cohort database
    I'm not sure when the extra output in the cron task will be?
    Thanks, Nigel (Otaku).
  • Dan Marsden
    Tue, 17 May 2022, 5:05 AM
    @Nigel, that simply means that the adodb library in Moodle can't connect to your external db server - lots of different things that could cause this, (wrong password, firewall issue, missing drivers on the web server etc) but turn debugging on in your cron and it might give you more output.
  • Dan Marsden
    Tue, 17 May 2022, 5:15 AM
    Also @Nigel, hit the "Debug ADOdb connection to external database" checkbox on the cohortdatabase settings page too, along with the showcrondebugging setting you might get some other useful output.
  • Otaku Dude
    Tue, 17 May 2022, 11:55 PM
    Thank you @Dan, that seems to have produced something more useful - Missing extension for mssql. I will pass that on to our IT dept.
  • koen roggemans
    Tue, 30 Aug 2022, 2:44 PM
    Hi Dan, Is it possible to push the latest and greatest version of this plugin to the Moodle plugins database. The new cleanup function looks very cool. Thanks!
  • Dan Marsden
    Wed, 31 Aug 2022, 6:54 AM
    @Koen - I finally got round to adding our github action config to the repo and it's triggered an auto-deploy to the plugins db now - thanks! smile
  • Simon Lewis
    Thu, 16 Mar 2023, 11:07 PM
    Hi Dan,
    Thanks for a great plugin! We use it a lot.

    I've found an issue with PHP 8.0. When running the scheduled task we get the error:
    odbc_free_result(): supplied resource is not a valid ODBC result resource
    I had the same error with one of our custom plugins, that also uses ODBC, so I managed to fix it I think.
    In classes/sync.php I've added $rs->Close(); to line 113, 267, 366. And that seems to fix the task.
    I'll look out for how you do it in an updated version, as you might well do it a different, better way (or there may be issues with how I've done it), but thought I'd report it here nonetheless.

    thanks a lot,
    Simon
  • Dan Marsden
    Fri, 17 Mar 2023, 4:08 AM
    @Simon - nice catch - looks like a sensible change, feel free to submit a pull request so I can merge that into the main branch - thanks!
1 2
Please login to post comments