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

Import search list only checks first 250 courses to list

    Details

    • Testing Instructions:
      Hide

      Under the 4 DBs (mysql, postgres, mssql, oracle)

      • Better if tested against one course having a lot of courses (> 5000). Alternatively, you can hack the $blocksz initial value (5000) to something lower than the total number of courses in the testing site. Also, we can rely on feedback from moodlers for this.

      1) Go to any course, settings block -> import

      2) You wil get the "Find a course to import data from", showing one list of courses (if there is any you can import from) and one search box.

      3) Perform some searches (1-char ones are ok), both by course short-name and full-name.

      4) You get up to 10 matching courses. Results are correct.

      5) Try some search by non-matching short-name or full-name

      6) You get the message "There are no courses to display" and the search box is shown, so a new search can be launched.

      Show
      Under the 4 DBs (mysql, postgres, mssql, oracle) Better if tested against one course having a lot of courses (> 5000). Alternatively, you can hack the $blocksz initial value (5000) to something lower than the total number of courses in the testing site. Also, we can rely on feedback from moodlers for this. 1) Go to any course, settings block -> import 2) You wil get the "Find a course to import data from", showing one list of courses (if there is any you can import from) and one search box. 3) Perform some searches (1-char ones are ok), both by course short-name and full-name. 4) You get up to 10 matching courses. Results are correct. 5) Try some search by non-matching short-name or full-name 6) You get the message "There are no courses to display" and the search box is shown, so a new search can be launched.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      If a user has the required capabilities to import from some courses, but there exists 250 courses before them that they do not have the capability to import from, the search list on the import page is empty and claims theres no courses to import from, the search box also doesn't appear in this instance.

      The problem is this line in 'backup/util/ui/restore_ui_components.php': Line 166:
      $resultset = $DB->get_recordset_sql($sql, $params, 0, 250);

      The search is clearly hardcoded to only check the first 250 courses. By removing the offset and limit, it properly returns a list of courses the user can import from.

      I imagine this was done for performance reasons so we don't end up checking the capabilities across all X number of courses, however simply giving up after a certain number is no good.

      I've attached a small patch that simply removes the limit from the query.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  23 Vote for this issue
                  Watchers:
                  18 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Mar/12