Skip to content

Commit 5617f0a

Browse files
authored
Merge pull request #821 from Geolim4/master
Added beta support for Couchbase SDK 3 as requested in #721
2 parents 357df8b + 50809da commit 5617f0a

25 files changed

+636
-147
lines changed

.travis.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
fast_finish: true
2727
allow_failures:
2828
- php: nightly
29-
# - php: hhvm
3029
include:
3130
- dist: trusty
3231
php: 7.3
@@ -39,21 +38,28 @@ jobs:
3938
php: 7.4
4039

4140
before_install:
41+
# Memcached is not yet available for PHP8 (hasn't been updated since 2019): https://pecl.php.net/package/memcached
42+
# Memcache however seems to be compatible with PHP 7 and 8: https://pecl.php.net/package/memcache
43+
#
44+
- |
45+
echo "\$TRAVIS_PHP_VERSION set to: $TRAVIS_PHP_VERSION";
46+
pecl channel-update pecl.php.net;
47+
yes | pecl install -f mongodb-stable;
48+
yes | pecl install -f apcu-stable || true;
4249
- |
43-
if [[ $TRAVIS_PHP_VERSION = "hhv"* ]]; then
44-
cat bin/ci/hhvm_phpfastcache.ini >> /etc/hhvm/php.ini
50+
if [[ $TRAVIS_PHP_VERSION == "8."* || $TRAVIS_PHP_VERSION == "nightly" ]]; then
51+
./bin/ci/scripts/setup_couchbase.sh;
52+
yes | pecl install -f couchbase-stable;
53+
yes | pecl install -f memcache;
54+
phpenv config-add bin/ci/php8_phpfastcache.ini;
4555
else
46-
pecl channel-update pecl.php.net;
47-
yes | pecl install -f mongodb-stable;
48-
yes | pecl install -f memcached;
49-
yes | pecl install -f apcu-stable || true;
50-
phpenv config-add bin/ci/php_phpfastcache.ini;
56+
phpenv config-add bin/ci/php7_phpfastcache.ini;
5157
fi
52-
- sleep 15
53-
- mongo pfc_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'
58+
- phpenv config-add bin/ci/php_common.ini;
59+
- phpenv config-rm xdebug.ini
60+
- ./bin/ci/scripts/setup_mongodb.sh
5461

5562
install:
56-
- ./bin/ci/install_dependencies.sh
57-
63+
- ./bin/ci/scripts/install_dependencies.sh
5864
script:
5965
- php -f ./bin/ci/run_tests.php

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This ensure you that the library is completely reliable when it come to manipula
2525
| Regular drivers | High performances drivers | Development drivers | Cluster-Aggregated drivers |
2626
|---------------------------------|------------------------------------|-------------------------------|-----------------------------------|
2727
| `Apcu` *(APC support removed)* | `Cassandra` | `Devnull` | `FullReplicationCluster` |
28-
| `Cookie` | `CouchBase` | `Devfalse` | `SemiReplicationCluster` |
28+
| `Cookie` | `CouchBase(v3)` | `Devfalse` | `SemiReplicationCluster` |
2929
| `Files` | `Couchdb` | `Devtrue` | `MasterSlaveReplicationCluster` |
3030
| `Leveldb` | `Mongodb` | `Memstatic` | `RandomReplicationCluster` |
3131
| `Memcache(d)` | `Predis` | | |

bin/ci/hhvm_phpfastcache.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

bin/ci/php7_phpfastcache.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension="memcached.so"

bin/ci/php8_phpfastcache.ini

Whitespace-only changes.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
; Adding required extensions for tests
2-
extension="memcached.so"
31
extension="redis.so"
42
apc.enabled=1
53
apc.shm_size=32M
64
apc.ttl=7200
75
apc.enable_cli=1
8-
apc.serializer=php
6+
apc.serializer=php

