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

No matching courses when importing due to max courses limit

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Backup, Usability
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_20_STABLE
    • Pull Master Branch:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bostelm Henning Bostelmann
              Reporter:
              villalon Jorge Villalon
              Peer reviewer:
              Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Barbara Ramiro, Bas Brands
              Votes:
              52 Vote for this issue
              Watchers:
              26 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: