Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30619

Reset in Data module does not delete file attachment

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Prerequisite
      1. Upload the attached file to your moodle directory.
      2. Edit the function cron() in the file lib/filestorage/file_storage.php and change "$old = time() - 60*60*24*4" to "$old = time()" AND "$CFG->fileslastcleanup < time() - 60*60*24" to "$CFG->fileslastcleanup < time()".
      Test 1
      1. Create a course.
      2. Enrol a few users.
      3. Create a database activity.
      4. Add a file field.
      5. Log in as the enrolled users and add an entry (upload different files of a considerable size (~2mb)).
      6. Visit your moodledata directory and check the size of the filedir (du -hs filedir in shell).
      7. Visit 'Course administration' -> 'Reset'.
      8. Under 'Databases' select 'Delete all entries'.
      9. Click 'Reset course' and then 'Continue'.
      10. Visit <yoursite>/remove_deleted_files.php (the attached file to this issue).
      11. Check that the filedir has decreased in size (du -hs filedir in shell).
      12. Add these entries again as the users you have enrolled (upload different files of a considerable size (~2mb)).
      13. Visit your moodledata directory and check the size of the filedir.
      14. Unenrol one of the users.
      15. Visit 'Course administration' -> 'Reset'.
      16. Under 'Databases' select 'Delete entries by users not enrolled'.
      17. Click 'Reset course' and then 'Continue'.
      18. Visit <yoursite>/remove_deleted_files.php (the attached file to this issue).
      19. Check that the filedir has decreased in size (should only decrease by the size of the file for the unenrolled user).
      Show
      Prerequisite Upload the attached file to your moodle directory. Edit the function cron() in the file lib/filestorage/file_storage.php and change "$old = time() - 60*60*24*4" to "$old = time()" AND "$CFG->fileslastcleanup < time() - 60*60*24" to "$CFG->fileslastcleanup < time()". Test 1 Create a course. Enrol a few users. Create a database activity. Add a file field. Log in as the enrolled users and add an entry (upload different files of a considerable size (~2mb)). Visit your moodledata directory and check the size of the filedir (du -hs filedir in shell). Visit 'Course administration' -> 'Reset'. Under 'Databases' select 'Delete all entries'. Click 'Reset course' and then 'Continue'. Visit <yoursite>/remove_deleted_files.php (the attached file to this issue). Check that the filedir has decreased in size (du -hs filedir in shell). Add these entries again as the users you have enrolled (upload different files of a considerable size (~2mb)). Visit your moodledata directory and check the size of the filedir. Unenrol one of the users. Visit 'Course administration' -> 'Reset'. Under 'Databases' select 'Delete entries by users not enrolled'. Click 'Reset course' and then 'Continue'. Visit <yoursite>/remove_deleted_files.php (the attached file to this issue). Check that the filedir has decreased in size (should only decrease by the size of the file for the unenrolled user).
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-30619_master
    • Sprint:
      BACKEND Sprint 18

      Description

      The function data_reset_userdata in the data module is still using the function fulldelete to delete file attachments.

      I think it should be using the...

      $fs = get_file_storage();
      $fs->delete_area_files(...) 

      methods.

        Attachments

          Activity

            People

            Assignee:
            markn Mark Nelson
            Reporter:
            bazaar Mawuli Kuivi
            Peer reviewer:
            Frédéric Massart
            Integrator:
            Dan Poltawski
            Tester:
            Jetha Chan
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/Jan/15