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

Course import runs out of memory when a category has a lot of courses

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.4
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When trying to import resources to a course that is in a large category, PHP runs out of memory. Increasing the memory_limit is the workaround, but Moodle code could be improved also:

      /course/import/activities/mod.php is reading category course information with
      $cat_courses = get_courses($course->category);
      This loads all of the course data for all of the category courses, but then the script only uses the course id and the course full name, as fas as I understand. So it takes a lot more memory than necessary. Default PHP limit of 128M can hold around 1200 courses, we ran out of mem when a category had 1278 courses.

      Could /course/import/activities/mod.php only read the course information that it really needs?

      To reproduce: have a category with a lot of courses (hundreds or thousands) with descrriptions and moddata in them. Reduce the memory_limit of PHP to something like 8M or 16M. Go to a course in a large category and click Import from the admin block. A semi-blank page appears. PHP ran out of memory.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    28/Jan/09