Moodle

Need way to extract a single file from a ZIP archive

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: DEV backlog
  • Component/s: Backup, Files API
  • Labels:
  • Environment:
    N/A
  • Affected Branches:
    MOODLE_20_STABLE

Description

I'm working on some extensions to the Backup and Import facilities which will support long-term archiving of courses. Need to support very large archive files into the multiple GB range as these are not uncommon in my installation. Efficient extraction of meta-data from archived courses is a requirement. Since the data is in a single file "moodle.xml", I need to extract that single file efficiently. While this is a single use-case, I think that support for specific file extraction would be generally useful.

I can send code which supports extraction of a single file from a ZIP archive, if there is interest. I am a relative newbie to Moodle development, so am not sure if this is the best way to offer code. Will follow suggestions.

Also, I see the the Backup and Import facilities are still using the legacy ZIP handling code. I would be interested in going through this code and converting it to use Packer.

Activity

Hide
Dan Marsden added a comment -

the single moodle.xml file is likely to change in 2.0 - see Eloys planned changes for 2.0 backup/restore in the wiki.

also - change to using the packer in backup is only really 3 lines of code, but as the files api in Moodle has changed, the biggest work is in grabbing all the files from the right location - IMO we should keep backup in a "Broken" state and push the full change in when complete. Unfortunately a large number of users try to use 2.0 in a production environment and adjusting the code to use the packer might give the illusion that backup is actually working, when in fact it isn't really!

Show
Dan Marsden added a comment - the single moodle.xml file is likely to change in 2.0 - see Eloys planned changes for 2.0 backup/restore in the wiki. also - change to using the packer in backup is only really 3 lines of code, but as the files api in Moodle has changed, the biggest work is in grabbing all the files from the right location - IMO we should keep backup in a "Broken" state and push the full change in when complete. Unfortunately a large number of users try to use 2.0 in a production environment and adjusting the code to use the packer might give the illusion that backup is actually working, when in fact it isn't really!
Hide
Eloy Lafuente (stronk7) added a comment -

Petr, does the new file_packer class has support for partial extracting? Would be interesting to have it?

Any comment about the future of this issue?

TIA and ciao

Show
Eloy Lafuente (stronk7) added a comment - Petr, does the new file_packer class has support for partial extracting? Would be interesting to have it? Any comment about the future of this issue? TIA and ciao
Hide
Petr Škoda (skodak) added a comment -

hmm, underlying api allow is http://www.php.net/manual/en/function.ziparchive-extractto.php , so it should not be difficult.

Show
Petr Škoda (skodak) added a comment - hmm, underlying api allow is http://www.php.net/manual/en/function.ziparchive-extractto.php , so it should not be difficult.

Dates

  • Created:
    Updated: