Moodle
  1. Moodle
  2. MDL-36008

Add bulk delete to Legacy Files in 2.3

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.2, 2.5.2, 2.6
    • Fix Version/s: None
    • Component/s: Repositories
    • Labels:
      None
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE

      Description

      At present it is very time consuming to clean up unneeded files in Legacy Files. Often there are imports from 1.9 into 2.x that later need serious purging. Currently it is three clicks per file.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Derek Chirnside added a comment -

            Three clicks to delete a file. There is a related request to be able to bulk delete in Private files as well. http://tracker.moodle.org/browse/MDL-33671

            Show
            Derek Chirnside added a comment - Three clicks to delete a file. There is a related request to be able to bulk delete in Private files as well. http://tracker.moodle.org/browse/MDL-33671
            Hide
            Séverin Terrier added a comment -

            Definetly need this (and also bulk delete at other places) : just cleaned one course, and it's really a lot a wasted time...

            Three clicks per file/folder, plus time to delete and refresh page, when it's big files!

            Show
            Séverin Terrier added a comment - Definetly need this (and also bulk delete at other places) : just cleaned one course, and it's really a lot a wasted time... Three clicks per file/folder, plus time to delete and refresh page, when it's big files!
            Hide
            sean mcclelland added a comment -

            I work on a small team (currently 2 people) and we're migrating courses from Moodle 1.9 to Moodle 2 for everyone in our University that requests it... which is hundreds of courses (so far). The issue of deleting Legacy Course Files, one item at a time, is a huge problem for us. We simply don't have the man-hours to do it. I spent 40 mins today on just one course completing that task.

            A simple "select all / none" and a corresponding "actions" menu that provided a delete option would save us hundreds of hours of work!

            Show
            sean mcclelland added a comment - I work on a small team (currently 2 people) and we're migrating courses from Moodle 1.9 to Moodle 2 for everyone in our University that requests it... which is hundreds of courses (so far). The issue of deleting Legacy Course Files, one item at a time, is a huge problem for us. We simply don't have the man-hours to do it. I spent 40 mins today on just one course completing that task. A simple "select all / none" and a corresponding "actions" menu that provided a delete option would save us hundreds of hours of work!
            Hide
            Derek Chirnside added a comment -

            Sean: I know this is not the best place to post this.
            You may be able to do a migrate and =not= end up with Legacy files: http://docs.moodle.org/23/en/Legacy_course_files#Can_you_migrate_a_course_from_1.9_to_2.2B_and_NOT_end_up_with_a_legacy_files_repository.3F

            -Derek

            Show
            Derek Chirnside added a comment - Sean: I know this is not the best place to post this. You may be able to do a migrate and =not= end up with Legacy files: http://docs.moodle.org/23/en/Legacy_course_files#Can_you_migrate_a_course_from_1.9_to_2.2B_and_NOT_end_up_with_a_legacy_files_repository.3F -Derek
            Hide
            Derek Chirnside added a comment -

            I've been trying to get rid of Legacy files while under certain conditions the fix to MDL-25631 has been making sure they are unconditionally present.

            If we have this, where restoring a course with legacy files in it means you cannot stop them ending up in the restored course, then in my mind some sort of "legacy files" cleanup tool could be good.

            -Derek

            Show
            Derek Chirnside added a comment - I've been trying to get rid of Legacy files while under certain conditions the fix to MDL-25631 has been making sure they are unconditionally present. If we have this, where restoring a course with legacy files in it means you cannot stop them ending up in the restored course, then in my mind some sort of "legacy files" cleanup tool could be good. -Derek
            Hide
            Nicholas Lidden added a comment -

            Would it be possible to bulk delete Legacy files by searching by the contextid?

            Something like:
            DELETE FROM mdl_files
            WHERE (contextid = xxx) AND (filearea = 'legacy').

            I don't know how this would affect any of the linked tables, but just thought I'd throw the idea out there.

            Show
            Nicholas Lidden added a comment - Would it be possible to bulk delete Legacy files by searching by the contextid? Something like: DELETE FROM mdl_files WHERE (contextid = xxx) AND (filearea = 'legacy'). I don't know how this would affect any of the linked tables, but just thought I'd throw the idea out there.
            Hide
            Paul Nijbakker added a comment -

            The legacy courses files were a prerequisite for us to upgrade to Moodle 2.3 back in the day (not having them would have caused major damage). Now that we have settled into the Moodle 2 file system, a major need for cleanup arises, especially since legacy files are part of any import or backup (i.e. you can import one activity from a source course but it will import all the legacy files from that course with it) and this leads to huge courses.

            Show
            Paul Nijbakker added a comment - The legacy courses files were a prerequisite for us to upgrade to Moodle 2.3 back in the day (not having them would have caused major damage). Now that we have settled into the Moodle 2 file system, a major need for cleanup arises, especially since legacy files are part of any import or backup (i.e. you can import one activity from a source course but it will import all the legacy files from that course with it) and this leads to huge courses.
            Hide
            Derek Chirnside added a comment -

            The problem has been (and I can't find the exact reference) that people tend to think like this:

            1) "we really should have bulk delete of Legacy Files"
            2) Well shouldn't we fix the delete of files everywhere, get a consistent UI etc. (Backups, Private files, sections, folders . . .)
            3) answer: yes.
            4) Hmm. Too much like hard work. "Think about something else"

            I think at the moment we are stalled, with no will to work on this. Sadly.

            -Derek

            Show
            Derek Chirnside added a comment - The problem has been (and I can't find the exact reference) that people tend to think like this: 1) "we really should have bulk delete of Legacy Files" 2) Well shouldn't we fix the delete of files everywhere, get a consistent UI etc. (Backups, Private files, sections, folders . . .) 3) answer: yes. 4) Hmm. Too much like hard work. "Think about something else" I think at the moment we are stalled, with no will to work on this. Sadly. -Derek
            Hide
            Michael Woods added a comment -

            I agree with Paul and Derek. Essentially, we had no option but to upgrade to 2.3 with legacy files. We are now on 2.6 and still have lots of legacy files around that we can't just delete without breaking course content. All brand new courses are created without legacy files turned on, so we are not making the problem worse, but the problem just isn't going away. And as Paul said, if we want to import a single activity into a clean course from a course with legacy files, all the legacy files are brought in. Likewise attempting to backup a single activity to share with several colleagues in a course with legacy files - the backup file should be 2kb but is often over 100mb.

            Show
            Michael Woods added a comment - I agree with Paul and Derek. Essentially, we had no option but to upgrade to 2.3 with legacy files. We are now on 2.6 and still have lots of legacy files around that we can't just delete without breaking course content. All brand new courses are created without legacy files turned on, so we are not making the problem worse, but the problem just isn't going away. And as Paul said, if we want to import a single activity into a clean course from a course with legacy files, all the legacy files are brought in. Likewise attempting to backup a single activity to share with several colleagues in a course with legacy files - the backup file should be 2kb but is often over 100mb.
            Hide
            Petr Skoda added a comment -

            mod_book is probably the only plugin that migrated all legacy files to the new storage - see mod_book_migrate_all_areas(), I suppose it would be a requirement to do this in all file areas before legacy files are deleted.

            Show
            Petr Skoda added a comment - mod_book is probably the only plugin that migrated all legacy files to the new storage - see mod_book_migrate_all_areas(), I suppose it would be a requirement to do this in all file areas before legacy files are deleted.
            Hide
            Michael Woods added a comment -

            Thanks Petr.

            I wonder if someone could replicate our coding from mod_book_migrate_all_areas() to say, mod_assign_migrate_all_areas() and mod_label_migrate_all_areas() etc...

            Show
            Michael Woods added a comment - Thanks Petr. I wonder if someone could replicate our coding from mod_book_migrate_all_areas() to say, mod_assign_migrate_all_areas() and mod_label_migrate_all_areas() etc...

              People

              • Votes:
                32 Vote for this issue
                Watchers:
                24 Start watching this issue

                Dates

                • Created:
                  Updated: