General plugins (Local): Recycle bin

local_recyclebin
Maintained by Picture of Skylar KeltySkylar Kelty
This plugin adds a "recycle bin" for course modules to Moodle.
66 sites
21 downloads
16 fans
Current versions available: 1
This plugin adds a "recycle bin" for course modules to Moodle.

It requires a core hack as there is no pre-cm-deleted event, you will need to add a line to '/course/lib.php' (function course_delete_module), right after the first "if()".

diff --git a/course/lib.php b/course/lib.php
index e49bdf1..5f8d6e6 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -1654,6 +1654,9 @@ function course_delete_module($cmid) {
         return true;
     }
 
+    // Notify the recycle bin plugin.
+    \local_recyclebin\observer::pre_cm_delete($cm);
+
     // Get the module context.
     $modcontext = context_module::instance($cm->id);
 

Potential privacy issues

This will store a backup of user data in Moodle's dataroot.

Screenshots

Screenshot #0
Screenshot #1

Contributors

Picture of Skylar Kelty
Skylar Kelty (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Picture of Skylar Kelty
    Tue, Sep 1, 2015, 3:18 PM
    @AM Sanat - This plugin relies on the activities backup/restore functionality - you'll need to submit an issue to the adobe connect plugin if that isn't how it is supposed to work.
  • Picture of Alexander Bias
    Tue, Sep 8, 2015, 4:25 PM
    Hi Skylar,

    thanks for this useful plugin!

    I think you could improve the necessary core hack by a) throwing a general event in course_delete_module() and catching this event within your plugin instead of notifying your module directly b) creating an issue on tracker.moodle.org to include throwing this event into Moodle core.

    How do you think about that?

    Thanks,
    Alex
  • Picture of Jez H
    Tue, Sep 8, 2015, 8:23 PM
    Hi Skylar,

    Thanks for releasing this, its a bit of a lifesaver!
    This kind of feature should have been in core a long time ago! (as it is with other LMS's)
  • Photo ID
    Wed, Oct 7, 2015, 3:18 PM
    Thank you for this plugin. I'll wait after a core integration of the event.
  • Picture of jun wan
    Fri, Dec 11, 2015, 2:07 AM
    Hi Skylar,
    The plugin is nice. Thank you. As we concern our disk space, may I ask if you can add "14 days and 21 days" as an option for recycle bin retention time? Currently it has 2, 5, 10, 35 days... etc. as the options.
  • Picture of Chris Chapman
    Tue, Dec 15, 2015, 10:56 PM
    Hi Skylar, just updated our site from Moodle 2.9.1 -2.9.3 and also updated your plugin in the process. it seemed to prevent any activities from being deleted? After a few tests we reverted the plugin back to the old version and all was fine and dandy, hust thought I'd let you know.
  • Picture of Skylar Kelty
    Mon, Jan 4, 2016, 5:25 PM
    Hi Chris - if you're updating from a particularly old version you might need to change the hook like (lower-case 'o' on 'observer').
  • Picture of Skylar Kelty
    Tue, Jan 5, 2016, 7:46 PM
    @jun wan - I have published a new version which includes these (thanks to Rex Lorenzo)
  • Picture of Marcus Green
    Wed, Feb 17, 2016, 6:55 PM
    Does this plugin allow entire courses to be stored in the recycle bin for restore later? I can see it showing up in the category management block but when I delete a course the recycle bin always seems to be empty, am I missing something?
  • Picture of Marcus Green
    Thu, Feb 18, 2016, 12:14 AM
    I have found the answer to my question, I just needed to follow the instructions on the github libk for Installation - category recyclebin, and my system will now put deleted courses into the recycle bin, and they can be restored. Very impressive.
  • Picture of Brian Warling
    Fri, Mar 11, 2016, 4:59 AM
    We have been testing the Recycle Bin on our Moodle 2.7 site. It's quite nice. But one issue we came across concerns the restoration of "large" mods. This can take some time. For example, I deleted a large quiz (93 questions) with 155 responses. I was able to restore the quiz, but it took about 3-4 minutes to complete, with the recycle bin page displayed. I think some of our users might think the process has frozen, and either try to navigate somewhere else, close the screen, or quit the browser entirely. A progress bar, like what one sees when a course restore is in process, might be a nice addition to the Recycle Bin. I'm not sure we can go forward with it as-is without some kind of progress indication (apologies if this is a often-discussed issue). Thanks... Brian
  • Picture of Raad Al-Rawi
    Tue, Sep 19, 2017, 9:19 PM
    Hi - We recently upgraded from 3.0 to 3.2 and because we used this plugin in 3.0, we migrated all the recycled content into the core version using the supplied migration script.
    So because the migration copies the recycled files rather than moves them, we are left with the original recycled content in moodledata/recyclebin.
    Is it safe to delete these files once you have migrated? We have not uninstalled the original local/recyclebin plugin (although we have disabled it), so I was wondering if there was any dependency on the original files?

    Thanks

    Raad
  • Picture of William Brewer
    Sun, Jan 7, 2018, 2:01 AM
    What about Recycling Databases or Wiki's? Those are too easy to delete. I just accidently deleted a database and I have to find a solution. On 2.7 now, about to upgrade in next few weeks though.
  • Picture of ibrahim ibrahim
    Sun, Feb 4, 2018, 5:21 AM
    how install this plugin please ?
  • Purple and green cubism
    Wed, May 8, 2019, 8:46 PM
    Hi @Skylar
    Any plans for a 3.5 version? (I expect you're busy, but I'm also happy not to see "Part of set 'Looking for new maintainer'"!)
    Ta, Devon
Please login to post comments