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

No matching courses when importing due to max courses limit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical Critical
    • None
    • 2.0.2
    • Backup, Usability
    • MySQL
    • MOODLE_20_STABLE
    • Hide

      This needs a Moodle DB with a large number of courses (say, 1000 approx).

      • Create two additional courses, "source" and "target".
      • Create a user "U" and enrol the user as Teacher into both of these courses.
      • Log in as "U" and navigate to "target".
      • Click "Import".

      Verify that the list displayed contains the course "source", and in aprticualr is not empty.

      Show
      This needs a Moodle DB with a large number of courses (say, 1000 approx). Create two additional courses, "source" and "target". Create a user "U" and enrol the user as Teacher into both of these courses. Log in as "U" and navigate to "target". Click "Import". Verify that the list displayed contains the course "source", and in aprticualr is not empty.

      In backup/util/ui/restore_ui_components.php function search(), get_recordset_sql is limited to 250 rows. The import utility in courses generates a search query like this one:

      SELECT c.id,c.fullname,c.shortname,c.visible,c.sortorder , ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM mdl_course c LEFT JOIN mdl_context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = 50) WHERE (LOWER(c.fullname) LIKE LOWER('%%') COLLATE utf8_bin ESCAPE '
      ' OR LOWER(c.shortname) LIKE LOWER('%%') COLLATE utf8_bin ESCAPE '
      ') AND c.id <> 1 ORDER BY c.sortorder;

      Which returns all courses in the site. So if you happen to have more than 250 courses, teachers won't get a single one in the first 250, therefore an empty array will be returned, and a message saying "No matching courses".

      This is beacuse the context is checked after creating the search. I modified the code to get 2500 and 5500 (more than the 4870 we have), and worked, but it was REALLY slow.

            bostelm Henning Bostelmann
            villalon Jorge Villalon
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            52 Vote for this issue
            Watchers:
            24 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.