bin/ci/scripts/setup_couchbase.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
# Not possible to run docker container in travis...
4+
# https://docs.travis-ci.com/user/database-setup/#starting-services => Couchbase not yet available
5+
6+
set -e
7+
8+
export CB_VERSION=7.0.0
9+
export CB_RELEASE_URL=https://packages.couchbase.com/releases
10+
export CB_PACKAGE=couchbase-server-community_7.0.0-ubuntu18.04_amd64.deb
11+
12+
# Community Edition requires that all nodes provision all services or data service only
13+
export SERVICES="kv,n1ql,index,fts"
14+
15+
export USERNAME=test
16+
export PASSWORD=phpfastcache
17+
18+
export MEMORY_QUOTA=256
19+
export INDEX_MEMORY_QUOTA=256
20+
export FTS_MEMORY_QUOTA=256
21+
22+
23+
# Check if couchbase server is up
24+
check_db() {
25+
curl --silent http://127.0.0.1:8091/pools > /dev/null
26+
echo $?
27+
}
28+
29+
# Variable used in echo
30+
i=1
31+
# Echo with
32+
numbered_echo() {
33+
echo "[$i] $@"
34+
i=`expr $i + 1`
35+
}
36+
37+
echo "# Prepare Couchbase dependencies"
38+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A3FAA648D9223EDA
39+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1616981CC4A088B2
40+
echo "deb https://packages.couchbase.com/ubuntu bionic bionic/main" | sudo tee /etc/apt/sources.list.d/couchbase.list
41+
echo "deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1804 bionic bionic/main" | sudo tee /etc/apt/sources.list.d/couchbase.list
42+
sudo apt-get update
43+
sudo apt-get install -yq libcouchbase3 libcouchbase-dev build-essential libssl1.0.0 runit wget python-httplib2 chrpath tzdata lsof lshw sysstat net-tools numactl
44+
45+
echo "# Downloading couchbase"
46+
wget -q -N $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE
47+
sudo dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE
48+
49+
# Wait until it's ready
50+
until [[ $(check_db) = 0 ]]; do
51+
>&2 numbered_echo "Waiting for Couchbase Server to be available"
52+
sleep 1
53+
done
54+
55+
echo "# Couchbase Server Online"
56+
echo "# Starting setup process"
57+
58+
echo "# Setting up memory"
59+
curl -i "http://127.0.0.1:8091/pools/default" \
60+
-d memoryQuota=${MEMORY_QUOTA} \
61+
-d indexMemoryQuota=${INDEX_MEMORY_QUOTA} \
62+
-d ftsMemoryQuota=${FTS_MEMORY_QUOTA}
63+
64+
echo "# Setting up services"
65+
curl -i "http://127.0.0.1:8091/node/controller/setupServices" \
66+
-d services="${SERVICES}"
67+
68+
echo "# Setting up user credentials"
69+
curl -i "http://127.0.0.1:8091/settings/web" \
70+
-d port=8091 \
71+
-d username=${USERNAME} \
72+
-d password=${PASSWORD}
73+
74+
echo "# Setting up the bucket"
75+
curl -i "http://127.0.0.1:8091/pools/default/buckets" \
76+
-d name=phpfastcache \
77+
-d ramQuotaMB=256 \
78+
-u ${USERNAME}:${PASSWORD} \
79+
80+
81+
echo "# Couchbase running successfully"

bin/ci/scripts/setup_mongodb.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
mongo pfc_test --eval 'db.createUser({user:"travis",pwd:"test",roles:["readWrite"]});'

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
"psr/cache": "~1.0.0",
2626
"psr/simple-cache": "~1.0.0",
2727
"ext-mbstring": "*",
28-
"ext-json": "*",
29-
"phpfastcache/couchdb": "^1.0"
28+
"ext-json": "*"
3029
},
3130
"require-dev": {
3231
"league/climate": "^3.5",
@@ -43,6 +42,7 @@
4342
"ext-wincache": "*",
4443
"ext-leveldb": "*",
4544
"ext-couchbase": "*",
45+
"ext-couchbase_v3": "*",
4646
"predis/predis": "^1.1",
4747
"mongodb/mongodb": "^1.9",
4848
"phpfastcache/phpssdb": "~1.0.0",

0 commit comments

Comments
 (0)