Re: Re: attempting to work out conversion/compressionAPI
| From: | Gregory Beaver | Date: | Fri, 11 Apr 2008 04:23:39 +0000 |
| Subject: | Re: Re: attempting to work out conversion/compressionAPI | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5367@lists.php.net to get a copy of this message | ||
Gregory Beaver wrote:
> This needs more thought. How does this syntax look:
>
> Phar Phar->convertToExecutable([archiveformat = null][, compression =
> null][, extension = null])
> PharData Phar->convertToData([archiveformat = null][, compression =
> null][, extension = null])
>
> This removes 1 parameter, and completely separates the conversion to an
> executable phar or a data phar. The API is much clearer to read, and
> removes 1 very non-obvious parameter. Most users will use only the
> first 2 parameters. null = keep default format. Now we have:
>
> <?php
> $a = new Phar('blah.phar.tar');
> $b = $a->convertToExecutable(Phar::TAR, Phar::GZ); // create executable
> phar.tar.gz
> $c = $a->convertToData(Phar::ZIP); // create data .zip
> $d = $a->convertToData(); // create data .tar
> $e = $b->convertToData(); // create data .tar.gz
> ?>
This is now implemented (http://news.php.net/php.pecl.cvs/10346)
> I would also like an explicit method of unlinking the underlying file,
> so that one can do:
>
> <?php
> $a = new PharData('blar.tgz');
> $b = $a->convertToExecutable();
> $a->unlink(); // unlinks blar.tgz, and removes it from the manifest
> in-memory
> $a->*() // throws exception - phar is unusable
> $a = new PharData('blar.tgz'); // creates new tgz with no relation to
> blar.tgz
> ?>
After this, the last missing piece is buildFromDirectory().
Greg