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

Create a 'Recycle Bin' for course modules

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.9
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_29_STABLE

      Description

      If you delete an activity or resource in error there is now way to undo / recover the item.
      The addition of a “recycle bin” would remedy this. This could be achieved by:

      • Adding a deleted field to the course_modules table (course_modules.deleted) with a default value of 0 (not deleted and visible on the course)
      • When an item is deleted this field is set with the current timestamp indicating it has been “deleted”
      • Extend the course_delete_module function. When the function is first called, it checks if the deleted flag in course_modules is 0, if so then set course_modules.deleted = timenow. When the function is called again, if the flag is > 0 then the rest of the function will continue as normal, without interfering with the existing the processes
      • Modify get_course_mods (lib\datalib.php) to exclude deleted items from rendering in the page (and test \ find other areas where the course modules are queried directly)
      • Add a link to “recycle bin” in the course administration block
      • Add a site admin setting “recycle_bin_retention (or similar) which would accept a value in days
      • Add a routine to cron to call delete functions for all items where (timenow – timestamp) > retention period

      User Interface:

      • Users could delete activities / resources from a course as they do now
      • Users could click a link in the course administration block to go to “recycle bin”
      • The recycle bin would state “items recoverable for x days” at the top of the page (taken from admin setting)
      • Recycle bin would list all recoverable items with:
        • Activity / resource title (name)
        • date deleted from course (course_modules.deleted timestamp)
        • date to clear down (timestamp + retention period)
        • button to permanently delete
        • button to restore to course

      Once items reached their expiry date they would automatically be cleared down by a cron process and removed from the list of recoverable items
      We do not believe there would be any impact on course backup / restore beyond capturing the new course_modules.timestap database field as this code would not be checking the field. Thus any courses backed up / restored should do so with files in the recycle bin / “deleted” status.
      We do not believe we need additional capabilities beyond course:manageactivites particularly as there are no existing capabilities relating specifically to deletion of activites / resources.
      However it may make sense to add a capability for course:recycledelete (or similar) which would control the ability to permanently delete from the recycle bin interface leaving that part of the process to cron.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mikegrant Michael Grant
                Participants:
                Component watchers:
                Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                6 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: