Wednesday, April 23, 2014

Trying to figure out the big concept of snyching to an external enrollment DB...

I am still trying to get the concept clear in my mind.  Big picture watson!  Hind sigh is always 20-20.  What will be obvious, once I get there, is not obvious at the moment.

We have a customer of my customer, who has set up an external enrollment DB.  I created it a few months back, using their script.  It is a simple DB consisting of 2 tables, one called enrollments.    My customers customer, we will call them genius.  Genius provides a interface for my customer to add enrollments.  Fine.  I have to get those enrollments to sync with moodle.

It is not much data at all.  3 columns of data exist in the genius DB enrollments table.  That's it.  They are userid, course shortname and role.  That is all that is needed for moodle and the external DB enrollment plugin specs.

That is the big concept, that the DB created for enrollment is the *master enrollment entity.  Moodle wants to *sync up to it.  New enrollment info entered in Genius forms and stored in genius DB.  Moodle needs to *call the enrollments table in the genius DB and push that content to Moodle.

Moodle has a php script called sync.php, that is supost to handle call an internal moodle function that grabs the two pieces of relevant data from the enrollments master table.

I am testing the calling of the sync.php file by adding this line to a windows bat file.

Execute php command from Windows command line

c:\wamp\bin\php\php5.3.13\php.exe -f c:\wamp\www\student\enrol\database\cli\sync.php

For this test, I am executing the php.exe file and passing along the sync.php script.  Makes sense to test the script and see how it is running prior to worry about how it is getting called.  I am currently getting a message "error while communicating with external enrolment database", when I execute the call to sync.php.

Moodle configuration setting

Site admin.  Plugins | Enrollments | External database , moodle doc for help with this page.

I am having trouble calling this file directly in the cron.php script.  The cron.php script is the mechanism to use to CALL THE sync.php script on a regular interval.  Each time this script runs, it fetches a fresh set of data from the genius DB enrollments table AND adds enrollment records to moodle appropriately.

The same process of fetching and updating should take place upon user login too.  This is from moodle docs on the subject

External DB Enrollment - moodle docs

This person in this forum seemed to be facing same error as me....

I was just able to remove the error while executing the sync.php file from the command line (using the help --help, I was able to read something that sparked something else and I changed the user I was using trying to connect to the DB. 






No comments:

Post a Comment