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

make_categories_list() is not letting itself use cached category list

    Details

    • Testing Instructions:
      Hide

      For this test you need to login in two browsers as different users (it must be a consistent session)
      Set $CFG->frontpage to display combo list

      1. Window1: login as user who can create course categories, create some categories
      2. Window2: login as user who can not see hidden categories (just ordinary student), click on any course category, make sure the dropdown with the list of categories on the top of the page is correct
      3. Window1: add new category
      4. Window2: make sure the list of categories is updated
      5. Window1: hide any category
      6. Window2: make sure the list of categories is updated
      Show
      For this test you need to login in two browsers as different users (it must be a consistent session) Set $CFG->frontpage to display combo list Window1: login as user who can create course categories, create some categories Window2: login as user who can not see hidden categories (just ordinary student), click on any course category, make sure the dropdown with the list of categories on the top of the page is correct Window1: add new category Window2: make sure the list of categories is updated Window1: hide any category Window2: make sure the list of categories is updated
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      mdl26dev-MDL-40130-let-course-category-caching-be-used

      Description

      In lib/coursecatlib.php, in the function make_categories_list:

              $baselist = $coursecatcache->get($basecachekey);
              if ($baselist !== false) {
                  $baselist = false;
              }
      

      This odd code results in the category list being cached later in the function, but never used.

      On a Moodle with 1315 course categories, /course/index.php?id=x consistently results in about 2700 database queries.

      If this is changed to:

              if (!$baselist = $coursecatcache->get($basecachekey)) {
                  $baselist = false;
              }
      

      Then the same page consistently makes about 100 database queries (at least when the list is still cached).

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/Jul/13