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

Reset and delete all submissions doesn't delete the assignfeedback_editpdf files

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-69570-400
    • MDL-69570-401
    • MDL-69570-master
    • Hide
      • Prerequisite: A Moodle site with a document converter enabled and configured.
      • A course
      • The following must be completed before updating Moodle (running the upgrade).
        1. Add an assignment with default options:
        2. Feedback types: Annotate PDF
        3. Upload multiple PDF submissions by different students.
        4. Log in as a teacher
        5. Grade these submissions, make sure to annotate all of the submissions. Make sure to:
          • Rotate the pdf
          • Add a written comment
          • Add stamps
          • Add highlighting, squares, circles, or lines.
        6. Reset the course
          1. Go to "More > course reuse"
          2. Select "Reset" from the select menu
          3. Click the "Select default" button at the bottom
          4. Click the "Reset course" button at the bottom
        7. Check that you now have orphaned files and table entries with the following query

       SELECT f.contextid, f.component, f.filearea, f.itemid
            FROM mdl_files f
       LEFT JOIN mdl_assign_grades g ON g.id = f.itemid
           WHERE f.component = 'assignfeedback_editpdf'
           AND NOT (filearea = 'stamps' AND f.itemid = 0)
             AND g.id IS NULL
      

      Upgrade test

      1. Update to the most recent version of Moodle and run the upgrade.
      2. When the upgrade has finished run cron
        1. `php admin/cli/cron.php`
      3. Run the above sql code and confirm that there are 0 entries returned
      4. Run the following query and check there are no rotation entries either:

         SELECT er.id
             FROM mdl_assignfeedback_editpdf_rot er
        LEFT JOIN mdl_assign_grades g ON g.id = er.gradeid
            WHERE g.id IS NULL
        

      Future resets of data removes all edit pdf feedback data

      1. Add an assignment with default options:
      2. Feedback types: Annotate PDF
      3. Upload multiple PDF submissions by different students.
      4. Log in as a teacher
      5. Grade these submissions, make sure to annotate all of the submissions. Make sure to:
        • Rotate the pdf
        • Add a written comment
        • Add stamps
        • Add highlighting, squares, circles, or lines.
      6. Reset the course
        1. Go to "More > course reuse"
        2. Select "Reset" from the select menu
        3. Click the "Select default" button at the bottom
        4. Click the "Reset course" button at the bottom
      7. Run the above two sql queries and confirm there are no entries returned (some systemstamps could be returned, not related to this patch).
      Show
      Prerequisite: A Moodle site with a document converter enabled and configured. A course The following must be completed before updating Moodle (running the upgrade). Add an assignment with default options: Feedback types: Annotate PDF Upload multiple PDF submissions by different students. Log in as a teacher Grade these submissions, make sure to annotate all of the submissions. Make sure to: Rotate the pdf Add a written comment Add stamps Add highlighting, squares, circles, or lines. Reset the course Go to "More > course reuse" Select "Reset" from the select menu Click the "Select default" button at the bottom Click the "Reset course" button at the bottom Check that you now have orphaned files and table entries with the following query SELECT f.contextid, f.component, f.filearea, f.itemid FROM mdl_files f LEFT JOIN mdl_assign_grades g ON g.id = f.itemid WHERE f.component = 'assignfeedback_editpdf' AND NOT (filearea = 'stamps' AND f.itemid = 0) AND g.id IS NULL Upgrade test Update to the most recent version of Moodle and run the upgrade. When the upgrade has finished run cron `php admin/cli/cron.php` Run the above sql code and confirm that there are 0 entries returned Run the following query and check there are no rotation entries either: SELECT er.id FROM mdl_assignfeedback_editpdf_rot er LEFT JOIN mdl_assign_grades g ON g.id = er.gradeid WHERE g.id IS NULL Future resets of data removes all edit pdf feedback data Add an assignment with default options: Feedback types: Annotate PDF Upload multiple PDF submissions by different students. Log in as a teacher Grade these submissions, make sure to annotate all of the submissions. Make sure to: Rotate the pdf Add a written comment Add stamps Add highlighting, squares, circles, or lines. Reset the course Go to "More > course reuse" Select "Reset" from the select menu Click the "Select default" button at the bottom Click the "Reset course" button at the bottom Run the above two sql queries and confirm there are no entries returned (some systemstamps could be returned, not related to this patch).

    Description

      When resetting a course and deleting all submissions of an assignment with PDF annotation enabled, we've realized that the submissions are deleted but the assignfeedback_editpdf files linked to them aren't. That leaves orphaned files on the MoodleData, and they can make storage troubles in the long term.

      I don't know if the approach should be to delete them when deleting the submissions or to create a scheduled task looking for and deleting orphaned assignment feedback files.

      Replication steps:

      1. Create a course, enrol a student and create an assignment for file submission with PDF annotation enabled
      2. As a student, submit a file to the assignment (not a PDF, to force the conversion)
      3. As a teacher, go to the "Grade" page of the student's submission (the submission should be converted to PDF when doing it if it wasn't already converted by the scheduled task)
      4. Reset the course checking "Delete all submissions" on the assignment section
      5. As an admin, make a backup with user data and download it
      6. Change the extension from MBZ to ZIP and browse the content. The PDF version of the submission is correctly deleted, but in the files.xml you should find the file again
      7. The file itself should be inside the files folder. On this example is this: files/83/8351695938a60ce9b524ea2e53f29e168a26cf16
      8. I've seen on the database that on the files table most of these orphaned files have these filearea values : readonlypages, pages and combined.

      Attachments

        Issue Links

          Activity

            People

              abgreeve Adrian Greeve
              izendegi Iñigo Zendegi
              Mathew May Mathew May
              Andrew Lyons Andrew Lyons
              Amaia Anabitarte Amaia Anabitarte
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, Amaia Anabitarte, Carlos Escobedo, Laurent David, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              52 Vote for this issue
              Watchers:
              53 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                16/Jan/23

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 days, 4 hours, 48 minutes
                  4d 4h 48m