From bdea7afc1f3cd068402474f6d87c379e925a4dec Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Fri, 27 Oct 2017 15:22:58 +0200 Subject: [PATCH 01/18] Fix for PHP 7 compatibility --- src/httpAdapters/SagNativeHTTPAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php index c1c54b0..f8a6aa0 100644 --- a/src/httpAdapters/SagNativeHTTPAdapter.php +++ b/src/httpAdapters/SagNativeHTTPAdapter.php @@ -205,7 +205,7 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ else { $line = explode(':', $line, 2); $line[0] = strtolower($line[0]); - $response->headers->$line[0] = $line[1] = ltrim($line[1]); + $response->headers->{$line[0]} = $line[1] = ltrim($line[1]); switch($line[0]) { case 'set-cookie': From 55b540be8eb28460468e814c2c867030b69352ad Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Wed, 6 Jun 2018 10:42:46 +0200 Subject: [PATCH 02/18] Support for HTTPS with Native Sockets --- src/httpAdapters/SagNativeHTTPAdapter.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php index f8a6aa0..260d3c6 100644 --- a/src/httpAdapters/SagNativeHTTPAdapter.php +++ b/src/httpAdapters/SagNativeHTTPAdapter.php @@ -12,6 +12,7 @@ class SagNativeHTTPAdapter extends SagHTTPAdapter { private $connPool = array(); //Connection pool + private $useSSL = FALSE; /** * Closes any sockets that are left open in the connection pool. @@ -26,14 +27,14 @@ public function __destruct() { * Native sockets does not support SSL. */ public function useSSL($use) { - throw new SagException('Sag::$HTTP_NATIVE_SOCKETS does not support SSL.'); + $this->useSSL = $use; } /** * Native sockets does not support SSL. */ public function setSSLCert($path) { - throw new SagException('Sag::$HTTP_NATIVE_SOCKETS does not support SSL.'); + throw new SagException('Sag::$HTTP_NATIVE_SOCKETS does not yet implement SSL checking.'); } public function procPacket($method, $url, $data = null, $reqHeaders = array(), $specialHost = null, $specialPort = null) { @@ -80,10 +81,18 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ try { //these calls should throw on error if($this->socketOpenTimeout) { - $sock = fsockopen($host, $port, $sockErrNo, $sockErrStr, $this->socketOpenTimeout); + if ($this->useSSL) { + $sock = fsockopen("ssl://".$host, $port, $sockErrNo, $sockErrStr, $this->socketOpenTimeout); + } else { + $sock = fsockopen($host, $port, $sockErrNo, $sockErrStr, $this->socketOpenTimeout); + } } else { - $sock = fsockopen($host, $port, $sockErrNo, $sockErrStr); + if ($this->useSSL) { + $sock = fsockopen("ssl://".$host, $port, $sockErrNo, $sockErrStr); + } else { + $sock = fsockopen($host, $port, $sockErrNo, $sockErrStr); + } } /* From f1d01c70149972f5dd4589d341400e0eef4c648f Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 3 Jan 2019 18:03:26 +0100 Subject: [PATCH 03/18] Make replicate() function CouchDB 2.x compatible - implemented doc_ids as well --- src/Sag.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Sag.php b/src/Sag.php index 49a163f..3bd8e18 100644 --- a/src/Sag.php +++ b/src/Sag.php @@ -732,15 +732,16 @@ public function deleteDatabase($name) { * @param mixed $filterQueryParams An object or associative array of * parameters to be passed to the filter function via query_params. Only used * if $filter is set. + * @param array $doc_ids Array of document IDs to be synchronized * * @return mixed */ - public function replicate($src, $target, $continuous = false, $createTarget = null, $filter = null, $filterQueryParams = null) { - if(empty($src) || !is_string($src)) { + public function replicate($src, $target, $continuous = false, $createTarget = null, $filter = null, $filterQueryParams = null, $doc_ids = null) { + if(empty($src) || (!is_string($src) && !is_object($src))) { throw new SagException('replicate() is missing a source to replicate from.'); } - if(empty($target) || !is_string($target)) { + if(empty($target) || (!is_string($target)) && !is_object($target)) { throw new SagException('replicate() is missing a target to replicate to.'); } @@ -762,6 +763,10 @@ public function replicate($src, $target, $continuous = false, $createTarget = nu } } + if (isset($doc_ids) && !is_array($doc_ids)) { + throw new SagException('Doc IDs needs to be an array.'); + } + $data = new stdClass(); $data->source = $src; $data->target = $target; @@ -786,6 +791,10 @@ public function replicate($src, $target, $continuous = false, $createTarget = nu } } + if ($doc_ids) { + $data->doc_ids = $doc_ids; + } + return $this->procPacket('POST', '/_replicate', json_encode($data)); } From b9429522a177adcf745f02557eff54acda48b481 Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 5 Sep 2019 10:09:39 +0200 Subject: [PATCH 04/18] Enabled compressed contents fetching --- src/httpAdapters/SagCURLHTTPAdapter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php index a195f50..45d570d 100644 --- a/src/httpAdapters/SagCURLHTTPAdapter.php +++ b/src/httpAdapters/SagCURLHTTPAdapter.php @@ -41,7 +41,8 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ CURLOPT_RETURNTRANSFER => true, CURLOPT_NOBODY => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => $method + CURLOPT_CUSTOMREQUEST => $method, + CURLOPT_ENCODING => '' ); // cURL wants the headers as an array of strings, not an assoc array From a46bee0c8db5db2eb1e8811b83792c9c7c827ee3 Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 5 Sep 2019 10:17:01 +0200 Subject: [PATCH 05/18] Fix for PHP7 Compatibility --- src/httpAdapters/SagCURLHTTPAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php index 45d570d..9e5b829 100644 --- a/src/httpAdapters/SagCURLHTTPAdapter.php +++ b/src/httpAdapters/SagCURLHTTPAdapter.php @@ -123,7 +123,7 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ else { $line = explode(':', $respHeaders[$i], 2); $line[0] = strtolower($line[0]); - $response->headers->$line[0] = ltrim($line[1]); + $response->headers->{$line[0]} = ltrim($line[1]); if($line[0] == 'set-cookie') { $response->cookies = $this->parseCookieString($line[1]); From 0004d62f1697be097b1c324fd085456d038af003 Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 5 Sep 2019 11:55:28 +0200 Subject: [PATCH 06/18] Fix for request compressions --- src/httpAdapters/SagCURLHTTPAdapter.php | 7 +++++-- src/httpAdapters/SagHTTPAdapter.php | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php index 9e5b829..97c63d6 100644 --- a/src/httpAdapters/SagCURLHTTPAdapter.php +++ b/src/httpAdapters/SagCURLHTTPAdapter.php @@ -41,8 +41,7 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ CURLOPT_RETURNTRANSFER => true, CURLOPT_NOBODY => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => $method, - CURLOPT_ENCODING => '' + CURLOPT_CUSTOMREQUEST => $method ); // cURL wants the headers as an array of strings, not an assoc array @@ -59,6 +58,10 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ $opts[CURLOPT_POSTFIELDS] = $data; } + if($method == 'GET') { + $opts[CURLOPT_ENCODING] = ""; + } + // special considerations for HEAD requests if($method == 'HEAD') { $opts[CURLOPT_NOBODY] = true; diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php index d717fc5..d2ced19 100644 --- a/src/httpAdapters/SagHTTPAdapter.php +++ b/src/httpAdapters/SagHTTPAdapter.php @@ -38,6 +38,7 @@ protected function makeResult($response, $method) { if( $method != 'HEAD' && isset($response->headers->{'content-length'}) && + ! isset($response->headers->{'content-encoding'}) && strlen($response->body) != $response->headers->{'content-length'} ) { throw new SagException('Unexpected end of packet.'); From 46a732c4623e118b69dcdca6f77bb26b00ca7203 Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 5 Sep 2019 11:58:25 +0200 Subject: [PATCH 07/18] Backport older fixes --- src/httpAdapters/SagHTTPAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php index d2ced19..25ba5e2 100644 --- a/src/httpAdapters/SagHTTPAdapter.php +++ b/src/httpAdapters/SagHTTPAdapter.php @@ -68,7 +68,7 @@ protected function makeResult($response, $method) { ) { $json = json_decode($response->body); - if(isset($json)) { + if(isset($json) && $json !== FALSE) { if(!empty($json->error)) { throw new SagCouchException("{$json->error} ({$json->reason})", $response->headers->_HTTP->status); } From b3ae5f3430a07dc60f8e8e6c768dda169cfe9a6f Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Thu, 5 Sep 2019 12:22:57 +0200 Subject: [PATCH 08/18] Update README.md --- README.md | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ff9ab4a..58a2976 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,14 @@ Sag === -Note: I have not maintained this project for years since I no longer use -CouchDB or PHP. I assume it still works with CouchDB, but haven't been active -in the community for a while and won't be testing or responding to tickets. - -Version %VERSION% - -http://www.saggingcouch.com - Sag is a PHP library for working with CouchDB. It is designed to not force any particular programming method on its users - you just pass PHP objects, and get stdClass objects and Exceptions back. This makes it trivial to incorporate Sag into your application, build different functionality on top of it, and expand Sag to incorporate new CouchDB functionality. +This is a *fork* of the original SAG Library that was hosted on saggincouch.com. + Compatability ------------- @@ -142,8 +136,7 @@ as a stdClass. Functions --------- -Detailed documentation of the functions and API are available at -http://www.saggingcouch.com/documentation.php. +_to be updated_ License ------- @@ -153,8 +146,3 @@ LICENSE for more information. Copyright information is in the NOTICE file. -More? ------ - -See http://www.saggingcouch.com for more detailed information, bug reporting, -planned features, etc. From 6c7d5d39c3075e8ee00971c6bd511501a042a079 Mon Sep 17 00:00:00 2001 From: Andrea Brancatelli Date: Mon, 15 Feb 2021 10:33:40 +0100 Subject: [PATCH 09/18] Update README.md --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 58a2976..832b4e2 100644 --- a/README.md +++ b/README.md @@ -9,23 +9,19 @@ Sag to incorporate new CouchDB functionality. This is a *fork* of the original SAG Library that was hosted on saggincouch.com. -Compatability +Compatibility ------------- Each Sag release is tested with an automated testing suite against all the combinations of: - - PHP 5.5.x + - PHP 7.x - - CouchDB 1.6.x - - - Cloudant + - CouchDB 3.x Lower versions of CouchDB and PHP will likely work with Sag, but they are not officially supported, so your mileage may vary. -If you are running pre-1.5.1 CouchDB (important security fix) or pre-5.3 PHP, -then you probably want to look into updating your environment. Error Handling -------------- From 3cee526da0d205af1f31db1966e331f0bcf08ac3 Mon Sep 17 00:00:00 2001 From: Gabriele Orlando Date: Mon, 15 Feb 2021 11:03:56 +0100 Subject: [PATCH 10/18] Added change() - Makes a request to the _changes feed --- src/Sag.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Sag.php b/src/Sag.php index 3bd8e18..4663a70 100644 --- a/src/Sag.php +++ b/src/Sag.php @@ -448,6 +448,32 @@ public function post($data, $path = null) { return $this->procPacket('POST', "/{$this->db}{$path}", $data); } + + /** + * Makes a request to the _changes feed. + * + * @param array $parameters The feed parameters + * @param mixed $request The request available in the filter function + * + * @return mixed + */ + public function changes($parameters = array(), $request = null) { + if(!$this->db) { + throw new SagException('No database specified'); + } + + if(!is_null($request) && (!is_string($request) && !is_object($request) && !is_array($request))) { + throw new SagException('changes() needs an object for request.'); + } + + if(!is_string($request)) { + $request = json_encode($request); + } + + $queryString = (count($parameters) > 0 ? "?" : "").http_build_query($parameters); + + return $this->procPacket('POST', "/{$this->db}/_changes{$queryString}", $request); + } /** * Bulk pushes documents to the database. From fd59446216a8a7338760f6656297af1d20b64979 Mon Sep 17 00:00:00 2001 From: Gabriele Orlando Date: Mon, 15 Feb 2021 11:23:46 +0100 Subject: [PATCH 11/18] Added generation of custom IDS --- src/Sag.php | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/Sag.php b/src/Sag.php index 4663a70..1309eb3 100644 --- a/src/Sag.php +++ b/src/Sag.php @@ -21,10 +21,17 @@ /** * The Sag class provides the core functionality for talking to CouchDB. * - * @version %VERSION% + * @version 0.9.1 * @package Core */ class Sag { + + /** + * @var string Used by login() to use HTTP Basic Authentication. + * @static + */ + public static $VERSION = "0.9.1"; + /** * @var string Used by login() to use HTTP Basic Authentication. * @static @@ -379,6 +386,7 @@ public function put($id, $data) $toSend = (is_string($data)) ? $data : json_encode($data); $id = urlencode($id); + $id = str_replace("%2F", "/", $id); /** Url Encoding a / confuses Couch **/ $url = "/{$this->db}/$id"; $response = $this->procPacket('PUT', $url, $toSend); @@ -714,6 +722,41 @@ public function generateIDs($num = 10) { } /** + * Uses CouchDB to generate IDs with custom prefix ad separator. + * + * @param int $num The number of IDs to generate (>= 0). Defaults to 10. + * @param string $prefix The prefix for the ID + * @param string $separator the separatore between prefix and ID + * @return array + */ + public function generateIDsCustom($num = 10, $prefix = "", $separator = ":") { + $ids = array(); + + $docs = $this->generateIDs($num); + if ($docs->status == 200) { + if (isset($docs->body->uuids) && is_array($docs->body->uuids)) { + foreach ($docs->body->uuids as $uuid) { + $ids[] = $prefix . $separator . $uuid; + } + } + } + + return $ids; + } + + /** + * Uses CouchDB to generate only one ID with custom prefix ad separator. + * + * @param string $prefix The prefix for the ID + * @param string $separator the separatore between prefix and ID + * @return string + */ + public function generateIDCustom($prefix, $separator = ":") { + $ids = $this->generateIDsCustom(1, $prefix, $separator); + return $ids[0]; + } + + /** * Creates a database with the specified name. * * @param string $name The name of the database you want to create. @@ -1128,7 +1171,7 @@ private function procPacket($method, $url, $data = null, $headers = array()) { // Build the request packet. $headers["Host"] = "{$this->host}:{$this->port}"; - $headers["User-Agent"] = "Sag/%VERSION%"; + $headers["User-Agent"] = "Sag/" . self::$VERSION; /* * This prevents some unRESTful requests, such as inline attachments in From 2666000b27337216d9ea08b99858118212f1b664 Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Sat, 6 Mar 2021 20:29:47 +0100 Subject: [PATCH 12/18] Added 2 simple and commonly used functions to src/Sag.php --- .gitignore | 0 CHANGELOG | 0 CONTRIBUTE | 0 LICENSE | 0 Makefile | 0 NOTICE | 0 README.md | 0 VERSION | 0 composer.json | 0 examples/proxyCookie/index.php | 0 src/Sag.php | 9 +++++++++ src/SagCache.php | 0 src/SagCouchException.php | 0 src/SagException.php | 0 src/SagFileCache.php | 0 src/SagMemoryCache.php | 0 src/httpAdapters/SagCURLHTTPAdapter.php | 0 src/httpAdapters/SagHTTPAdapter.php | 0 src/httpAdapters/SagNativeHTTPAdapter.php | 0 tests/README | 0 tests/SagFileCacheTest.php | 0 tests/SagMemoryCacheTest.php | 0 tests/SagTest.php | 0 tests/phpunitConfig-SSL-cURL.xml | 0 tests/phpunitConfig-cURL.xml | 0 tests/phpunitConfig-nativeSockets.xml | 0 26 files changed, 9 insertions(+) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 CHANGELOG mode change 100644 => 100755 CONTRIBUTE mode change 100644 => 100755 LICENSE mode change 100644 => 100755 Makefile mode change 100644 => 100755 NOTICE mode change 100644 => 100755 README.md mode change 100644 => 100755 VERSION mode change 100644 => 100755 composer.json mode change 100644 => 100755 examples/proxyCookie/index.php mode change 100644 => 100755 src/Sag.php mode change 100644 => 100755 src/SagCache.php mode change 100644 => 100755 src/SagCouchException.php mode change 100644 => 100755 src/SagException.php mode change 100644 => 100755 src/SagFileCache.php mode change 100644 => 100755 src/SagMemoryCache.php mode change 100644 => 100755 src/httpAdapters/SagCURLHTTPAdapter.php mode change 100644 => 100755 src/httpAdapters/SagHTTPAdapter.php mode change 100644 => 100755 src/httpAdapters/SagNativeHTTPAdapter.php mode change 100644 => 100755 tests/README mode change 100644 => 100755 tests/SagFileCacheTest.php mode change 100644 => 100755 tests/SagMemoryCacheTest.php mode change 100644 => 100755 tests/SagTest.php mode change 100644 => 100755 tests/phpunitConfig-SSL-cURL.xml mode change 100644 => 100755 tests/phpunitConfig-cURL.xml mode change 100644 => 100755 tests/phpunitConfig-nativeSockets.xml diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CHANGELOG b/CHANGELOG old mode 100644 new mode 100755 diff --git a/CONTRIBUTE b/CONTRIBUTE old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/NOTICE b/NOTICE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/VERSION b/VERSION old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/examples/proxyCookie/index.php b/examples/proxyCookie/index.php old mode 100644 new mode 100755 diff --git a/src/Sag.php b/src/Sag.php old mode 100644 new mode 100755 index 1309eb3..844c0a8 --- a/src/Sag.php +++ b/src/Sag.php @@ -1141,6 +1141,15 @@ public function getPathPrefix() { return $this->pathPrefix; } + public function find($data) { + if (!is_string($data)) $data = json_encode($data); + return $this->procPacket ('POST', '/'.$this->db.'/_find', $data); + } + + public function setAdmins($data) { + return $this->procPacket ('PUT', '/'.$this->db.'/_security', $data); + } + // The main driver - does all the socket and protocol work. private function procPacket($method, $url, $data = null, $headers = array()) { /* diff --git a/src/SagCache.php b/src/SagCache.php old mode 100644 new mode 100755 diff --git a/src/SagCouchException.php b/src/SagCouchException.php old mode 100644 new mode 100755 diff --git a/src/SagException.php b/src/SagException.php old mode 100644 new mode 100755 diff --git a/src/SagFileCache.php b/src/SagFileCache.php old mode 100644 new mode 100755 diff --git a/src/SagMemoryCache.php b/src/SagMemoryCache.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/tests/README b/tests/README old mode 100644 new mode 100755 diff --git a/tests/SagFileCacheTest.php b/tests/SagFileCacheTest.php old mode 100644 new mode 100755 diff --git a/tests/SagMemoryCacheTest.php b/tests/SagMemoryCacheTest.php old mode 100644 new mode 100755 diff --git a/tests/SagTest.php b/tests/SagTest.php old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-SSL-cURL.xml b/tests/phpunitConfig-SSL-cURL.xml old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-cURL.xml b/tests/phpunitConfig-cURL.xml old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-nativeSockets.xml b/tests/phpunitConfig-nativeSockets.xml old mode 100644 new mode 100755 From 75e8c9916c8f79a6aa5650edf480dc6b3af5e3fa Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Sat, 6 Mar 2021 20:50:08 +0100 Subject: [PATCH 13/18] tests added for Sag.php->find() and Sag.php->setAdmins() --- tests/SagTest.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/SagTest.php b/tests/SagTest.php index 568a6ef..23b56b4 100755 --- a/tests/SagTest.php +++ b/tests/SagTest.php @@ -92,6 +92,43 @@ public function test_newDoc() $this->assertTrue($result->body->ok); $this->assertEquals($result->body->id, '1'); } + + public function test_find() + { + $docs = array ( + array ( + 'one' => 'abc', + 'two' => 'def' + ), + array ( + 'one' => 'ghi', + 'two' => 'jkl' + ) + ); + + foreach ($docs as $idx => $doc) { + $this->assertTrue($this->couch->post($doc)->body->ok); + } + + $findCommand = array ( + 'selector' => array ( 'one' => 'abc' ), + 'fields' => array ( 'one', 'two' ) + ); + $call = $this->couch->find ($findCommand); + $this->assertTrue ($call->headers->_HTTP->status===200); + $this->assertTrue (sizeof($call->body->docs)===1); + } + + public function test_setAdmins() + { + $json = '{ "admins": { "names": [], "roles": ["guests"] }, "members": { "names": ["Administrator"], "roles": ["guests"] } }'; + try { + $call = $this->couch->setAdmins ($json); + } catch (Exception $e) { + $this->assertTrue(false); + } + $this->assertTrue(true); + } public function test_newDocFromArray() { From ef1f7af652c1697c0e7d608918f169e51adbc20a Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Sat, 6 Mar 2021 21:18:58 +0100 Subject: [PATCH 14/18] code cleanup for Sag.php->find() and Sag.php->setAdmins() --- src/Sag.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Sag.php b/src/Sag.php index 844c0a8..55561f3 100755 --- a/src/Sag.php +++ b/src/Sag.php @@ -1141,12 +1141,37 @@ public function getPathPrefix() { return $this->pathPrefix; } + /** + * Interface to /db/_find + * + * @param mixed $data + * $data = array ( + * 'selector' => array( + * 'shortened' => $newID + * ), + * 'fields' => array( + * '_id', 'creator', 'destination', 'shortened' + * ) + * ); + * + * + * @return Sag Returns $this->procPacket() results. + */ public function find($data) { if (!is_string($data)) $data = json_encode($data); return $this->procPacket ('POST', '/'.$this->db.'/_find', $data); } + /** + * Interface to /db/_security + * + * @param mixed $data + * $json = '{ "admins": { "names": [], "roles": ["guests"] }, "members": { "names": ["Administrator"], "roles": ["guests"] } }'; + * + * @return Sag Returns $this->procPacket() results. + */ public function setAdmins($data) { + if (!is_string($data)) $data = json_encode($data); return $this->procPacket ('PUT', '/'.$this->db.'/_security', $data); } From 967199950eac55ed0cac0ac4228541a9f9f86f26 Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Sat, 6 Mar 2021 21:20:30 +0100 Subject: [PATCH 15/18] code cleanup for Sag.php->find() and Sag.php->setAdmins() --- src/Sag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sag.php b/src/Sag.php index 55561f3..0bb86ab 100755 --- a/src/Sag.php +++ b/src/Sag.php @@ -1166,7 +1166,7 @@ public function find($data) { * Interface to /db/_security * * @param mixed $data - * $json = '{ "admins": { "names": [], "roles": ["guests"] }, "members": { "names": ["Administrator"], "roles": ["guests"] } }'; + * $data = '{ "admins": { "names": [], "roles": ["guests"] }, "members": { "names": ["Administrator"], "roles": ["guests"] } }'; * * @return Sag Returns $this->procPacket() results. */ From ed315161c02c302881171f03123b1cdd86750286 Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Mon, 8 Mar 2021 13:29:42 +0100 Subject: [PATCH 16/18] file permissions changed by request --- .gitignore | 0 CHANGELOG | 0 CONTRIBUTE | 0 LICENSE | 0 Makefile | 0 NOTICE | 0 README.md | 0 VERSION | 0 composer.json | 0 examples/proxyCookie/index.php | 0 src/Sag.php | 0 src/SagCache.php | 0 src/SagCouchException.php | 0 src/SagException.php | 0 src/SagFileCache.php | 0 src/SagMemoryCache.php | 0 src/httpAdapters/SagCURLHTTPAdapter.php | 0 src/httpAdapters/SagHTTPAdapter.php | 0 src/httpAdapters/SagNativeHTTPAdapter.php | 0 tests/README | 0 tests/SagFileCacheTest.php | 0 tests/SagMemoryCacheTest.php | 0 tests/SagTest.php | 0 tests/bootstrap.bsh | 0 tests/phpunitConfig-SSL-cURL.xml | 0 tests/phpunitConfig-cURL.xml | 0 tests/phpunitConfig-nativeSockets.xml | 0 27 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .gitignore mode change 100755 => 100644 CHANGELOG mode change 100755 => 100644 CONTRIBUTE mode change 100755 => 100644 LICENSE mode change 100755 => 100644 Makefile mode change 100755 => 100644 NOTICE mode change 100755 => 100644 README.md mode change 100755 => 100644 VERSION mode change 100755 => 100644 composer.json mode change 100755 => 100644 examples/proxyCookie/index.php mode change 100755 => 100644 src/Sag.php mode change 100755 => 100644 src/SagCache.php mode change 100755 => 100644 src/SagCouchException.php mode change 100755 => 100644 src/SagException.php mode change 100755 => 100644 src/SagFileCache.php mode change 100755 => 100644 src/SagMemoryCache.php mode change 100755 => 100644 src/httpAdapters/SagCURLHTTPAdapter.php mode change 100755 => 100644 src/httpAdapters/SagHTTPAdapter.php mode change 100755 => 100644 src/httpAdapters/SagNativeHTTPAdapter.php mode change 100755 => 100644 tests/README mode change 100755 => 100644 tests/SagFileCacheTest.php mode change 100755 => 100644 tests/SagMemoryCacheTest.php mode change 100755 => 100644 tests/SagTest.php mode change 100755 => 100644 tests/bootstrap.bsh mode change 100755 => 100644 tests/phpunitConfig-SSL-cURL.xml mode change 100755 => 100644 tests/phpunitConfig-cURL.xml mode change 100755 => 100644 tests/phpunitConfig-nativeSockets.xml diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/CHANGELOG b/CHANGELOG old mode 100755 new mode 100644 diff --git a/CONTRIBUTE b/CONTRIBUTE old mode 100755 new mode 100644 diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/NOTICE b/NOTICE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/VERSION b/VERSION old mode 100755 new mode 100644 diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 diff --git a/examples/proxyCookie/index.php b/examples/proxyCookie/index.php old mode 100755 new mode 100644 diff --git a/src/Sag.php b/src/Sag.php old mode 100755 new mode 100644 diff --git a/src/SagCache.php b/src/SagCache.php old mode 100755 new mode 100644 diff --git a/src/SagCouchException.php b/src/SagCouchException.php old mode 100755 new mode 100644 diff --git a/src/SagException.php b/src/SagException.php old mode 100755 new mode 100644 diff --git a/src/SagFileCache.php b/src/SagFileCache.php old mode 100755 new mode 100644 diff --git a/src/SagMemoryCache.php b/src/SagMemoryCache.php old mode 100755 new mode 100644 diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php old mode 100755 new mode 100644 diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php old mode 100755 new mode 100644 diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php old mode 100755 new mode 100644 diff --git a/tests/README b/tests/README old mode 100755 new mode 100644 diff --git a/tests/SagFileCacheTest.php b/tests/SagFileCacheTest.php old mode 100755 new mode 100644 diff --git a/tests/SagMemoryCacheTest.php b/tests/SagMemoryCacheTest.php old mode 100755 new mode 100644 diff --git a/tests/SagTest.php b/tests/SagTest.php old mode 100755 new mode 100644 diff --git a/tests/bootstrap.bsh b/tests/bootstrap.bsh old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-SSL-cURL.xml b/tests/phpunitConfig-SSL-cURL.xml old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-cURL.xml b/tests/phpunitConfig-cURL.xml old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-nativeSockets.xml b/tests/phpunitConfig-nativeSockets.xml old mode 100755 new mode 100644 From 1ede8036c41deb296825174a7c44b69a1f164e3a Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Sat, 20 Mar 2021 20:25:38 +0100 Subject: [PATCH 17/18] improvements --- .gitignore | 0 CHANGELOG | 0 CONTRIBUTE | 0 LICENSE | 0 Makefile | 0 NOTICE | 0 README.md | 0 VERSION | 0 composer.json | 0 examples/proxyCookie/index.php | 0 src/Sag.php | 22 ++++++++++++++- src/SagCache.php | 0 src/SagCouchException.php | 0 src/SagException.php | 0 src/SagFileCache.php | 0 src/SagMemoryCache.php | 0 src/httpAdapters/SagCURLHTTPAdapter.php | 0 src/httpAdapters/SagHTTPAdapter.php | 0 src/httpAdapters/SagNativeHTTPAdapter.php | 0 tests/README | 0 tests/SagFileCacheTest.php | 0 tests/SagMemoryCacheTest.php | 0 tests/SagTest.php | 33 ++++++++++++++++++++--- tests/bootstrap.bsh | 0 tests/phpunitConfig-SSL-cURL.xml | 0 tests/phpunitConfig-cURL.xml | 0 tests/phpunitConfig-nativeSockets.xml | 0 27 files changed, 51 insertions(+), 4 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 CHANGELOG mode change 100644 => 100755 CONTRIBUTE mode change 100644 => 100755 LICENSE mode change 100644 => 100755 Makefile mode change 100644 => 100755 NOTICE mode change 100644 => 100755 README.md mode change 100644 => 100755 VERSION mode change 100644 => 100755 composer.json mode change 100644 => 100755 examples/proxyCookie/index.php mode change 100644 => 100755 src/Sag.php mode change 100644 => 100755 src/SagCache.php mode change 100644 => 100755 src/SagCouchException.php mode change 100644 => 100755 src/SagException.php mode change 100644 => 100755 src/SagFileCache.php mode change 100644 => 100755 src/SagMemoryCache.php mode change 100644 => 100755 src/httpAdapters/SagCURLHTTPAdapter.php mode change 100644 => 100755 src/httpAdapters/SagHTTPAdapter.php mode change 100644 => 100755 src/httpAdapters/SagNativeHTTPAdapter.php mode change 100644 => 100755 tests/README mode change 100644 => 100755 tests/SagFileCacheTest.php mode change 100644 => 100755 tests/SagMemoryCacheTest.php mode change 100644 => 100755 tests/SagTest.php mode change 100644 => 100755 tests/bootstrap.bsh mode change 100644 => 100755 tests/phpunitConfig-SSL-cURL.xml mode change 100644 => 100755 tests/phpunitConfig-cURL.xml mode change 100644 => 100755 tests/phpunitConfig-nativeSockets.xml diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CHANGELOG b/CHANGELOG old mode 100644 new mode 100755 diff --git a/CONTRIBUTE b/CONTRIBUTE old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/NOTICE b/NOTICE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/VERSION b/VERSION old mode 100644 new mode 100755 diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/examples/proxyCookie/index.php b/examples/proxyCookie/index.php old mode 100644 new mode 100755 diff --git a/src/Sag.php b/src/Sag.php old mode 100644 new mode 100755 index 0bb86ab..3a2441f --- a/src/Sag.php +++ b/src/Sag.php @@ -1141,6 +1141,26 @@ public function getPathPrefix() { return $this->pathPrefix; } + /** + * Interface to /db/_index + * + * @param mixed $data (see https://docs.couchdb.org/en/stable/api/database/find.html#db-index) + * $data = array ( + * 'index' => array( + * 'fields' => array ('foo') + * ), + * 'name' => 'foo-index', + * 'type' => 'json' + * ); + * + * + * @return Sag Returns $this->procPacket() results. + */ + public function setIndex($data) { + if (!is_string($data)) $data = json_encode($data); + return $this->procPacket ('POST', '/'.$this->db.'/_index', $data); + } + /** * Interface to /db/_find * @@ -1170,7 +1190,7 @@ public function find($data) { * * @return Sag Returns $this->procPacket() results. */ - public function setAdmins($data) { + public function setSecurity($data) { if (!is_string($data)) $data = json_encode($data); return $this->procPacket ('PUT', '/'.$this->db.'/_security', $data); } diff --git a/src/SagCache.php b/src/SagCache.php old mode 100644 new mode 100755 diff --git a/src/SagCouchException.php b/src/SagCouchException.php old mode 100644 new mode 100755 diff --git a/src/SagException.php b/src/SagException.php old mode 100644 new mode 100755 diff --git a/src/SagFileCache.php b/src/SagFileCache.php old mode 100644 new mode 100755 diff --git a/src/SagMemoryCache.php b/src/SagMemoryCache.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php old mode 100644 new mode 100755 diff --git a/tests/README b/tests/README old mode 100644 new mode 100755 diff --git a/tests/SagFileCacheTest.php b/tests/SagFileCacheTest.php old mode 100644 new mode 100755 diff --git a/tests/SagMemoryCacheTest.php b/tests/SagMemoryCacheTest.php old mode 100644 new mode 100755 diff --git a/tests/SagTest.php b/tests/SagTest.php old mode 100644 new mode 100755 index 23b56b4..b5c78a2 --- a/tests/SagTest.php +++ b/tests/SagTest.php @@ -93,7 +93,34 @@ public function test_newDoc() $this->assertEquals($result->body->id, '1'); } - public function test_find() + public function test_setIndex() + { + $docs = array ( + array ( + 'one' => 'abc', + 'two' => 'def' + ), + array ( + 'one' => 'ghi', + 'two' => 'jkl' + ) + ); + + foreach ($docs as $idx => $doc) { + $this->assertTrue($this->couch->post($doc)->body->ok); + } + + $cmdSetIndex = array ( + 'index' => array ( 'fields' => array ('one') ), + 'name' => 'one-index', + 'ddoc' => 'one-index', + 'type' => 'json' + ); + $call = $this->couch->setIndex ($cmdSetIndex); + $this->assertTrue ($call->headers->_HTTP->status===200); + } + + public function test_find($index) { $docs = array ( array ( @@ -119,11 +146,11 @@ public function test_find() $this->assertTrue (sizeof($call->body->docs)===1); } - public function test_setAdmins() + public function test_setSecurity() { $json = '{ "admins": { "names": [], "roles": ["guests"] }, "members": { "names": ["Administrator"], "roles": ["guests"] } }'; try { - $call = $this->couch->setAdmins ($json); + $call = $this->couch->setSecurity ($json); } catch (Exception $e) { $this->assertTrue(false); } diff --git a/tests/bootstrap.bsh b/tests/bootstrap.bsh old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-SSL-cURL.xml b/tests/phpunitConfig-SSL-cURL.xml old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-cURL.xml b/tests/phpunitConfig-cURL.xml old mode 100644 new mode 100755 diff --git a/tests/phpunitConfig-nativeSockets.xml b/tests/phpunitConfig-nativeSockets.xml old mode 100644 new mode 100755 From 7aed293f334b45a2fe0eb7df1cb01caecace288e Mon Sep 17 00:00:00 2001 From: Rene AJM Veerman Date: Tue, 24 Aug 2021 13:31:58 +0200 Subject: [PATCH 18/18] cookie login features added --- .gitignore | 0 CHANGELOG | 0 CONTRIBUTE | 0 LICENSE | 0 Makefile | 0 NOTICE | 0 README.md | 0 VERSION | 0 composer.json | 0 examples/proxyCookie/index.php | 0 src/Sag.php | 29 +++++++++++++++++++++++ src/SagCache.php | 0 src/SagCouchException.php | 0 src/SagException.php | 0 src/SagFileCache.php | 0 src/SagMemoryCache.php | 0 src/httpAdapters/SagCURLHTTPAdapter.php | 3 ++- src/httpAdapters/SagHTTPAdapter.php | 0 src/httpAdapters/SagNativeHTTPAdapter.php | 0 tests/README | 0 tests/SagFileCacheTest.php | 0 tests/SagMemoryCacheTest.php | 0 tests/SagTest.php | 0 tests/bootstrap.bsh | 0 tests/phpunitConfig-SSL-cURL.xml | 0 tests/phpunitConfig-cURL.xml | 0 tests/phpunitConfig-nativeSockets.xml | 0 27 files changed, 31 insertions(+), 1 deletion(-) mode change 100755 => 100644 .gitignore mode change 100755 => 100644 CHANGELOG mode change 100755 => 100644 CONTRIBUTE mode change 100755 => 100644 LICENSE mode change 100755 => 100644 Makefile mode change 100755 => 100644 NOTICE mode change 100755 => 100644 README.md mode change 100755 => 100644 VERSION mode change 100755 => 100644 composer.json mode change 100755 => 100644 examples/proxyCookie/index.php mode change 100755 => 100644 src/Sag.php mode change 100755 => 100644 src/SagCache.php mode change 100755 => 100644 src/SagCouchException.php mode change 100755 => 100644 src/SagException.php mode change 100755 => 100644 src/SagFileCache.php mode change 100755 => 100644 src/SagMemoryCache.php mode change 100755 => 100644 src/httpAdapters/SagCURLHTTPAdapter.php mode change 100755 => 100644 src/httpAdapters/SagHTTPAdapter.php mode change 100755 => 100644 src/httpAdapters/SagNativeHTTPAdapter.php mode change 100755 => 100644 tests/README mode change 100755 => 100644 tests/SagFileCacheTest.php mode change 100755 => 100644 tests/SagMemoryCacheTest.php mode change 100755 => 100644 tests/SagTest.php mode change 100755 => 100644 tests/bootstrap.bsh mode change 100755 => 100644 tests/phpunitConfig-SSL-cURL.xml mode change 100755 => 100644 tests/phpunitConfig-cURL.xml mode change 100755 => 100644 tests/phpunitConfig-nativeSockets.xml diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/CHANGELOG b/CHANGELOG old mode 100755 new mode 100644 diff --git a/CONTRIBUTE b/CONTRIBUTE old mode 100755 new mode 100644 diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 diff --git a/NOTICE b/NOTICE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/VERSION b/VERSION old mode 100755 new mode 100644 diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 diff --git a/examples/proxyCookie/index.php b/examples/proxyCookie/index.php old mode 100755 new mode 100644 diff --git a/src/Sag.php b/src/Sag.php old mode 100755 new mode 100644 index 3a2441f..c8c1741 --- a/src/Sag.php +++ b/src/Sag.php @@ -217,6 +217,32 @@ public function login($user, $pass, $type = null) { //should never reach this line throw new SagException("Unknown auth type for login()."); } + + + /** + * Sets the internal (private) variables to use cookie authentication in all subsequent calls to + * $this->procPacket(), which gets used by all worker functions in Sag. + * + * @param string $cookieValue the cookie value $this->authSession from $this->login ($username, $password, Sag::$AUTH_COOKIE); + */ + public function loginByCookie ($cookieValue=null) { + if (is_null($cookieValue)) { + throw new SagException('loginByCookie() expects a string parameter which should be the cookie (the return value) generated by login($username, $password, Sag::$AUTH_COOKIE).'); + } + + $this->authType = Sag::$AUTH_COOKIE; + $this->authSession = $cookieValue; + //echo 'loginByCookie():';var_dump ($this->authType); + } + + public function checkSession () { + $res = $this->procPacket( + 'GET', + '/_session' + ); + + echo 'high level checkSession() results=
'; var_dump ($res); echo '
'.PHP_EOL; + } /** * Get current session information on the server with /_session. @@ -1235,6 +1261,8 @@ private function procPacket($method, $url, $data = null, $headers = array()) { $headers['Accept'] = 'application/json'; //usernames and passwords can be blank + //$dbg = [ '$this->authType' => $this->authType, 'Sag::$AUTH_BASIC' => Sag::$AUTH_BASIC, 'Sag::$AUTH_COOKIE' => Sag::$AUTH_COOKIE ]; + //var_dump ($dbg); if($this->authType == Sag::$AUTH_BASIC && (isset($this->user) || isset($this->pass))) { $headers["Authorization"] = 'Basic '.base64_encode("{$this->user}:{$this->pass}"); } @@ -1242,6 +1270,7 @@ private function procPacket($method, $url, $data = null, $headers = array()) { $headers['Cookie'] = array( 'AuthSession' => $this->authSession ); $headers['X-CouchDB-WWW-Authenticate'] = 'Cookie'; } + //var_dump ($headers); if(is_array($this->globalCookies) && sizeof($this->globalCookies)) { //might have been set before by auth handling diff --git a/src/SagCache.php b/src/SagCache.php old mode 100755 new mode 100644 diff --git a/src/SagCouchException.php b/src/SagCouchException.php old mode 100755 new mode 100644 diff --git a/src/SagException.php b/src/SagException.php old mode 100755 new mode 100644 diff --git a/src/SagFileCache.php b/src/SagFileCache.php old mode 100755 new mode 100644 diff --git a/src/SagMemoryCache.php b/src/SagMemoryCache.php old mode 100755 new mode 100644 diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php old mode 100755 new mode 100644 index 97c63d6..e6996c1 --- a/src/httpAdapters/SagCURLHTTPAdapter.php +++ b/src/httpAdapters/SagCURLHTTPAdapter.php @@ -96,8 +96,9 @@ public function procPacket($method, $url, $data = null, $reqHeaders = array(), $ curl_reset($this->ch); curl_setopt_array($this->ch, $opts); - + //echo 'curl options = '; var_dump ($opts); echo PHP_EOL; $chResponse = curl_exec($this->ch); + //echo 'curl response = '; var_dump ($chResponse); if($chResponse !== false) { // prepare the response object diff --git a/src/httpAdapters/SagHTTPAdapter.php b/src/httpAdapters/SagHTTPAdapter.php old mode 100755 new mode 100644 diff --git a/src/httpAdapters/SagNativeHTTPAdapter.php b/src/httpAdapters/SagNativeHTTPAdapter.php old mode 100755 new mode 100644 diff --git a/tests/README b/tests/README old mode 100755 new mode 100644 diff --git a/tests/SagFileCacheTest.php b/tests/SagFileCacheTest.php old mode 100755 new mode 100644 diff --git a/tests/SagMemoryCacheTest.php b/tests/SagMemoryCacheTest.php old mode 100755 new mode 100644 diff --git a/tests/SagTest.php b/tests/SagTest.php old mode 100755 new mode 100644 diff --git a/tests/bootstrap.bsh b/tests/bootstrap.bsh old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-SSL-cURL.xml b/tests/phpunitConfig-SSL-cURL.xml old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-cURL.xml b/tests/phpunitConfig-cURL.xml old mode 100755 new mode 100644 diff --git a/tests/phpunitConfig-nativeSockets.xml b/tests/phpunitConfig-nativeSockets.xml old mode 100755 new mode 100644