From 32cf614c31228cee1af4e09e7449c123a706f6cb Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Sun, 24 Apr 2016 23:02:29 +0200 Subject: [PATCH 01/15] fix PHP >5.2 compile error (changing TSRMLS_DC to TSRMLS_CC) --- augeas.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/augeas.c b/augeas.c index 997ff84..8674c63 100644 --- a/augeas.c +++ b/augeas.c @@ -148,7 +148,11 @@ static zend_object_value augeas_object_new(zend_class_entry *class_type TSRMLS_D ALLOC_HASHTABLE(intern->zo.properties); zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); +#if PHP_VERSION_ID < 50399 zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); +#else + object_properties_init((zend_object*) &(intern->zo), class_type); +#endif retval.handle = zend_objects_store_put(intern, augeas_object_dtor, NULL, NULL TSRMLS_CC); retval.handlers = zend_get_std_object_handlers(); @@ -163,10 +167,16 @@ static zend_object_value augeas_object_new(zend_class_entry *class_type TSRMLS_D PHP_MINIT_FUNCTION(augeas) { zend_class_entry ce, ce_exception; + zend_class_entry *default_exception=NULL; /* Register AugeasException class (inherits Exception) */ INIT_CLASS_ENTRY(ce_exception, "AugeasException", NULL); - augeas_ce_AugeasException = zend_register_internal_class_ex(&ce_exception, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_DC); + #if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 2) + default_exception= zend_exception_get_default(); + #else + default_exception= zend_exception_get_default(TSRMLS_C); + #endif + augeas_ce_AugeasException = zend_register_internal_class_ex(&ce_exception, default_exception, NULL TSRMLS_CC); /* Register Augeas class */ INIT_CLASS_ENTRY(ce, "Augeas", augeas_methods); @@ -223,11 +233,11 @@ PHP_METHOD(Augeas, __construct) RETURN_FALSE; } - if (php_check_open_basedir(root TSRMLS_DC) != 0) { + if (php_check_open_basedir(root TSRMLS_CC) != 0) { RETURN_FALSE; } - obj = (php_augeas_object *) zend_object_store_get_object(getThis() TSRMLS_DC); + obj = (php_augeas_object *) zend_object_store_get_object(getThis() TSRMLS_CC); obj->augeas = aug_init(root, loadpath, flags); if (!obj->augeas) zend_throw_exception(augeas_ce_AugeasException, "could not initialize augeas resource", 0 TSRMLS_CC); From aa9f5fd3e87221bb43ec8b873d1cab9f4fad0285 Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Mon, 25 Apr 2016 00:24:42 +0200 Subject: [PATCH 02/15] add libxml2 setup in config.m4 --- config.m4 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/config.m4 b/config.m4 index 85ccf78..62d1789 100644 --- a/config.m4 +++ b/config.m4 @@ -1,3 +1,19 @@ +dnl Configuring the LibXML external Library +if test -z "$PHP_LIBXML_DIR"; then + PHP_ARG_WITH(libxml-dir, libxml2 install dir, + [ --with-libxml-dir=[DIR] php-augeas : libxml2 install prefix], no, no) +fi + +if test "$PHP_LIBXML" = "no"; then + AC_MSG_ERROR([php-augeas extension requires LIBXML extension, add --with-libxml-dir]) +fi + +PHP_SETUP_LIBXML(XML_SHARED_LIBADD, [ + PHP_ADD_EXTENSION_DEP(xml, libxml) +], [ + AC_MSG_ERROR([xml2-config not found. Use --with-libxml-dir=]) +]) + PHP_ARG_WITH(augeas,for AUGEAS support, [ --with-augeas[=DIR] Include AUGEAS support]) @@ -20,7 +36,7 @@ if test "$PHP_AUGEAS" != "no"; then done if test -z "$AUGEAS_DIR"; then - AC_MSG_ERROR(Cannot find libaugeas) + AC_MSG_ERROR(Cannot find libaugeas use --with-augeas=) fi AUGEAS_LIBDIR=$AUGEAS_DIR/$PHP_LIBDIR @@ -31,5 +47,6 @@ if test "$PHP_AUGEAS" != "no"; then PHP_NEW_EXTENSION(augeas, augeas.c, $ext_shared) PHP_SUBST(AUGEAS_SHARED_LIBADD) + PHP_SUBST(XML_SHARED_LIBADD) AC_DEFINE(HAVE_AUGEAS,1,[ ]) fi From e973dfbbd3fa17351b69f6cb07fe39914b9f1114 Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Mon, 25 Apr 2016 00:26:51 +0200 Subject: [PATCH 03/15] upgrade the version --- php_augeas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_augeas.h b/php_augeas.h index c8c3243..7dc0846 100644 --- a/php_augeas.h +++ b/php_augeas.h @@ -32,7 +32,7 @@ extern zend_module_entry augeas_module_entry; #include "TSRM.h" #endif -#define PHP_AUGEAS_VERSION "0.6.1" +#define PHP_AUGEAS_VERSION "0.6.2" typedef struct _php_augeas_object { zend_object zo; From b3bbaf39aa2d6c0e050c62a4fb12e93fbee1047b Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:30:56 +0200 Subject: [PATCH 04/15] passage en markdown --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From 4f3415d025dd30b1948028894bd0c6d8dc0116a6 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:33:02 +0200 Subject: [PATCH 05/15] Update README.md --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b4466a..1c20210 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,31 @@ -INSTALL -========================================================================== +### INSTALL Install instructions (you’ll need php5 dev package): +``` $ pecl install augeas +``` or from the git repo: +``` $ git clone git://github.com/ppadron/php-augeas.git $ cd php-augeas $ phpize $ ./configure $ make $ make install +``` Create a file called augeas.ini in your PHP conf.d directory containing: +``` extension=augeas.so +``` +### API REFERENCE -API REFERENCE -========================================================================== - +``` void Augeas::__construct([string $root[, string $loadpath[, int $flags]]]) string Augeas::get(string $path) array Augeas::match(string $path); @@ -30,16 +34,25 @@ boolean Augeas::rm($augeas, string $path); boolean Augeas::insert(string $path, string $label, int $order); boolean Augeas::mv(string $source, string $destination); boolean Augeas::save(); +``` Constants used as $flags in Augeas::__construct() +``` Augeas::AUGEAS_NONE = 0 Augeas::AUGEAS_SAVE_BACKUP = 1 Augeas::AUGEAS_SAVE_NEWFILE = 2 Augeas::AUGEAS_TYPE_CHECK = 4 Augeas::AUGEAS_NO_STDINC = 8 +``` Constants used as $order in Augeas::insert() +``` Augeas::AUGEAS_INSERT_BEFORE = 0 Augeas::AUGEAS_INSERT_AFTER = 1 +``` + +### Example + +$this->augeas = new Augeas( From dd0d4f278b81b763435aa2d67d39ac4c214f096c Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:37:22 +0200 Subject: [PATCH 06/15] Update README.md --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c20210..5204fcb 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,25 @@ Augeas::AUGEAS_INSERT_AFTER = 1 ### Example -$this->augeas = new Augeas( +```php +get("/files/etc/hosts/1/ipaddr")."\n"; +echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; +echo $augeas->get("/files/etc/hosts/1/alias")."\n"; + +$expectedArray = array( + "/files/etc/hosts/1/ipaddr" => "127.0.0.1", + "/files/etc/hosts/1/canonical" => "localhost", + "/files/etc/hosts/1/alias" => "localhost.localdomain", +); +$matches = $augeas->match("/files/etc/hosts/1/*"); +var_dump($matches); + +echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; +$augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); +echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; + +?> +``` From 9075339740de1a5bfd41b63d983533c4f2cc16fe Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:41:18 +0200 Subject: [PATCH 07/15] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 5204fcb..82816d6 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,12 @@ Augeas::AUGEAS_INSERT_AFTER = 1 get("/files/etc/hosts/1/ipaddr")."\n"; echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; echo $augeas->get("/files/etc/hosts/1/alias")."\n"; +// match $expectedArray = array( "/files/etc/hosts/1/ipaddr" => "127.0.0.1", "/files/etc/hosts/1/canonical" => "localhost", @@ -71,9 +73,22 @@ $expectedArray = array( $matches = $augeas->match("/files/etc/hosts/1/*"); var_dump($matches); +// mv echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; $augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; +// rm and save +$augeas->rm('/files/etc/hosts/1/ipaddr'); +$augeas->save(); + +// inserting before the first comment +$beforeFirstComment = "comment inserted before the first comment"; +$firstComment = "first comment"; +$augeas->insert("/files/etc/hosts/#comment", "#comment", Augeas::AUGEAS_INSERT_BEFORE); +$augeas->set("/files/etc/hosts/#comment[1]", $beforeFirstComment); +echo $augeas->get("/files/etc/hosts/#comment[1]")."\n"; +echo $augeas->get("/files/etc/hosts/#comment[2]")."\n"; + ?> ``` From 5881478bc9af3f32f176970d763f135053fbd18e Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:41:47 +0200 Subject: [PATCH 08/15] Update README.md --- README.md | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 82816d6..476354a 100644 --- a/README.md +++ b/README.md @@ -57,38 +57,38 @@ Augeas::AUGEAS_INSERT_AFTER = 1 ```php get("/files/etc/hosts/1/ipaddr")."\n"; -echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; -echo $augeas->get("/files/etc/hosts/1/alias")."\n"; - -// match -$expectedArray = array( - "/files/etc/hosts/1/ipaddr" => "127.0.0.1", - "/files/etc/hosts/1/canonical" => "localhost", - "/files/etc/hosts/1/alias" => "localhost.localdomain", -); -$matches = $augeas->match("/files/etc/hosts/1/*"); -var_dump($matches); - -// mv -echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; -$augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); -echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; - -// rm and save -$augeas->rm('/files/etc/hosts/1/ipaddr'); -$augeas->save(); - -// inserting before the first comment -$beforeFirstComment = "comment inserted before the first comment"; -$firstComment = "first comment"; -$augeas->insert("/files/etc/hosts/#comment", "#comment", Augeas::AUGEAS_INSERT_BEFORE); -$augeas->set("/files/etc/hosts/#comment[1]", $beforeFirstComment); -echo $augeas->get("/files/etc/hosts/#comment[1]")."\n"; -echo $augeas->get("/files/etc/hosts/#comment[2]")."\n"; + $augeas = new Augeas(); + + // gets + echo $augeas->get("/files/etc/hosts/1/ipaddr")."\n"; + echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; + echo $augeas->get("/files/etc/hosts/1/alias")."\n"; + + // match + $expectedArray = array( + "/files/etc/hosts/1/ipaddr" => "127.0.0.1", + "/files/etc/hosts/1/canonical" => "localhost", + "/files/etc/hosts/1/alias" => "localhost.localdomain", + ); + $matches = $augeas->match("/files/etc/hosts/1/*"); + var_dump($matches); + + // mv + echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; + $augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); + echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; + + // rm and save + $augeas->rm('/files/etc/hosts/1/ipaddr'); + $augeas->save(); + + // inserting before the first comment + $beforeFirstComment = "comment inserted before the first comment"; + $firstComment = "first comment"; + $augeas->insert("/files/etc/hosts/#comment", "#comment", Augeas::AUGEAS_INSERT_BEFORE); + $augeas->set("/files/etc/hosts/#comment[1]", $beforeFirstComment); + echo $augeas->get("/files/etc/hosts/#comment[1]")."\n"; + echo $augeas->get("/files/etc/hosts/#comment[2]")."\n"; ?> ``` From ce80967c025b014c9af51e366470e644fa98e5a0 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:42:02 +0200 Subject: [PATCH 09/15] Update README.md --- README.md | 64 +++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 476354a..82816d6 100644 --- a/README.md +++ b/README.md @@ -57,38 +57,38 @@ Augeas::AUGEAS_INSERT_AFTER = 1 ```php get("/files/etc/hosts/1/ipaddr")."\n"; - echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; - echo $augeas->get("/files/etc/hosts/1/alias")."\n"; - - // match - $expectedArray = array( - "/files/etc/hosts/1/ipaddr" => "127.0.0.1", - "/files/etc/hosts/1/canonical" => "localhost", - "/files/etc/hosts/1/alias" => "localhost.localdomain", - ); - $matches = $augeas->match("/files/etc/hosts/1/*"); - var_dump($matches); - - // mv - echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; - $augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); - echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; - - // rm and save - $augeas->rm('/files/etc/hosts/1/ipaddr'); - $augeas->save(); - - // inserting before the first comment - $beforeFirstComment = "comment inserted before the first comment"; - $firstComment = "first comment"; - $augeas->insert("/files/etc/hosts/#comment", "#comment", Augeas::AUGEAS_INSERT_BEFORE); - $augeas->set("/files/etc/hosts/#comment[1]", $beforeFirstComment); - echo $augeas->get("/files/etc/hosts/#comment[1]")."\n"; - echo $augeas->get("/files/etc/hosts/#comment[2]")."\n"; +$augeas = new Augeas(); + +// gets +echo $augeas->get("/files/etc/hosts/1/ipaddr")."\n"; +echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; +echo $augeas->get("/files/etc/hosts/1/alias")."\n"; + +// match +$expectedArray = array( + "/files/etc/hosts/1/ipaddr" => "127.0.0.1", + "/files/etc/hosts/1/canonical" => "localhost", + "/files/etc/hosts/1/alias" => "localhost.localdomain", +); +$matches = $augeas->match("/files/etc/hosts/1/*"); +var_dump($matches); + +// mv +echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; +$augeas->mv("/files/etc/hosts/1/canonical", "/files/etc/hosts/1/alias"); +echo $this->augeas->get("/files/etc/hosts/1/alias")."\n"; + +// rm and save +$augeas->rm('/files/etc/hosts/1/ipaddr'); +$augeas->save(); + +// inserting before the first comment +$beforeFirstComment = "comment inserted before the first comment"; +$firstComment = "first comment"; +$augeas->insert("/files/etc/hosts/#comment", "#comment", Augeas::AUGEAS_INSERT_BEFORE); +$augeas->set("/files/etc/hosts/#comment[1]", $beforeFirstComment); +echo $augeas->get("/files/etc/hosts/#comment[1]")."\n"; +echo $augeas->get("/files/etc/hosts/#comment[2]")."\n"; ?> ``` From c8583faac8a75c29bc3f085715b352a390beca3d Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 00:42:36 +0200 Subject: [PATCH 10/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82816d6..e4bded9 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Augeas::AUGEAS_INSERT_BEFORE = 0 Augeas::AUGEAS_INSERT_AFTER = 1 ``` -### Example +### EXAMPLES ```php Date: Mon, 25 Apr 2016 00:45:02 +0200 Subject: [PATCH 11/15] Update package.xml --- package.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.xml b/package.xml index 7610c10..1873d97 100644 --- a/package.xml +++ b/package.xml @@ -10,9 +10,9 @@ ppadron@php.net yes - 2010-02-12 + 2016-04-25 - 0.6.1 + 0.6.2 0.6.0 From 505f0285e47efd9e4d7bdc9ce71fa546d5c094c5 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Mon, 25 Apr 2016 01:39:27 +0200 Subject: [PATCH 12/15] Update README.md --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index e4bded9..a9aa34c 100644 --- a/README.md +++ b/README.md @@ -65,11 +65,6 @@ echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; echo $augeas->get("/files/etc/hosts/1/alias")."\n"; // match -$expectedArray = array( - "/files/etc/hosts/1/ipaddr" => "127.0.0.1", - "/files/etc/hosts/1/canonical" => "localhost", - "/files/etc/hosts/1/alias" => "localhost.localdomain", -); $matches = $augeas->match("/files/etc/hosts/1/*"); var_dump($matches); From d0b5829822477aca95165e5db80e9b86c8bdd20e Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Thu, 28 Apr 2016 22:52:47 +0200 Subject: [PATCH 13/15] add dump_to_xml method to dump xml string the augeas tree --- augeas.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ php_augeas.h | 1 + 2 files changed, 62 insertions(+) diff --git a/augeas.c b/augeas.c index 8674c63..d72ee12 100644 --- a/augeas.c +++ b/augeas.c @@ -43,6 +43,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_Augeas_get, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO(); +ZEND_BEGIN_ARG_INFO(arginfo_Augeas_dump_to_xml, 0) + ZEND_ARG_INFO(0, path) +ZEND_END_ARG_INFO(); + ZEND_BEGIN_ARG_INFO(arginfo_Augeas_match, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO(); @@ -75,6 +79,7 @@ ZEND_END_ARG_INFO(); static zend_function_entry augeas_methods[] = { PHP_ME(Augeas, __construct, arginfo_Augeas__construct, ZEND_ACC_PUBLIC) PHP_ME(Augeas, get, arginfo_Augeas_get, ZEND_ACC_PUBLIC) + PHP_ME(Augeas, dump_to_xml, arginfo_Augeas_dump_to_xml, ZEND_ACC_PUBLIC) PHP_ME(Augeas, set, arginfo_Augeas_set, ZEND_ACC_PUBLIC) PHP_ME(Augeas, match, arginfo_Augeas_match, ZEND_ACC_PUBLIC) PHP_ME(Augeas, rm, arginfo_Augeas_rm, ZEND_ACC_PUBLIC) @@ -290,6 +295,62 @@ PHP_METHOD(Augeas, get) } /* }}} */ +/* {{{ proto string Augeas::dump_to_xml(string $path); + dump to xml string. */ +PHP_METHOD(Augeas, dump_to_xml) +{ + char *path, *value; + char **matches; + int path_len, retval; + php_augeas_object *obj; + augeas *aug_intern; + xmlNodePtr xmldoc=NULL; + xmlBufferPtr buffer=NULL; + int size = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) { + RETURN_FALSE; + } + + if (path_len < 1) { + RETURN_FALSE; + } + + AUGEAS_FROM_OBJECT(aug_intern, getThis()); + + retval = aug_to_xml(aug_intern, path, &xmldoc, 0); + switch (retval) { + + /* export success */ + case 0: + // dump xmldoc to xmlbuffer + buffer = xmlBufferCreate(); + size = xmlNodeDump(buffer, xmldoc->doc, xmldoc, 0, 1); + if (size==-1) { + zend_throw_exception(augeas_ce_AugeasException, "xmlNodeDump failed", 0 TSRMLS_CC); + break; + } + + // duplicate xml string emallocated memory + value=emalloc(size); + memcpy(value,buffer->content,size); + value[size]='\0'; + + xmlFreeNode(xmldoc); + xmlBufferFree(buffer); + + RETURN_STRING(value, 0); + break; + + default: + zend_throw_exception(augeas_ce_AugeasException, "XML export failed", 0 TSRMLS_CC); + break; + } + + +} +/* }}} */ + /* {{{ proto boolean Augeas::set(string $path, string $value); Sets the value of $path to $value */ PHP_METHOD(Augeas, set) diff --git a/php_augeas.h b/php_augeas.h index 7dc0846..50c8470 100644 --- a/php_augeas.h +++ b/php_augeas.h @@ -50,6 +50,7 @@ PHP_MINFO_FUNCTION(augeas); PHP_METHOD(Augeas, __construct); PHP_METHOD(Augeas, get); +PHP_METHOD(Augeas, dump_to_xml); PHP_METHOD(Augeas, set); PHP_METHOD(Augeas, match); PHP_METHOD(Augeas, save); From 776e014aff3d812b1956dba125a11b8e7650c04d Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Thu, 28 Apr 2016 22:57:36 +0200 Subject: [PATCH 14/15] add dump_to_xml --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a9aa34c..2663ace 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +### new addition in this realese + +- add dump_to_xml to retreave augeas tree in xml string from [aug_to_xml](http://augeas.net/docs/references/c_api/files/augeas-h.html#aug_to_xml) + ### INSTALL Install instructions (you’ll need php5 dev package): @@ -28,6 +32,7 @@ extension=augeas.so ``` void Augeas::__construct([string $root[, string $loadpath[, int $flags]]]) string Augeas::get(string $path) +string Augeas::dump_to_xml(string $path) array Augeas::match(string $path); boolean Augeas::set(string $path, string $value); boolean Augeas::rm($augeas, string $path); From 137284564391d118d923a08538818dcc9781e431 Mon Sep 17 00:00:00 2001 From: CARBONNEAUX Mathieu Date: Thu, 28 Apr 2016 22:59:07 +0200 Subject: [PATCH 15/15] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2663ace..6530ab5 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,9 @@ echo $augeas->get("/files/etc/hosts/1/ipaddr")."\n"; echo $augeas->get("/files/etc/hosts/1/canonical")."\n"; echo $augeas->get("/files/etc/hosts/1/alias")."\n"; +// dump_to_xml +echo $augeas->dump_to_xml("/files/etc/hosts/1/*")."\n"; + // match $matches = $augeas->match("/files/etc/hosts/1/*"); var_dump($matches);