Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: Enrolments
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      36037

      Description

      This is one of the simplest plugins, it should be very easy to upgrade it...

      1. flatfile_plugin_20100709.patch
        35 kB
        Eugene Venter
      2. flatfile_plugin_20100712.patch
        34 kB
        Eugene Venter

        Activity

        Hide
        Martin Dougiamas added a comment -

        Hi Aaron! This one should be pretty straightforward.

        This module lets the user specify a "flatfile" (CSV) containing enrolment information. On a regular cron cycle, the file is parsed and then deleted. The expectation is that some external process will be regularly dumping updates in this location.

        Look at enrol/database for a good example of the required structure, and the old enrol/flatfile for the logic.

        Note these rules for plugin file names:

        lib.php - the main class (interface)
        locallib.php - any local internal functions never to be used outside of your module
        settings.php - all the settings, to appear in the admin menus in the settings block

        Show
        Martin Dougiamas added a comment - Hi Aaron! This one should be pretty straightforward. This module lets the user specify a "flatfile" (CSV) containing enrolment information. On a regular cron cycle, the file is parsed and then deleted. The expectation is that some external process will be regularly dumping updates in this location. Look at enrol/database for a good example of the required structure, and the old enrol/flatfile for the logic. Note these rules for plugin file names: lib.php - the main class (interface) locallib.php - any local internal functions never to be used outside of your module settings.php - all the settings, to appear in the admin menus in the settings block
        Hide
        Eugene Venter added a comment -

        Hi Petr,

        I am Eugene and I am helping Aaron out on this.

        I think I have finished the necessary changes for the flatfile plugin upgrade; I just need someone to review what I've done, just to make sure that I am on the right track and that I am doing the enrollments right, etc.
        So, please see the attached patchfile and let me know if and where I am going/doing wrong.

        Thanks!

        Show
        Eugene Venter added a comment - Hi Petr, I am Eugene and I am helping Aaron out on this. I think I have finished the necessary changes for the flatfile plugin upgrade; I just need someone to review what I've done, just to make sure that I am on the right track and that I am doing the enrollments right, etc. So, please see the attached patchfile and let me know if and where I am going/doing wrong. Thanks!
        Hide
        Eugene Venter added a comment -

        a patch for the flatfile plugin upgrade to 2.0

        Show
        Eugene Venter added a comment - a patch for the flatfile plugin upgrade to 2.0
        Hide
        Petr Škoda added a comment -

        1/ you forgot to change the copyright :-D
        2/ unenrol_user() instance check is mandatory - it detects dev bugs and enforces good coding style
        3/ $filename = "$CFG->dataroot/1/enrolments.txt"; - hmm, was this always in a public area? If yes, the we should fix it as a security bug in 1.9 and skip migration of this file to new file storage
        4/ unenrolment from all instances is very wrong, you must not touch enrolments of other plugins - never, just your own; alternatively you could "abuse" manual enrolment plugin and let it do the enrolment/unenrolment work
        5/ $roles = $DB->get_records('role', null, '', 'id, name, shortname'); in settings can be used only if roles already set-up

        ciao and thanks

        Show
        Petr Škoda added a comment - 1/ you forgot to change the copyright :-D 2/ unenrol_user() instance check is mandatory - it detects dev bugs and enforces good coding style 3/ $filename = "$CFG->dataroot/1/enrolments.txt"; - hmm, was this always in a public area? If yes, the we should fix it as a security bug in 1.9 and skip migration of this file to new file storage 4/ unenrolment from all instances is very wrong, you must not touch enrolments of other plugins - never, just your own; alternatively you could "abuse" manual enrolment plugin and let it do the enrolment/unenrolment work 5/ $roles = $DB->get_records('role', null, '', 'id, name, shortname'); in settings can be used only if roles already set-up ciao and thanks
        Hide
        Petr Škoda added a comment -

        hmm, you could unenrol from enrol instances that allow manual unenrolment (enrol/manual, enrol/self); the enrolment should be definitely done via enrol/flatfile or enrol/manual

        if you unenrol from or ldap, database the enrolment gets back immediately and you loose some user data (grades, groups, etc.)

        Show
        Petr Škoda added a comment - hmm, you could unenrol from enrol instances that allow manual unenrolment (enrol/manual, enrol/self); the enrolment should be definitely done via enrol/flatfile or enrol/manual if you unenrol from or ldap, database the enrolment gets back immediately and you loose some user data (grades, groups, etc.)
        Hide
        Eugene Venter added a comment -

        Hi Petr,

        Thanks for your feedback, I have made changes accordingly . In response to point 3, yes, the default file location was like this. I just left this for now.

        I have attached a new patch for you to have a look at.

        hope this helps and thanks again!

        Show
        Eugene Venter added a comment - Hi Petr, Thanks for your feedback, I have made changes accordingly . In response to point 3, yes, the default file location was like this. I just left this for now. I have attached a new patch for you to have a look at. hope this helps and thanks again!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: