-
Bug
-
Resolution: Won't Fix
-
Critical
-
None
-
1.9.9
-
None
-
MOODLE_19_STABLE
-
Moderate
-
Trying to delete one big database activity, breaks with memory exhausted problem.
Looking at code, it seems that data_delete_instance() is highly inefficient:
1) It uses one get_records() instead of get_recordset()
2) It instantiated one object for each field and for each record.
3) It uses the delete_content_files() but params doesn't match at all, so I guess it isn't deleting the files at all
I would suggest to:
- Take a look to the code in data_delete_instance() under 2.0.
- For the DB part, backport it for 1.9. It's simple and quick
- For the "potential" files, avoid the delete_content_files() completely and go and delete recursively the directory:
- $CFG->dataroot.'/'.COURSEID.'/'.$CFG->moddata.'/data/'. DATAID
That way there won't be more problems deleting one data instance completely, IMO.
- is duplicated by
-
MDL-26499 Deleting a large database activity module could lead to a memory allocation error crash
-
- Closed
-