Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36673 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2991 invoked from network); 29 Mar 2008 11:45:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2008 11:45:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:42626] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/47-53970-4DB2EE74 for ; Sat, 29 Mar 2008 06:45:26 -0500 Received: from MBOERGER-ZRH (p50867B15.dip.t-dialin.net [80.134.123.21]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 7595711DB3A; Sat, 29 Mar 2008 12:45:21 +0100 (CET) Date: Sat, 29 Mar 2008 12:45:09 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1944269410.20080329124509@marcus-boerger.de> To: Elizabeth M Smith CC: internals@lists.php.net In-Reply-To: <24.59.25926.4B2ECE74@pb1.pair.com> References: <47EC1271.9020405@php.net> <24.59.25926.4B2ECE74@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: phar API From: helly@php.net (Marcus Boerger) 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