Description

When clicking on the 'X' to delete a course, it does not delete the course. From Administration ? Courses ? Add/edit courses, I click on the 'X' next to the course I would like to delete. I am prompted with an 'are you sure?' question and select 'yes.' From there, it forwards to a page where it says 'deleting,' but that's it – it doesn't go anywhere from there and the course never deletes (see attachment). I know I have deleted courses from previous versions, so perhaps there was a bug introduced while fixing another? I am currently running 1.8+ (2007021503).

Activity

I just upgraded to Moodle 1.8.1+ (2007021510) and am still having this same problem; I cannot delete an existing course. There are no errors, the browser does not churn (and says 'Done' at the bottom), and it just sits there and does not perform any action beyond displaying "Deleting MYCOURSE" on the page.

If I put Moodle into DEVELOPER debugging mode, I get this after confirming that I want to delete the course:

If I put Moodle into ALL debugging mode, I get this after confirming that I want to delete the course:

Warning: assignment_delete_instance(/home/httpd/vhosts/httpdocs/moodle/mod/assignment/type/AU/assignment.class.php): failed to open stream: No such file or directory in /home/httpd/vhosts/httpdocs/moodle/mod/assignment/lib.php on line 1667

I'm not sure about the XML error at the top, but obviously this other error is due to a non-existent assignment type that is breaking the deletion process. I tried to go into the course and delete those assignments, but after hitting delete, I would just get a blank page in Moodle. As a last resort, I went ahead into the database and removed the relevant items from the assignment submissions and the assignments tables and was then able to go back into the course and delete those assignments.

After that, I went back to delete the course and it worked. So, we know what was hanging it up. Is there no way to force a course to be deleted, even if it contains non-existent items like this now?

Brian Schmidt
added a comment - 15/Jun/07 10:32 PM I just upgraded to Moodle 1.8.1+ (2007021510) and am still having this same problem; I cannot delete an existing course. There are no errors, the browser does not churn (and says 'Done' at the bottom), and it just sits there and does not perform any action beyond displaying "Deleting MYCOURSE" on the page.
If I put Moodle into DEVELOPER debugging mode, I get this after confirming that I want to delete the course:
XML Parsing Error: no element found
Location: http://server/moodle/course/delete.php?id=83&delete=5dd5d99e19a3eacc02a95eea36098482&sesskey=hS4VKb8eeG
Line Number 116, Column 1:
^
If I put Moodle into ALL debugging mode, I get this after confirming that I want to delete the course:
Warning: assignment_delete_instance(/home/httpd/vhosts/httpdocs/moodle/mod/assignment/type/AU/assignment.class.php): failed to open stream: No such file or directory in /home/httpd/vhosts/httpdocs/moodle/mod/assignment/lib.php on line 1667
Fatal error: assignment_delete_instance(): Failed opening required '/home/httpd/vhosts/httpdocs/moodle/mod/assignment/type/AU/assignment.class.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/httpdocs/moodle/mod/assignment/lib.php on line 1667
I'm not sure about the XML error at the top, but obviously this other error is due to a non-existent assignment type that is breaking the deletion process. I tried to go into the course and delete those assignments, but after hitting delete, I would just get a blank page in Moodle. As a last resort, I went ahead into the database and removed the relevant items from the assignment submissions and the assignments tables and was then able to go back into the course and delete those assignments.
After that, I went back to delete the course and it worked. So, we know what was hanging it up. Is there no way to force a course to be deleted, even if it contains non-existent items like this now?

I can confirm this issue, i found a solution to delete the courses, but - i mean it´s only a solution that i can delete courses, not for more! I hope they will found a finally solution to handle that really BIG problem. The problems did not beginn with deleting the courses, the problems beginn when i copy or drop a course or existing course in and restore them, the assignments are not showing in that course. Same as you, i switch on the debug mode, but i can see only the exactly same error you did published.

Here are the original file from the /mod(assignment/lib.php, beginning with line 1667 to line 1671
require_once("$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php");
$assignmentclass = "assignment_$assignment->assignmenttype";
$ass = new $assignmentclass();
return $ass->delete_instance($assignment);
}

Here you see my solution after i make a "quick dirty" solution, so i can delete the courses, beginning line 1667 and ends now in line 1668

Andy Tagliani
added a comment - 24/Jun/07 10:08 PM Dear Brian
Same Moodle Version
Linux Gentoo
MySQL 5.0.26 / 5.0.38 on another server
PHP 5.2.0 / 5.2.2 on another server
I can confirm this issue, i found a solution to delete the courses, but - i mean it´s only a solution that i can delete courses, not for more! I hope they will found a finally solution to handle that really BIG problem. The problems did not beginn with deleting the courses, the problems beginn when i copy or drop a course or existing course in and restore them, the assignments are not showing in that course. Same as you, i switch on the debug mode, but i can see only the exactly same error you did published.
Here are the original file from the /mod(assignment/lib.php, beginning with line 1667 to line 1671
require_once("$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php");
$assignmentclass = "assignment_$assignment->assignmenttype";
$ass = new $assignmentclass();
return $ass->delete_instance($assignment);
}
Here you see my solution after i make a "quick dirty" solution, so i can delete the courses, beginning line 1667 and ends now in line 1668
$assignmentclass = "assignment_$assignment->assignmenttype";
}
This solution let me delete the courses they need to delete.
Andy

I make a new comment, because i find something out. We support some customers with our hosting service. The problem Brian did pulish and i confirm, this was a existing installation moodle 1.6.x and they make a update from moodle 1.6.x to moodle 1.8.1 or 1.8.1+.

The new installation moodle 1.8.1+ shows different errors (the second case i publish below), the first one like Brian´s comment, the second shows no debug errors, but when they restore a course from a moodle 1.6.x, inside the course are exist a assignment, the restore of a course from moodle 1.6.x on a moodle 18.1+ installation works, but then the teachers can not switch to another assignment type.

Example:
On moodle 1.6.x the choice in assignment was offline activity, they can not switch to another type like online activity or upload a file. To delete a course is not a problem, if the moodle 1.81.x installation is a clean and fresh installation.

Andy Tagliani
added a comment - 26/Jun/07 7:02 AM I make a new comment, because i find something out. We support some customers with our hosting service. The problem Brian did pulish and i confirm, this was a existing installation moodle 1.6.x and they make a update from moodle 1.6.x to moodle 1.8.1 or 1.8.1+.
The new installation moodle 1.8.1+ shows different errors (the second case i publish below), the first one like Brian´s comment, the second shows no debug errors, but when they restore a course from a moodle 1.6.x, inside the course are exist a assignment, the restore of a course from moodle 1.6.x on a moodle 18.1+ installation works, but then the teachers can not switch to another assignment type.
Example:
On moodle 1.6.x the choice in assignment was offline activity, they can not switch to another type like online activity or upload a file. To delete a course is not a problem, if the moodle 1.81.x installation is a clean and fresh installation.
Andy

I have now a screenshot, the teacher have a existing course with assignments (type upload only one file) in moodle 1.6.5 and want restore this course in moodle 1.8.1+. He can restore the course yes, but he can not switch to another type of assignment, example offline activity!

Andy Tagliani
added a comment - 29/Jun/07 1:46 AM I have now a screenshot, the teacher have a existing course with assignments (type upload only one file) in moodle 1.6.5 and want restore this course in moodle 1.8.1+. He can restore the course yes, but he can not switch to another type of assignment, example offline activity!
Andy

I think the problem is that when a course is restored and the xml file references an assignment type (upload and review) that no longer exists.

Then the restore fails at "checking course" and you are stuck. You can't delete the course. You can't load the course. And I don't have a clue as to how to dig out the bits that processed from my database. I was able to edit the course settings to change the shortname so that I could create another course to take its place, but I think that the restore should skip those problem assignments and just print a warning "3 [assignmenttype] assignments not restored" or something like that. I would MUCH rather have to re-create a few assignments than have 5 failed partial courses in my database with no way to remove them.

A. T. Wyatt
added a comment - 21/Aug/07 2:24 AM I will chime in here with yet another story!
I think the problem is that when a course is restored and the xml file references an assignment type (upload and review) that no longer exists.
Then the restore fails at "checking course" and you are stuck. You can't delete the course. You can't load the course. And I don't have a clue as to how to dig out the bits that processed from my database. I was able to edit the course settings to change the shortname so that I could create another course to take its place, but I think that the restore should skip those problem assignments and just print a warning "3 [assignmenttype] assignments not restored" or something like that. I would MUCH rather have to re-create a few assignments than have 5 failed partial courses in my database with no way to remove them.
Thanks,
atw

this problem is most probably caused by a 3rd party assignment type: "AU". Either reinstall it or edit directly the database - replace all AU types in assignment table with some other plugin name. This should solve the problem.

Petr Skoda
added a comment - 21/Aug/07 3:46 AM hello,
this problem is most probably caused by a 3rd party assignment type: "AU". Either reinstall it or edit directly the database - replace all AU types in assignment table with some other plugin name. This should solve the problem.
skodak

As noted in my reply back on 15 June, it was indeed an issue that a non-existent assignment type (AU) was keeping the course from being deleted.

However, I think the issue now is that I don't believe Moodle should go belly-up when deleting (or restoring, as noted above by A.T.) a course. If so, it kind of defeats the purpose of making Moodle open to any developer who wishes to add their module to Moodle as it opens up a host of problems for those administering it if Moodle is going to choke like this.

As was suggested by A.T. above, Moodle should not die during this process, but should instead attempt to skip past items it can't handle and note it to the user at the end of the process, for them to investigate and resolve. Otherwise, we end up with a bunch of garbage courses that are now virtually impossible to remove (or finish restoring) without making the unrecommended jump to manually picking and choosing items to remove from the database in an attempt to get rid of them, which may further hose Moodle down the road.

In my opinion, this is indeed a bug/flaw in Moodle and should not be closed. This is a gap in Moodle's ability that should be addressed.

Brian Schmidt
added a comment - 21/Aug/07 3:56 AM Hi Petr,
As noted in my reply back on 15 June, it was indeed an issue that a non-existent assignment type (AU) was keeping the course from being deleted.
However, I think the issue now is that I don't believe Moodle should go belly-up when deleting (or restoring, as noted above by A.T.) a course. If so, it kind of defeats the purpose of making Moodle open to any developer who wishes to add their module to Moodle as it opens up a host of problems for those administering it if Moodle is going to choke like this.
As was suggested by A.T. above, Moodle should not die during this process, but should instead attempt to skip past items it can't handle and note it to the user at the end of the process, for them to investigate and resolve. Otherwise, we end up with a bunch of garbage courses that are now virtually impossible to remove (or finish restoring) without making the unrecommended jump to manually picking and choosing items to remove from the database in an attempt to get rid of them, which may further hose Moodle down the road.
In my opinion, this is indeed a bug/flaw in Moodle and should not be closed. This is a gap in Moodle's ability that should be addressed.
Thanks,
Brian

I agree moodle could be more tolerant (new feature), but I still think this is not a bug, Administrators can not expect that everything will work without any problems when using 3rd party plugins, modules or extensions. There are other places where things may go wrong too - it might be IMHO better to write a specialized script that checks for common problems - it should go through core tables, find problems and propose solutions - in this case it should IMHO propose converting to other types or brute force deleting of these broken activities...

The problem with assignment mod is that it needs a maintainer - somebody who would be willing to work on it an keep improving it

If anybody has a patch for assignment please submit it here + reopen and we could discuss it here.

Petr Skoda
added a comment - 21/Aug/07 6:44 AM - edited I agree moodle could be more tolerant (new feature), but I still think this is not a bug, Administrators can not expect that everything will work without any problems when using 3rd party plugins, modules or extensions. There are other places where things may go wrong too - it might be IMHO better to write a specialized script that checks for common problems - it should go through core tables, find problems and propose solutions - in this case it should IMHO propose converting to other types or brute force deleting of these broken activities...
The problem with assignment mod is that it needs a maintainer - somebody who would be willing to work on it an keep improving it
If anybody has a patch for assignment please submit it here + reopen and we could discuss it here.

First thank you for your patience. From my point, it is really not a bug, because we support hundreds of moodle installations, and only at some installations they have this 3rd party feature "Upload & Review" in moodle 1.6x or 1.7x installed we have this trouble.

I´m sorry Petr that i published my really makes with a hot needle solution, but i must solve this problems for our customers, i see no other chance at this time.

Andy Tagliani
added a comment - 21/Aug/07 7:08 AM Petr
First thank you for your patience. From my point, it is really not a bug, because we support hundreds of moodle installations, and only at some installations they have this 3rd party feature "Upload & Review" in moodle 1.6x or 1.7x installed we have this trouble.
I´m sorry Petr that i published my really makes with a hot needle solution, but i must solve this problems for our customers, i see no other chance at this time.
Andy

Please will you check, see lines from 2327 to 2332 in the file /moodle/assignment/lib.php

It can be, that these lines make some trouble when restore a backup file from a different moodle version and or with 3rd party extensions or plugins. It looks like the code from these file you removed, see below:

I´m sure this code will be needed, but i mean that these lines are the actual problem releases, that you can´t delete a damage assignment module installation in a course. It is not a moodle problem, it is a 3rd party issue!

Andy Tagliani
added a comment - 22/Aug/07 1:46 AM Petr
Please will you check, see lines from 2327 to 2332 in the file /moodle/assignment/lib.php
It can be, that these lines make some trouble when restore a backup file from a different moodle version and or with 3rd party extensions or plugins. It looks like the code from these file you removed, see below:
require_once("$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php");
$assignmentclass = "assignment_$assignment->assignmenttype";
$ass = new $assignmentclass($coursemodule->id, $assignment);
return $ass->get_coursemodule_info($coursemodule);
}
I´m sure this code will be needed, but i mean that these lines are the actual problem releases, that you can´t delete a damage assignment module installation in a course. It is not a moodle problem, it is a 3rd party issue!
Andy Tagliani

I am sorry I do not understand the problem you are describing now.
Does my patch work for you when deleting broken assignments or course that contains them?

Restoring of backups with 3rd party assignment plugins is not supported - there would have to be extra check in restore code. Please file a separate bug if this is the problem you are describing, thanks.

Petr Skoda
added a comment - 22/Aug/07 4:31 AM I am sorry I do not understand the problem you are describing now.
Does my patch work for you when deleting broken assignments or course that contains them?
Restoring of backups with 3rd party assignment plugins is not supported - there would have to be extra check in restore code. Please file a separate bug if this is the problem you are describing, thanks.

I restore today again backup files from new customers of our company. The first error warning (when i switch on the degug mode) comes from the line 2327, this is the reason why i wrote, can you take a look of this lines, if there can be a problem too.

Andy Tagliani
added a comment - 22/Aug/07 4:46 AM Petr
I restore today again backup files from new customers of our company. The first error warning (when i switch on the degug mode) comes from the line 2327, this is the reason why i wrote, can you take a look of this lines, if there can be a problem too.
I solve this problem myself before i read your fix.
Andy

You´re right, i should tell you the line in your fixed version, sorry!

In your fixed version (lib.php,v 1.219.2.14 2007/08/21 09:23:37) are the lines from 2336 to 2341. The former Version has no file number, and the moodle version was/is 1.8.2.+ from 2007/08/17, this was the day i make a new installation where i again found this problems.

So i can not reproduce the problem at the moment, because i have not a damage backup file at this time! I´m sure it will come back again, when we switch with another school from moodle 1.6 to moodle 1.8.2. First at this moment i can tell you if your fix works, but Petr, i´m sure that your fix will work!

Andy Tagliani
added a comment - 22/Aug/07 5:04 AM Petr
You´re right, i should tell you the line in your fixed version, sorry!
In your fixed version (lib.php,v 1.219.2.14 2007/08/21 09:23:37) are the lines from 2336 to 2341. The former Version has no file number, and the moodle version was/is 1.8.2.+ from 2007/08/17, this was the day i make a new installation where i again found this problems.
So i can not reproduce the problem at the moment, because i have not a damage backup file at this time! I´m sure it will come back again, when we switch with another school from moodle 1.6 to moodle 1.8.2. First at this moment i can tell you if your fix works, but Petr, i´m sure that your fix will work!
Thanks
Andy

Here is a test file that came from a 1.6.3 system that had upload and review installed. The fixes posted in mod/assignment/lib.php from Aug 22, 2007 12:42 pm do not allow me to restore this course, but they DO allow me to delete it. Thank you very much!

A. T. Wyatt
added a comment - 26/Aug/07 10:12 PM Here is a test file that came from a 1.6.3 system that had upload and review installed. The fixes posted in mod/assignment/lib.php from Aug 22, 2007 12:42 pm do not allow me to restore this course, but they DO allow me to delete it. Thank you very much!