Moodle

Long page loading time when instructor uses Import function and have large number of courses on server

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7
  • Fix Version/s: None
  • Component/s: Course
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

When you have large number of courses on your server, an instructor login and clicks on Administration block > Import, it would take a LONG time for the Import page to load. A lot of times it will eventually time out.

We found a fix already and hope this could be checked into core. Comment out line 35 - 40 in /course/import/activities/mod.php

// if (empty($creator)) { // $cat_courses = get_courses($course->category); // } else { // $cat_courses = array(); // }

No need to show other courses in category since instructors should not be able to import any courses that are not their own and admin can search for other courses. Hope this helps.

  1. courseimport.patch
    16/Nov/07 1:39 AM
    5 kB
    Ann Adamcik
  2. importpatch.txt
    26/Sep/07 1:25 AM
    5 kB
    Ann Adamcik

Issue Links

Activity

Hide
Wen Hao Chuang added a comment -

oops, typo, I mean long loading time. By the way, when you load the server with 40000+ courses, it won't even finish loading the import page sometimes.

Show
Wen Hao Chuang added a comment - oops, typo, I mean long loading time. By the way, when you load the server with 40000+ courses, it won't even finish loading the import page sometimes.
Hide
Ann Adamcik added a comment -

This is a big issue for us, with ~8000 courses. We've had to increase the php max_execution_time, as the import page takes around 30 seconds to load for an instructor, 60 seconds for a site-level course creator, and 150 seconds for a site admin.

There are a couple of related problems with importing:

1) When logged in as a site admin, the 'courses I've taught' dropdown contains ALL courses on the system - it should only show those that the user has actually taught, if any.
2) When logged in as a course creator (with the role assigned for a particular category, not site-wide), neither the category dropdown, nor the search box appears - so a category-level course creator can create a new course in the category, but cannot import anything.

Show
Ann Adamcik added a comment - This is a big issue for us, with ~8000 courses. We've had to increase the php max_execution_time, as the import page takes around 30 seconds to load for an instructor, 60 seconds for a site-level course creator, and 150 seconds for a site admin. There are a couple of related problems with importing: 1) When logged in as a site admin, the 'courses I've taught' dropdown contains ALL courses on the system - it should only show those that the user has actually taught, if any. 2) When logged in as a course creator (with the role assigned for a particular category, not site-wide), neither the category dropdown, nor the search box appears - so a category-level course creator can create a new course in the category, but cannot import anything.
Hide
Ann Adamcik added a comment -

I've rewritten course/import/activities/mod.php so that the import page behaves as follows:

  • For all users, the 'Courses I have taught' displays correctly - e.g. admins and course creators don't get a list of all courses here, only those they have actually taught.
  • The 'Courses in the same category' dropdown, and the search box, will now display for users with course create capability in the system or course category context.
  • If there are more than 100 courses in the same category, the course category dropdown will not be displayed.

Will someone please review the patch, and check it in if it looks reasonable?

Show
Ann Adamcik added a comment - I've rewritten course/import/activities/mod.php so that the import page behaves as follows:
  • For all users, the 'Courses I have taught' displays correctly - e.g. admins and course creators don't get a list of all courses here, only those they have actually taught.
  • The 'Courses in the same category' dropdown, and the search box, will now display for users with course create capability in the system or course category context.
  • If there are more than 100 courses in the same category, the course category dropdown will not be displayed.
Will someone please review the patch, and check it in if it looks reasonable?
Hide
Wen Hao Chuang added a comment -

Martin could we maybe have someone to QA test Ann's patch and see if this could get into CORE? thanks!

Show
Wen Hao Chuang added a comment - Martin could we maybe have someone to QA test Ann's patch and see if this could get into CORE? thanks!
Hide
Ann Adamcik added a comment -

I found a couple of minor issues with the previous patch. Here's a corrected one.

Show
Ann Adamcik added a comment - I found a couple of minor issues with the previous patch. Here's a corrected one.
Hide
Jordan Markus added a comment -

I do agree with the Assignee. Try importing a class list at a time, then go on with your grading. Hope this helps

Show
Jordan Markus added a comment - I do agree with the Assignee. Try importing a class list at a time, then go on with your grading. Hope this helps
Hide
Wen Hao Chuang added a comment -

Just updating this issue as I believe that it is still affecting even the latest 1.9.7+ codes. Also I found that for the course "Reset" it also has the same performance issue. I have created a separate ticket for this (MDL-21588). Thanks!

Show
Wen Hao Chuang added a comment - Just updating this issue as I believe that it is still affecting even the latest 1.9.7+ codes. Also I found that for the course "Reset" it also has the same performance issue. I have created a separate ticket for this (MDL-21588). Thanks!

People

Vote (3)
Watch (5)

Dates

  • Created:
    Updated: