Table des matières
Data synchronisation by CSV file: Integration guide
Introduction
This guide is intended for system integrators whose mission is to build a complete data integration and synchronisation chain. It presents techniques that generally require system access to the server hosting Moodle.
External feeding of command files
The operator can use the local file manager of the synchronisation tool to drop files to process. They can also trigger a tool to process a file dropped at the last moment.
In some cases, external programs feed the data automatically by supplying the CSV files. As Moodle's file system is opaque, the synchronisation tool automatically reintegrates into its file system any file dropped into the directory:
<moodledata>/sync
This retrieval is done before any action, scheduled or interactive, on any of the integration tools.
Exceptions: files starting with '.' (hidden files) or '_' (omitted files) are not concerned by this synchronisation.
To set up an automated remote feed:
- Prepare a service sftp account (sftp rather than ftp).
- Prepare your remote IS to drop the files to process into the directory mentioned above.
- In the tool configuration, store the corresponding file names in the preconfigurations
- Configure the automatic processing (scheduled tasks) for each of the files to process.
Arbitration at drop time
Moodle must not be able to retrieve a file that is being transferred by FTP. Likewise, an external IS agent must be informed if the local file is being retrieved by Moodle's internal file system.
Two “lock” files are managed by the reintegration process to help with this synchronisation:
- The “lock.txt” file: Indicates that Moodle is in the process of retrieving the external files.
- The “alock.txt” file: To be created by the external agent at the start of its transfer procedure. Moodle tests whether this file exists when it tries to retrieve the external files. Once the transfer is finished, the external IS agent must delete this file.
An alarm is sent by email to the administrator if one of the two files exists and is too old:
- If it is the “lock.txt” file: Moodle makes regular errors when retrieving the file and fails to delete its lock.
- If it is the “alock.txt” file: it is the remote file delivery process that is at fault.
