Moodle
  1. Moodle
  2. MDL-28130

Guest Access Setting duplicating upon restore

    Details

    • Testing Instructions:
      Hide

      Back up a course and restore it, view settings.

      Show
      Back up a course and restore it, view settings.
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      17747

      Description

      When a course is restored, the guest access area within course settings duplicates. If you back up and restore the restored course, it will add another guest access area within settings. This seems to replicate every time a course is restored. It doesn't appear to cause any problems, just an odd duplication.

      1. course-edit_settings.jpg
        68 kB
      2. enrolment-methods.jpg
        85 kB
      3. guestaccess.png
        35 kB

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          I've put it on our backlog and we'll try to get to it as soon as we can.

          In the meantime adding more information, such as screenshots, a workaround or even a code solution, will help us and other users.

          Show
          Michael de Raadt added a comment - Thanks for reporting this. I've put it on our backlog and we'll try to get to it as soon as we can. In the meantime adding more information, such as screenshots, a workaround or even a code solution, will help us and other users.
          Hide
          Matt Fedorko added a comment -

          I am having this problem: http://moodle.org/mod/forum/discuss.php?d=180684 , only with the Import function, not backup/restore – though I suppose they're probably built on the same thing.

          It is much more serious than adding one more copy of Guest Access – I now have 70-ish copies of the thing (screenshot in the forum post) and have only imported maybe 4 or 5 times. As you can imagine, loading 70 copies of that menu bogs down the browser quite a bit.

          Show
          Matt Fedorko added a comment - I am having this problem: http://moodle.org/mod/forum/discuss.php?d=180684 , only with the Import function, not backup/restore – though I suppose they're probably built on the same thing. It is much more serious than adding one more copy of Guest Access – I now have 70-ish copies of the thing (screenshot in the forum post) and have only imported maybe 4 or 5 times. As you can imagine, loading 70 copies of that menu bogs down the browser quite a bit.
          Hide
          Jason Podhorez added a comment -

          This is also encountered if you import from a Meta course (just for clarification). We are seeing it on Course - Edit Settings and on Course - Users - Enrolment methods (uploading screen shots in a moment).

          Show
          Jason Podhorez added a comment - This is also encountered if you import from a Meta course (just for clarification). We are seeing it on Course - Edit Settings and on Course - Users - Enrolment methods (uploading screen shots in a moment).
          Hide
          Hannah Ross added a comment -

          Until this issue gets resolved, you can fix it manually each time by deleting the extra guest access entries under enrollment methods.

          Show
          Hannah Ross added a comment - Until this issue gets resolved, you can fix it manually each time by deleting the extra guest access entries under enrollment methods.
          Hide
          Tayla Craig added a comment -

          After some additional testing, we have found that if restoring a course that was created from scratch in 2.1 the guest access area within settings does not appear to duplicate. However, when restoring a course that was created in 2.0 to 2.1 the guest access duplication issue continues to occur.

          Show
          Tayla Craig added a comment - After some additional testing, we have found that if restoring a course that was created from scratch in 2.1 the guest access area within settings does not appear to duplicate. However, when restoring a course that was created in 2.0 to 2.1 the guest access duplication issue continues to occur.
          Hide
          Mike Holzer added a comment -

          We had 813 instances of guest access that had been created for just a few courses. Here's the SQL I used to wipe them out since it would have taken an bloody long time to delete them one by one on the enrollment page.

          delete FROM enrol where enrol = 'guest';

          Show
          Mike Holzer added a comment - We had 813 instances of guest access that had been created for just a few courses. Here's the SQL I used to wipe them out since it would have taken an bloody long time to delete them one by one on the enrollment page. delete FROM enrol where enrol = 'guest';
          Hide
          Jason Podhorez added a comment -

          I agree with Mike - we have classes with so many that the Course - Edit Settings screen won't even load within the browser's timeout period. Unfortunately I am not that comfortable running sql scripts so we'll probably live with it until fixed.

          Show
          Jason Podhorez added a comment - I agree with Mike - we have classes with so many that the Course - Edit Settings screen won't even load within the browser's timeout period. Unfortunately I am not that comfortable running sql scripts so we'll probably live with it until fixed.
          Hide
          Steve Cuthbert added a comment - - edited

          Same problem here. It seems that not only guest accesses are duplicated, but also self-enrolments. 'Course:Settings>Users>enrolled users>enrolment methods' shows a huge list of both.

          Incidentally, MDL-26722 seems to duplicate this bug report.

          Show
          Steve Cuthbert added a comment - - edited Same problem here. It seems that not only guest accesses are duplicated, but also self-enrolments. 'Course:Settings>Users>enrolled users>enrolment methods' shows a huge list of both. Incidentally, MDL-26722 seems to duplicate this bug report.
          Hide
          Helen Foster added a comment -

          Steve, thanks for pointing out the duplicate issue. Just linking to it...

          Show
          Helen Foster added a comment - Steve, thanks for pointing out the duplicate issue. Just linking to it...
          Hide
          Kory Prince added a comment - - edited

          Just chiming in. This is definitely a major issue. I'm not sure how accurate the original description is. First of all, it's not just the guest access that gets duplicated. The self enrollment also gets duplicated as someone above me said.

          It seems to duplicate on backup, restore, and import.
          In some courses I had accumulated upwards of 7000 extra records. This caused the course to become very slow, and editing would exceed the php max execution time. I plan on looking through the code and seeing if I can't find where it's happening.
          Kory

          Edit:
          a better fix than the other sql command would be to run
          delete from enrol where sortorder>10;

          This takes care of the duplicate self-enrollments as well. It keeps the first 10 in your enrollment list. If you know for sure you only have 2 or 3 for every course you can lower the 10 to 3 or 4.

          Show
          Kory Prince added a comment - - edited Just chiming in. This is definitely a major issue. I'm not sure how accurate the original description is. First of all, it's not just the guest access that gets duplicated. The self enrollment also gets duplicated as someone above me said. It seems to duplicate on backup, restore, and import. In some courses I had accumulated upwards of 7000 extra records. This caused the course to become very slow, and editing would exceed the php max execution time. I plan on looking through the code and seeing if I can't find where it's happening. Kory Edit: a better fix than the other sql command would be to run delete from enrol where sortorder>10; This takes care of the duplicate self-enrollments as well. It keeps the first 10 in your enrollment list. If you know for sure you only have 2 or 3 for every course you can lower the 10 to 3 or 4.
          Hide
          Kory Prince added a comment -

          I would also like to point out that this affect version 2.1.2+. I couldn't figure out how to add that to the bug.
          Kory

          Show
          Kory Prince added a comment - I would also like to point out that this affect version 2.1.2+. I couldn't figure out how to add that to the bug. Kory
          Hide
          Kory Prince added a comment -

          Alright after some testing, I'm not so sure the bug still exists. I tried several things and I could not get the enrollments to duplicate either on a test moodle or the production one where we originally saw the issue. Perhaps the duplicates I found were residue from an older version of moodle. Can anyone confirm that they still have the issue on 2.1.2+?

          I will continue to monitor the issue.
          Kory

          Show
          Kory Prince added a comment - Alright after some testing, I'm not so sure the bug still exists. I tried several things and I could not get the enrollments to duplicate either on a test moodle or the production one where we originally saw the issue. Perhaps the duplicates I found were residue from an older version of moodle. Can anyone confirm that they still have the issue on 2.1.2+? I will continue to monitor the issue. Kory
          Hide
          Matt Fedorko added a comment -

          Kory,

          You're correct that the issue was broader than just the "Guest Access." There were reports elsewhere. I thought that had been folded in here at one point, but maybe not. As far as I know, this issue was fixed at some point. I stopped having the problem after moving from 2.0.2 or so to one of the newer ones – 2.1, maybe? It hasn't happened since, and the SQL above allowed us to remove all of the entries that were slowing us down. My suspicion is someone saw the problem and fixed it without realizing someone had made a bug report. Oh well.

          Show
          Matt Fedorko added a comment - Kory, You're correct that the issue was broader than just the "Guest Access." There were reports elsewhere. I thought that had been folded in here at one point, but maybe not. As far as I know, this issue was fixed at some point. I stopped having the problem after moving from 2.0.2 or so to one of the newer ones – 2.1, maybe? It hasn't happened since, and the SQL above allowed us to remove all of the entries that were slowing us down. My suspicion is someone saw the problem and fixed it without realizing someone had made a bug report. Oh well.
          Hide
          Kory Prince added a comment -

          Thanks Matt.

          I can't seem to close this bug, so whoever is the maintainer, you can close this bug.

          For all those who have this problem, you need to upgrade your moodle to the latest version.

          Note: This WILL NOT fix the problem you already have. There is not going to be a moodle update that corrects the database. It is impossible to know which enrollments were created by a user or by an import.

          However the following SQL should help to clear the problem:

          delete from enrol where not exists (select * from user_enrolments where enrol.id = user_enrolments.enrolid ) and (password is null or enrol="guest") order by courseid;

          This deletes any enrollments that do not have any users in them (Users is zero for that enrollment) and only if is a guest type enrollment or has an enrollment key. So only the following types of enrollments will stay:

          Manual enrollments (with any amount of users including 0)
          Self enrollments if an enrollment key is defined and/or if There is 1 or more user in that enrollment
          guest enrollments if There is 1 or more user in that enrollment
          any custom type of enrollment regardless of how many users it has.

          For us, this cleared up the issue perfectly, but I take no responsibility if it messes up your system. If you want to check before you delete run (Completely Safe):

          select * from enrol where not exists (select * from user_enrolments where enrol.id = user_enrolments.enrolid ) and (password is null or enrol="guest") order by courseid;

          Hope that helps all with the issue. Again I say that an upgrade to a newer version of moodle will not fix what has already been written to the database. You can either run the above SQL, manually remove each entry from the web interface, or delete the course and start over.
          Kory

          Show
          Kory Prince added a comment - Thanks Matt. I can't seem to close this bug, so whoever is the maintainer, you can close this bug. For all those who have this problem, you need to upgrade your moodle to the latest version. Note: This WILL NOT fix the problem you already have. There is not going to be a moodle update that corrects the database. It is impossible to know which enrollments were created by a user or by an import. However the following SQL should help to clear the problem: delete from enrol where not exists (select * from user_enrolments where enrol.id = user_enrolments.enrolid ) and (password is null or enrol="guest") order by courseid; This deletes any enrollments that do not have any users in them (Users is zero for that enrollment) and only if is a guest type enrollment or has an enrollment key. So only the following types of enrollments will stay: Manual enrollments (with any amount of users including 0) Self enrollments if an enrollment key is defined and/or if There is 1 or more user in that enrollment guest enrollments if There is 1 or more user in that enrollment any custom type of enrollment regardless of how many users it has. For us, this cleared up the issue perfectly, but I take no responsibility if it messes up your system. If you want to check before you delete run (Completely Safe): select * from enrol where not exists (select * from user_enrolments where enrol.id = user_enrolments.enrolid ) and (password is null or enrol="guest") order by courseid; Hope that helps all with the issue. Again I say that an upgrade to a newer version of moodle will not fix what has already been written to the database. You can either run the above SQL, manually remove each entry from the web interface, or delete the course and start over. Kory
          Hide
          Helen Foster added a comment -

          Kory and Matt, thanks for your comments. Closing as suggested.

          Show
          Helen Foster added a comment - Kory and Matt, thanks for your comments. Closing as suggested.
          Hide
          Georgia Matheou added a comment -

          I found the same problem on moodle 2.2.4+
          Is there a way to remove this duplication?

          Show
          Georgia Matheou added a comment - I found the same problem on moodle 2.2.4+ Is there a way to remove this duplication?
          Hide
          Helen Foster added a comment -

          Hi Georgia, as this issue is closed, let's watch, vote for and comment on MDL-31497 from now on.

          Show
          Helen Foster added a comment - Hi Georgia, as this issue is closed, let's watch, vote for and comment on MDL-31497 from now on.

            People

            • Votes:
              13 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: