splitbrain/dokuwiki — pull request #140 by splitbrain (2012-11-03 17:54:08+00:00)
Title: New Tar Archive library

Tar file creation was partially broken in our TarLib class and I pushed some changes to fix the most problematic bugs, earlier this morning.

However I still wasn't happy. The API of the class was really crude ( | separated string lists!?) and didn't allow for a memory efficient way of adding files to a new archive (something that would be needed in a backup plugin for example). So I spent the day with rewriting it.

The pull request comes with a brand new class that only uses some of the very low level functions of the old one. This means it breaks compatibility with the old one and therefore I also changed the name.

AFAIK only our plugin manger makes use of the library currently. But if wanted I could add a compatibility function for extracting data. (Since creating tars was broken anyway I don't think we need comp layers there).

I added a couple of very simple tests but some more complex stuff might be a good idea.

For simplicity I did drop the support for modifying existing tar files. This requires stripping of two footer blocks which is not easily done in bzip2 compressed tars because bzip2 is not random accessible and has no support for rewind() and seek(). If someone needs to manipulate a tar file she could simply work with two instances of this class and copy data from one tar to a new one.

Comments?