General plugins (Local): Recycle bin

local_recyclebin
Maintained by Picture of Skylar Kelty Skylar Kelty
This plugin adds a "recycle bin" for course modules to Moodle.
71 sites
50 downloads
16 fans
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

Show comments
  • Picture of Roland Sherwood
    Wed, 26 Aug 2015, 7:17 PM
    This is really great - many thanks for putting it together!
  • Picture of Germán Valero
    Wed, 26 Aug 2015, 8:57 PM
    This very useful plugin has a Moodle Docs page at https://docs.moodle.org/29/en/local/Recycle_bin .
    There is a mexican spanish translation available for this plugin.
  • Picture of AM Sanat
    Sun, 30 Aug 2015, 3:20 PM
    Hi
    I have "adobe connect" activity in a course
    When I delete this activity ("adobe connect" activity)
    This activity ("adobe connect" activity) send to Recycle bin
    When I restore "adobe connect" activity from Recycle bin
    It restore to course
    But it is delete from "adobe connect" server
    Please check it
    Thanks
  • Picture of Skylar Kelty
    Tue, 1 Sep 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, 8 Sep 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, 8 Sep 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)
  • Picture of Nicolas Mouillet
    Wed, 7 Oct 2015, 3:18 PM
    Thank you for this plugin. I'll wait after a core integration of the event.
  • Picture of jun wan
    Fri, 11 Dec 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, 15 Dec 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, 4 Jan 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, 5 Jan 2016, 7:46 PM
    @jun wan - I have published a new version which includes these (thanks to Rex Lorenzo)
  • Picture of Marcus Green
    Wed, 17 Feb 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, 18 Feb 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, 11 Mar 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, 19 Sep 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
1 2
Please login to post comments