Deleting Course

Deleting Course

by Joshua Kingston -
Number of replies: 11

I am having an issue where I am self hosting and not a great site admin but by necessity I am. Anyway I am running Moodle 3.6.2 (Build: 20190114) I am trying to delete a course however when I go to  delete it it gives me a confirmation message asking if i want to delete it then goes to the next page and does nothing no confirmation of deletion. Any help or suggestions? 

Average of ratings: -
In reply to Joshua Kingston

Re: Deleting Course

by Ken Task -
Picture of Particularly helpful Moodlers

Turn on debugging ... all the way to developer.  Then try again.  If there is debug info it will display.  Copy and paste that text into a text document so you can clean it up *IF* there is info you shouldn't share back.   Come back to this forum posting and reply including the debug info.

Note: recently had something similar and went into the course I was deleting and deleted all the resources/links etc. that was in the course.  Then deleted the course.   Didn't have time to debug it.

'SoS', Ken


In reply to Ken Task

Re: Re: Deleting Course

by Joshua Kingston -
I tried that as well thinking that the course was just too big to delete all at once so i went through and deleted everything individually but it still did not delete the whole course afterwards. I will see what I can do with the debugging
In reply to Ken Task

Re: Re: Deleting Course

by Joshua Kingston -

So i set the debugging to developer but I got nothing below is the screen that it gives me everytime i try to delete the course. 

Attachment 2019-05-27.png
In reply to Ken Task

Re: Re: Deleting Course

by Joshua Kingston -
So I went back through and deleted each section of the course itself like i though i had done and then I went into to delete the course itself and got the following debug info. I am not sure what if any information i shouldn't share in from there I don't see anything that could potentially do damage by sharing it

error/cannot_empty_backup_temp_dir

More information about this error

×Debug info:
Error code: cannot_empty_backup_temp_dir
$a contents:
×Stack trace:
line 54 of /backup/util/helper/backup_helper.class.php: backup_helper_exception thrown
line 70 of /backup/util/helper/backup_helper.class.php: call to backup_helper::clear_backup_dir()
line 171 of /backup/util/helper/backup_helper.class.php: call to backup_helper::delete_backup_dir()
line 61 of /backup/moodle2/backup_stepslib.php: call to backup_helper::delete_old_backup_dirs()
line 34 of /backup/util/plan/backup_execution_step.class.php: call to drop_and_clean_temp_stuff->define_execution()
line 181 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 119 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
line 322 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
line 121 of /admin/tool/recyclebin/classes/category_bin.php: call to backup_controller->execute_plan()
line 185 of /admin/tool/recyclebin/lib.php: call to tool_recyclebin\category_bin->store_item()
line 4954 of /lib/moodlelib.php: call to tool_recyclebin_pre_course_delete()
line 67 of /course/delete.php: call to delete_course()
In reply to Joshua Kingston

Re: Re: Re: Deleting Course

by Ken Task -
Picture of Particularly helpful Moodlers

Did the 'more info this error link' link to anything useful ... a page that had suggestions as to what to do/try?

When anything is deleted from a 3.6 moodle now a recyclebin is in play.  Check servers setting for recyclebin. 

Set recyclebin to show all the time ... go into the course and see if there is a recyclebin link in the course admin menu.  Should be able to delete what it shows in that display.

After X days, gets moved to trashdir which when cron runs trashdir gets emptied if the task scheduled to run.,

Could be a lot to delete if you have been making backups of the course and the backups are stored in your private file area.

Check your moodledata/ directory ownerships and permissions - especially moodledata/temp/backup/  to make recyclebin links it uses the backup code to create small .mbz files ... backups ... of modules removed.

And in Site Admin - Server - PHP info, check the settings for 'time for a script to run', memory a script can consume, etc.

'SoS', Ken



In reply to Ken Task

Re: Re: Re: Re: Deleting Course

by Joshua Kingston -
Ken, How do i do "Check your moodledata/ directory ownerships and permissions - especially moodledata/temp/backup/ to make recyclebin links it uses the backup code to create small .mbz files ... backups ... of modules removed."

I am lost....
In reply to Joshua Kingston

Re: Re: Re: Re: Re: Deleting Course

by Ken Task -
Picture of Particularly helpful Moodlers

The error was/is:

"cannot_empty_backup_temp_dir"

Use what ever tool you have to browse files on your servcer - cPanel/Plesk/Webmin/ and command line shell (ssh) are such tools.

Path to your moodledata directory can be found in your moodle code's config.php file.

Ownerships/Permissons kinda depends upon how you are hosted ... shared hosting?   If so, moodledata/temp/backup/ might belong to your login account.

But do take a look in your moodledata/temp/backup/ directory to see what's there.   Deleting modules in a course or an entire course with recyclebin turned on will create backup files ... .mbz's ... and to make those (as well as remove them) moodle should be using moodledata/temp/backup/.    Those end up in the sea of files in moodledata/filedir/ ... but that space one should never mess with.

Did you find the setting for recyclebin and set it to always display?

When you go into the course that you cannot delete is there a 'recyclebin' link in the course admin menu?

'SoS', Ken

In reply to Ken Task

Re: Re: Re: Re: Re: Deleting Course

by Joshua Kingston -

So I found the recycle bin and turned it to always on.  Them I deleted everything thing in the course to make it easier to delete the course. I go to delete the course and it gives me the same error. 

I navigated my way to the moodle data but couldn't find permissions. At this point I guess I'm going to have to find someone to actually go in and do it for me. Because even though I have deleted the files from that course it still shows in my control panel that i haven't gained any storage space.

In reply to Joshua Kingston

Re: Deleting Course

by Joshua Kingston -
Resolved: Thank you Ken for the awesome help!!!!!
In reply to Joshua Kingston

Re: Re: Deleting Course

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!

And for others ... who might see that error ... permissions on moodledata/temp/backup were pretty restrictive ... making them more 'liberal' did the trick.   Able to access that area via cPanel and removed many folders/files.   Also manually removed contents of moodledata/trashdir/ to speed things up a bit.

Josh also had a 'space crunch' ... automated backups turned on and saving not to a designated directory but filedir.  30 gig space getting closer to filling up.

Admin person doesn't have any tool in core that shows disk info ... space used and space available.   Also no core tool for the admin to see all the autobackups and ability to 'control them' ... have to go into each course, pretend to restore, to be able to see and delete the extra autobackup files one doesn't need.

Those backups numbered about 15 and were in the over 500MB ranges (around there) with most recent backups larger than the earlier ones.  Saving grace ... not many courses.

That's a quick summary .... ain't admin of a Moodle grand! :|

'SoS', Ken