Your Moodle version

Reports: File trash

Maintained by Picture of Barry Oosthuizen Barry Oosthuizen
Utility for listing, downloading and deleting orphaned files (file no longer referenced in the files db table but still present in the Moodle data and/or backup directory

The files in the Moodle data folder and backup folders are referenced in the "files" table in the database.  If you view the folders themselves you will find the sha1 hash code under which the file has been saved and referenced in the database.  If you have any orphaned files (files no longer referenced by the database but still present on your disk) it will be very difficult to find them.  This utility enables you to immediately receive a list of orphaned files together with the file type and size.  You can download the file to see what it is (the name is a sha1 hash so that won't give you any clues).  If you are happy to delete the file you can select it with the checkbox next to it's description and click delete.  You will be asked for confirmation before the file is finally deleted.

Please note:  This plugin requires the fileinfo PHP extension




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

Comments RSS

Show comments
  • Anthony Borrow
    Mon, Sep 2, 2013, 10:44 PM
    Barry - Many thanks for sharing this report plugin with the Moodle community. I have installed the report and tested and it seems to function well. Before approving, I was wondering if you might change the name of the repository to conform with the Moodle standard - namely moodle-report_filetrash. I realize it is a small detail but it does help us to keep things consistent. Also a documentation link and a screenshot would be helpful. In the version.php file there were a couple of validation warnings. I'm going to mark this as needing more work and let you tidy up these few things but the report looks good and I think will be a help to many site admins trying to keep their file storage clean. Peace - Anthony
  • Anthony Borrow
    Mon, Sep 2, 2013, 10:44 PM
    p.s. - the validation warnings were:

    Maturity information ($plugin->maturity) not found in version.php
    Release name ($plugin->release) not found in version.php
    Release notes not found (searched for files README, README.*)
  • Anthony Borrow
    Mon, Sep 2, 2013, 10:47 PM has information if you have questions about maturity and release. Also, the URL for the website URL was not working so I updated it. Previously it was going to your site's main page. I went ahead and made it specific to your post about this plugin.
  • Picture of Barry Oosthuizen
    Tue, Sep 3, 2013, 6:58 AM
    Hi Anthony, thanks for taking a look at this. I have made the changes as suggested.
  • Picture of Barry Oosthuizen
    Sat, Sep 21, 2013, 7:10 AM
    Hi Anthony, I noticed that I forgot to upload my changes as a new version. I've done that now.
  • Picture of David Mudrák
    Thu, Jun 5, 2014, 5:24 PM
    Hi Barry. Thanks for sharing this report with the community and for fixing the issues mentioned above. I am going to approve it now.
    During the review of the plugin, I found couple of issues that should raise your attention and be fixed in future updates of your

    Your report throws PHP "Notice: Array to string conversion in report/filetrash/lib.php on line 187". Please double check the arrays
    processing there.

    I believe your report should exclude the file /warning.txt in the filepool. It is supposed to stay there for admins who browse the
    moodledata directory.

    I noticed that you create functions in the global PHP scope without the valid frankenstyle prefix. This is strongly discouraged in
    order to prevent collisions with (current and/or future) core code or some other plugin. See for details.

    Please note that leading and trailing whitespace in strings is not supported by Moodle localisation tools. Translators of your
    plugin will be unable to have them in their non-English strings. Please fix your English language pack so that it does not rely on
    whitespace around the string value.

    I believe you would consider this feedback for further versions of your report. Said that, you are cleared to land now. Runway free,
    welcome to Plugins directory!
  • Picture of Anita Bridgman
    Tue, Aug 12, 2014, 2:38 PM
    Hi Barry, I like the sound of this add-on and we were quite keen to try it out. Is there any plan to update this addon to be compatible with Moodle 2.6?
    We just tried installing this on our 3.6.3+ site and when we go to the report we just get a blank page.
  • Picture of Barry Oosthuizen
    Sun, May 17, 2015, 11:30 PM
    Hi Anita, I have updated this plugin with a new version which also supports Moodle 2.6.
  • Picture of Sarah Cotton
    Mon, May 18, 2015, 11:28 PM
    I too had a blank screen on installation - this was solved by enabling php_fileinfo.dll
  • Picture of Barry Oosthuizen
    Tue, May 19, 2015, 4:10 AM
    Thanks Sarah. I have updated the description and the documentation to reflect this requirement
  • Picture of Blair F.
    Fri, May 22, 2015, 2:30 AM
    I am also getting an empty file list. I've checked with our I.T. guy and he says, "It should be okay… it comes with the php-common extension: fileinfo support => enabled" If we, in fact, have no files would the report return "no files found?"
  • Picture of Barry Oosthuizen
    Fri, May 22, 2015, 2:40 AM
    If you have no orphaned files (files which are no longer referenced in the database) a message should appear saying "no files found". Valid files (ones referenced in the db) are not listed.

    If you believe there is a bug you could set debugging to developer and report back what it says here (if anything)
Please login to post comments