]> granicus.if.org Git - php/commitdiff
- Update TODO
authorMarcus Boerger <helly@php.net>
Tue, 30 Jan 2007 20:58:14 +0000 (20:58 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 30 Jan 2007 20:58:14 +0000 (20:58 +0000)
- Add Phar::isFlushing()
- Improve test

ext/phar/TODO
ext/phar/phar_object.c
ext/phar/tests/phar_begin_setstub_commit.phpt

index 6161f84e8521ed7b93fe374b55cbb00f28b9b4df..878a2b44776e7aa7fac046ae3374571e01276552 100644 (file)
@@ -28,8 +28,6 @@ Version 1.0.0
  X Phar archive metadata Phar::setMetaData($metadata) Phar::getMetaData() [Greg]
  X support rename() in stream wrapper [Greg]
  * update docs to reflect changes in error handling
- * update docs to add setStub(), make note about not using it within begin()/commit()
- ? have setStub() throw an exception if used between begin()/commit() [erase if no]
  * fix 011.phpt, 029.phpt for uncaught exceptions causing bad cleanup
  
 Version 1.1.0
@@ -39,3 +37,9 @@ Version 1.1.0
  * implement GPG signing
  * ability to match files containing a metadata key opendir('phar://a.phar/?mime-type=image/jpeg')
    or foreach ($p->match('mime-type', 'image/jpeg') as $file)
+ * Phar::copy($from, $to);
+ * Phar::delete($what)
+ * Phar::buildFromIterator($filename, Iterator $it, array $addinfo = null);
+   $addinfo = array('alias','flags','metadata','stub'...)
+ * Layout: Option to compress all content rather than single files.
+   That excludes stub and anifest haeder.
index e32f6daec8cf9c9e6f36720ead764b265b54648d..758b64c73f48ce78e356d19104ccf41c2bb4d9e5 100755 (executable)
@@ -225,6 +225,17 @@ PHP_METHOD(Phar, begin)
 }
 /* }}} */
 
+/* {{{ proto bool Phar::isFlushing()
+ * Returns whether write operations are flushing to disk immediately
+ */
+PHP_METHOD(Phar, isFlushing)
+{
+       PHAR_ARCHIVE_OBJECT();
+       
+       RETURN_BOOL(!phar_obj->arc.archive->donotflush);
+}
+/* }}} */
+
 /* {{{ proto bool Phar::commit()
  * Save the contents of a modified phar
  */
@@ -1084,23 +1095,24 @@ zend_function_entry php_archive_methods[] = {
        PHP_ME(Phar, __construct,           arginfo_phar___construct,  ZEND_ACC_PRIVATE)
 #else
        PHP_ME(Phar, __construct,           arginfo_phar___construct,  ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, begin,                 NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, commit,                NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, compressAllFilesGZ,    NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, compressAllFilesBZIP2, NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, count,                 NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, getMetadata,           NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, getModified,           NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, getSignature,          NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, getStub,               NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, setStub,               arginfo_phar_setStub,      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, getVersion,            NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, begin,                 NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, compressAllFilesGZ,    NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, compressAllFilesBZIP2, NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, uncompressAllFiles,    NULL,                      ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, commit,                NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, isFlushing,            NULL,                      ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, setMetadata,           arginfo_entry_setMetadata, ZEND_ACC_PUBLIC)
+       PHP_ME(Phar, setStub,               arginfo_phar_setStub,      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, offsetExists,          arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
        PHP_ME(Phar, offsetGet,             arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
        PHP_ME(Phar, offsetSet,             arginfo_phar_offsetSet,    ZEND_ACC_PUBLIC)
        PHP_ME(Phar, offsetUnset,           arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, getMetadata,           NULL,                       0)
-       PHP_ME(Phar, setMetadata,           arginfo_entry_setMetadata,  0)
+       PHP_ME(Phar, uncompressAllFiles,    NULL,                      ZEND_ACC_PUBLIC)
 #endif
        /* static member functions */
        PHP_ME(Phar, apiVersion,            NULL,                      ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
index 9f815da319bbc22a5a424c36d644565116967637..ed9c12b6384d730738cce48431fbbb707bbbff94 100755 (executable)
@@ -9,7 +9,9 @@ phar.readonly=0
 <?php
 $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
 //var_dump($p->getStub());
+var_dump($p->isFlushing());
 $p->begin();
+var_dump($p->isFlushing());
 $p['a.php'] = '<?php var_dump("Hello");';
 $p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>');
 include 'phar://brandnewphar.phar/a.php';
@@ -20,6 +22,7 @@ include 'phar://brandnewphar.phar/b.php';
 var_dump($p->getStub());
 $p->commit();
 echo "===COMMIT===\n";
+var_dump($p->isFlushing());
 include 'phar://brandnewphar.phar/a.php';
 include 'phar://brandnewphar.phar/b.php';
 var_dump($p->getStub());
@@ -30,11 +33,14 @@ var_dump($p->getStub());
 unlink(dirname(__FILE__) . '/brandnewphar.phar');
 ?>
 --EXPECT--
+bool(true)
+bool(false)
 string(5) "Hello"
 string(82) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>"
 string(5) "World"
 string(83) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>"
 ===COMMIT===
+bool(true)
 string(5) "Hello"
 string(5) "World"
 string(83) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>"