Hello Elizabeth,

Friday, March 28, 2008, 2:21:01 PM, you wrote:

> First of all Greg, thanks for all your hard work on phar - however I do
> agree that some of the API choices are going to cause confusion with
> "casual" phar users.

>> 1) if you want to know writability without Phar::canWrite(), you can
>> also use is_writeable('phar:///path/to/archive.phar/index.php') just
>> like you can with any other file

> However Phar::canWrite(); merely tells me if the readonly ini choice is
> flipped, correct? It doesn't relate to the actual file.  While the
> is_writeable function will do what I want for a specific file - I agree
> that a $phar->isWriteable() method would be a nicer (and more intuitive
> for the OO nuts) option.

You are right about Phar::canWrite() however there is also
Phar::isWriteable(). All we have to do is overload it correctly so that it
returns SplFileInfo::isWriteable() && Phar::canWrite().

>> 1) file_put_contents('phar:///path/to/archive.phar/index.php', 'file
>> contents');
>> 2) $phar = new Phar('/path/to/archive.phar');
>> $phar->buildFromIterator(new DirectoryIterator('/some/path'),
>> '/some/path');
>> 3) $phar = new Phar('/path/to/archive.phar'); $phar['index.php'] =
>> file_get_contents('/some/path/index.php');

> I don't know about you, but the common way I work with archives is to
> build a directory structure and just shove it into an archive wholesale
> - although the second option allows this - it's very verbose!  Any
> chance of a $phar = new Phar('/path/to/phar', '/path/to/archive');
> option for the lazy?  Or even a shortcut static
> Phar::create('/path/to/phar', '/path/to/archive') - and no I don't want
> to have to do an iterator too unless I'm worried about filtering what's
> going in, extra steps are usually not a good thing.  the option to have
> it is good, the choice to force it is not.

We liked the Phar::buildFromIterator() approach a lot :-)

Best regards,
 Marcus


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to