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

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


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9.4
    • 1.9.3
    • Course
    • None

      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.

            moodle.com Moodle HQ
            samulik Samuli Karevaara
            Petr Skoda Petr Skoda (Inactive)
            0 Vote for this issue
            0 Start watching this issue


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