Deleting course category containing over 1,000 courses

Deleting course category containing over 1,000 courses

by Bobby Siegfried -
Number of replies: 3

Hi all,

I am the Moodle admin at my institution and we have recently passed a milestone in Moodle use in courses. We now have categories (by semester) that contain over 1,000 courses. When it comes time to remove these courses from the system, I used to be able to simply delete the course category from Manage courses in the web front-end. However, with so many courses in a category, the process times out and can't complete. Can anyone point me to a plugin or a command line command (preferable) that kicks off the same process as deleting a category from the web front-end does so I can accomplish this task?

Any help is appreciated.

Best regards,

Bob

Average of ratings: -
In reply to Bobby Siegfried

Re: Deleting course category containing over 1,000 courses

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Bob,

I would have thought (though not sure) that a command line php command is subject to the same constraints as via the web.  But this could be a place upon which to investigate the php.ini settings and see if there is a separate timeout for the command line or if you need to temporarily up the timeout (restarting the web server if you do).  Additional: http://php.net/manual/en/info.configuration.php.

The core command line is documented here: https://docs.moodle.org/32/en/Administration_via_command_line - perhaps you could write a local plugin that has a cron cleanup task - https://docs.moodle.org/32/en/Administration_via_command_line#Scheduled_tasks - that progressively deletes the courses in a category using similar code to '/course/delete.php'.

G

In reply to Bobby Siegfried

Re: Deleting course category containing over 1,000 courses

by RTR Admin -

Have you web administrator increase the execution time in your web server's php.ini file to accommodate. That will solve your problem...