summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/phar/TODO8
-rwxr-xr-xext/phar/phar_object.c28
-rwxr-xr-xext/phar/tests/phar_begin_setstub_commit.phpt6
3 files changed, 32 insertions, 10 deletions
diff --git a/ext/phar/TODO b/ext/phar/TODO
index 6161f84e85..878a2b4477 100644
--- a/ext/phar/TODO
+++ b/ext/phar/TODO
@@ -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.
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index e32f6daec8..758b64c73f 100755
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -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)
diff --git a/ext/phar/tests/phar_begin_setstub_commit.phpt b/ext/phar/tests/phar_begin_setstub_commit.phpt
index 9f815da319..ed9c12b638 100755
--- a/ext/phar/tests/phar_begin_setstub_commit.phpt
+++ b/ext/phar/tests/phar_begin_setstub_commit.phpt
@@ -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(); ?>"