[PHP-DEV] phar API update

2008-04-11 Thread Gregory Beaver
Hi, A quick update on Phar's API for those who are keeping score: 1) Phar->isWritable() now works properly and does what Liz was hoping: tells you whether you can actually modify the phar archive by looking at the archive's file perms as well as phar.readonly 2) PharFileInfo->getContent() added t

[PHP-DEV] phar API update

2008-04-09 Thread Gregory Beaver
Hi, I've just implemented these features: 1) new getContents() method allows directly retrieving file contents. Here is a full-circle example: getContents(); ?> 2) addFile/addEmptyDir/addFromString. API is identical to ext/zip addEmptyDir('hello'); var_dump($phar['hello']->isDir()); $phar->add

Re: [PHP-DEV] phar API

2008-03-29 Thread Marcus Boerger
Hello Elizabeth, Friday, March 28, 2008, 7:50:28 PM, you wrote: >>> The only things I see missing are an addFile and addDirectory shortcut >>> methods for when I don't want to mess with all the metadata or creating >>> iterators. >> >> addDirectory() is called createDirectory() in my RFC, just i

Re: [PHP-DEV] phar API

2008-03-28 Thread Steph Fox
No one is complaining about functionality. However I think API issues are more than "prettification" and "wishlist" - maybe not alpha important but certainly beta and release - if I'm not going to be doing fancy manipulation of phars and only want a quick way to create them and run them (which is

Re: [PHP-DEV] phar API

2008-03-28 Thread Elizabeth M Smith
Hiya Steph, >> Not add an empty directory - just add a directory and its contents much >> like the Phar::create would do - an assumption that you want everything >> in that directory inside with no iterators or magic required. > > Hmm.. and how would you tell the difference between: empty directo

Re: [PHP-DEV] phar API

2008-03-28 Thread Steph Fox
Hi Elizabeth, The only things I see missing are an addFile and addDirectory shortcut methods for when I don't want to mess with all the metadata or creating iterators. addDirectory() is called createDirectory() in my RFC, just ignore the return value. What would you like addFile() to do? Addin

Re: [PHP-DEV] phar API

2008-03-28 Thread Elizabeth M Smith
>> The only things I see missing are an addFile and addDirectory shortcut >> methods for when I don't want to mess with all the metadata or creating >> iterators. > > addDirectory() is called createDirectory() in my RFC, just ignore the > return value. What would you like addFile() to do? Adding a

Re: [PHP-DEV] phar API

2008-03-28 Thread Lars Strojny
Hi Elizabeth, Am Freitag, den 28.03.2008, 12:12 -0500 schrieb Elizabeth M Smith: [...] > I'd vote for Phar::canWrite() && is_writable('test.phar') - so you know > if you actually can change the phar. OK, fine. That's how I have it in the proposal too, and Marcus already stated his preference the

Re: [PHP-DEV] phar API

2008-03-28 Thread Elizabeth M Smith
> Elizabeth, et al, the concrete semantic of Phar::isWritable() is what? > Is it just is_writable('test.phar') or is it Phar::canWrite() && > is_writable('test.phar')? I'd vote for Phar::canWrite() && is_writable('test.phar') - so you know if you actually can change the phar. > Benjamin, could y

Re: [PHP-DEV] phar API

2008-03-28 Thread Lars Strojny
Hi everybody, After having a great discussion with Marcus about the Phar API, I've tried to sum up the proposed changes (of course with a strong focus on my opinion about what should be changed :-)). The RFC is not yet finished and I would like you to comment it beforehand. I've tried to include a

Re: [PHP-DEV] phar API

2008-03-28 Thread Benjamin Schulz
On 28.03.2008, at 13:22, Lars Strojny wrote: The issue I have with ArrayAccess is, that an archive represents a multidimensional, nested hash. The way Phar works as an array is doubtful as it represents multi dimensions in a single dimension hash. Very good point! On 28.03.2008, at 13:22, Lar

Re: [PHP-DEV] phar API

2008-03-28 Thread Lars Strojny
Hi Marcus, Am Freitag, den 28.03.2008, 11:17 +0100 schrieb Marcus Boerger: [...] > The above is far too complex. And results in an interface that does not > make clear what it is doing. Right now we have $phar->offsetSet() with a > very clear semantics.  Of course I still prefer $phar->createDire

Re: [PHP-DEV] phar API

2008-03-28 Thread Marcus Boerger
Hello Lars, Thursday, March 27, 2008, 3:07:58 PM, you wrote: > Hi Benjamin, > Am Donnerstag, den 27.03.2008, 14:34 +0100 schrieb Benjamin Schulz: >> Hi, >> i just read the phar examples in the manual and found things like this: > [...] >> First thing: yes i fully understand what the code is doin

Re: [PHP-DEV] phar API

2008-03-28 Thread Marcus Boerger
Hello Benjamin, Thursday, March 27, 2008, 8:58:47 PM, you wrote: > Hi Marcus, >>> First thing: yes i fully understand what the code is doing but i >>> still >>> think that it doesn't need to be so "hackish". >> >> I wouldn't call it hackish. I'd eventually call it new to people that >> haven't

Re: [PHP-DEV] phar API

2008-03-27 Thread Benjamin Schulz
Hi Marcus, First thing: yes i fully understand what the code is doing but i still think that it doesn't need to be so "hackish". I wouldn't call it hackish. I'd eventually call it new to people that haven't used the new PHP 5.0 features yet. I used PHP 5 when it had namespaces the first ti

Re: [PHP-DEV] phar API

2008-03-27 Thread Marcus Boerger
Hello Benjamin, Thursday, March 27, 2008, 2:34:06 PM, you wrote: > Hi, > i just read the phar examples in the manual and found things like this: > $p = new Phar('coollibrary.phar'); > if (Phar::canWrite()) { > $fp = fopen('hugefile.dat', 'rb'); > $p['data/hugefile.dat'] = $fp; > i

Re: [PHP-DEV] phar API

2008-03-27 Thread Lars Strojny
Hi Benjamin, Am Donnerstag, den 27.03.2008, 14:34 +0100 schrieb Benjamin Schulz: > Hi, > i just read the phar examples in the manual and found things like this: [...] > First thing: yes i fully understand what the code is doing but i still > think that it doesn't need to be so "hackish". One thing

[PHP-DEV] phar API

2008-03-27 Thread Benjamin Schulz
Hi, i just read the phar examples in the manual and found things like this: $p = new Phar('coollibrary.phar'); if (Phar::canWrite()) { $fp = fopen('hugefile.dat', 'rb'); $p['data/hugefile.dat'] = $fp; if (Phar::canCompress()) { $p['data/hugefile.dat']->setCompressedGZ(); }