Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29157

list of courses to import from may be empty for some teachers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: Backup
    • Environment:
      centos 5.6 x86_64, apache 2.2.3, php 5.3.3, postgresql 8.4
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      User has capability moodle/restore:restorecourse on two courses A and B (for example because s/he is an editingteacher)
      User enters course A
      User tries to import content from course B (Settings -> Import)

      If the user is not capable of moodle/restore:restorecourse on one course within the first 250 items retrieved by the query, s/he is presented with an error dialog and no possiblity to search for a specific course

      Show
      User has capability moodle/restore:restorecourse on two courses A and B (for example because s/he is an editingteacher) User enters course A User tries to import content from course B (Settings -> Import) If the user is not capable of moodle/restore:restorecourse on one course within the first 250 items retrieved by the query, s/he is presented with an error dialog and no possiblity to search for a specific course
    • Workaround:
      Hide

      Cf. attached patch for a possible (albeit rather brutal) workaround which discards the limit (0,250) from the call to get_recordset_sql.

      Show
      Cf. attached patch for a possible (albeit rather brutal) workaround which discards the limit (0,250) from the call to get_recordset_sql.
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      Description of the problem
      For certain users at our site, the list of courses to import content from (settings -> import) is empty even though these users are editing teachers in a large number of courses. Furthermore, there is no way to search for specific courses once the error message is shown (contrary to the situation where a user has more than 10 potential courses to import from).

      Likely explaination
      According to our current understanding of moodle/backup/util/ui/restore_ui_components.php, the list of potential source courses is generated along the lines of

      • query (essentially) for all courses, limit the number of courses to (an arbitrary?) number of 250 results by means of $limitfrom/$limitnum parameters to the get_recordset_sql function @ line 167
      • iterate over all results in the recordset
      • determine whether the user has the proper capabilities (in our case this seems to be moodle/restore:restorecourse)
      • If courses where found in that way, display a list of said courses plus a search field to find additional courses outside the scope of this test
      • If no courses where found, display an error message (cf. attached screenshot)

      Our installation is rather large with approximately 600 (editing)teachers and currently about 11000 courses (most of them invisible, but still). Therefore, it is likely that a teacher ends up with an empty list after the first 250 results of the query have been processed. Since the generated dialog offers no means to narrow the search by hand, the user is essentially stuck at this point.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: