Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

[WIP] Port everything to zend #56

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0d1cbf1
Initial setup for building everything on top of the zend engine
martin-schilling Dec 31, 2017
33648fb
Removed everything from the driver based on php-cpp
martin-schilling Dec 31, 2017
662cd67
Fix activation of extension
sandrokeil Jan 2, 2018
4e19ed7
Enable Travis
sandrokeil Jan 2, 2018
02265d0
Merge pull request #47 from sandrokeil/feature/phpt-travis
sandrokeil Jan 2, 2018
0b9980f
Add PHPStorm stubs
sandrokeil Jan 3, 2018
16a629a
Started the reimplementation of the vpack class
martin-schilling Jan 6, 2018
e2a6f7c
Reimplemented most of the current Arangodb\Vpack class
martin-schilling Jan 7, 2018
19eb49d
Added simple test for Vpack::fromArray()
martin-schilling Jan 7, 2018
b14031a
Added simple test for Vpack::fromArray()
martin-schilling Jan 7, 2018
0134cdf
Removed PHP 7.0 from Travis since we only support 7.1 and 7.2
martin-schilling Jan 7, 2018
9933158
Added a simple md file that describes the process of creating a new c…
martin-schilling Jan 7, 2018
ecc1d71
Fixed bug where the const char* return value from Vpack::to_json() co…
martin-schilling Jan 7, 2018
bcc6218
Added another test for the Vpack class
martin-schilling Jan 7, 2018
d6e18f8
Restructured some code and added basic setup in order to start implem…
martin-schilling Jan 12, 2018
3dd5697
Fix linking issues with boost
sandrokeil Jan 12, 2018
f92f18a
Reimplemented a basic Request class
martin-schilling Jan 16, 2018
84c2e18
(wip) Porting the old connection class
martin-schilling Jan 17, 2018
4002db0
(wip) Reimplementing the old connection class
martin-schilling Jan 18, 2018
795a016
Fix lib boost_thread multi thread linking issue
sandrokeil Jan 19, 2018
95bdfd5
Fix lib boost_thread multi thread linking issue
sandrokeil Jan 19, 2018
22484e1
(Probably) a fix for a compilation issue only happening on travis
martin-schilling Jan 19, 2018
ac112ee
Merge branch 'port-everything-to-zend' of https://github.com/sandroke…
martin-schilling Jan 19, 2018
dc209cd
Implemented more functionality from the old Connection class
martin-schilling Jan 20, 2018
c64c824
Removed unnecessary connect() function call
martin-schilling Jan 20, 2018
450a5f9
Reimplemented parts of the old get method and moved it from the Respo…
martin-schilling Jan 21, 2018
3cebb72
Added basic test for Vpack::get() functionality
martin-schilling Jan 22, 2018
6aa675a
Added the basic structure for a Response class and used it as the ret…
martin-schilling Jan 22, 2018
8560838
Added Response::getBody() as well as Response::getVpack()
martin-schilling Jan 23, 2018
f4fea10
Removed the Vpack class since it is not really necessary. It's functi…
martin-schilling Jan 25, 2018
7ab2d8e
Moved array->vpack conversion to a separate class and implemented Con…
martin-schilling Jan 25, 2018
4332a51
Added the remaining httpMethod methods to the Connection class
martin-schilling Jan 27, 2018
0da960b
Deleted vpack tests and fixed request tests to work without the Vpack…
martin-schilling Feb 10, 2018
44e0df8
Added a basic cursor
martin-schilling Feb 10, 2018
4a1c0e5
Added a count function to the cursor that returns the current batch size
martin-schilling Feb 10, 2018
54b7cf7
Added functionality used to convert Vpacks to PHP Arrays
martin-schilling Feb 17, 2018
93b6573
Added functionality to iterate a Cursor as an array
martin-schilling Feb 18, 2018
3bd88ce
Renamed array_to_vpack to vpack_conversion
martin-schilling Feb 24, 2018
e8cd088
Moved all zend_class_entry and macros to a central file
martin-schilling Feb 24, 2018
9e77b01
Reimplemented the basic custom exception classes
martin-schilling Feb 24, 2018
1b57f85
Used custom exceptions everywhere
martin-schilling Feb 25, 2018
c544d91
Fixed issues with endless requests if database is not available
martin-schilling Mar 10, 2018
f6addc2
Added assertSuccess Method to Response class
martin-schilling Mar 23, 2018
4d10643
Bugfix failing cursor requests not handled properly
martin-schilling Mar 24, 2018
73ee056
The second argument of Connection::post(), ... now defaults to empty …
martin-schilling Mar 25, 2018
9f1f3ce
Added the classical iterator methods as well as a few others to the C…
martin-schilling Mar 30, 2018
410fada
Added query_params type check/conversion and implemented a proper way…
martin-schilling Mar 31, 2018
c1fe2c8
For now most vpack slice types default to null
martin-schilling Mar 31, 2018
d53348d
Response::assertSuccess is now always called and made changes to the …
martin-schilling Apr 1, 2018
eb7ad15
Reimplemented the additional functionality for the RequestFailedExcep…
martin-schilling Apr 1, 2018
5ace5c8
Connection::query now throws a proper RequestFailedException on failu…
martin-schilling Apr 2, 2018
7cefc9f
Fixed memory issue with temporary std::string
martin-schilling Apr 2, 2018
92efc03
Added missing constants for setting the VST_VERSION
martin-schilling Apr 4, 2018
6220801
Replaced all const HashTable* with HashTable* for now since PHP 7.2 w…
martin-schilling Apr 5, 2018
e973430
Removed vpack for Connection::get(), ::head() and ::options()
martin-schilling Apr 9, 2018
e1439f5
Replaced all old exception macros with the new C++ throw exception ha…
martin-schilling Apr 12, 2018
bd1e814
Exception converter now converts everything to a PHP Exception
martin-schilling Apr 12, 2018
b2ca6d8
Better exception message
martin-schilling Apr 12, 2018
15119c3
Fixed issue with std::string being constructed from NULL
martin-schilling Apr 14, 2018
97683f3
Fixed major memory leak
martin-schilling Apr 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ deps/*
vendor/
composer.lock
compile_commands.json
modules
.libs
autom4te.cache
44 changes: 44 additions & 0 deletions .travis.scripts/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
trap abort_on_failure ERR

abort_on_failure () {
echo "Last command failed, exising"
exit 42;
}

build_vpack() {
mkdir tmp-vpack
pushd tmp-vpack
git clone https://github.com/arangodb/velocypack.git velocypack
cd velocypack
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fPIC -std=c++11"
sudo make install
popd
}
build_vpack

build_fuerte() {
mkdir tmp-fuerte
pushd tmp-fuerte
git clone https://github.com/arangodb/fuerte.git fuerte
cd fuerte
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fPIC -std=c++11"
sudo make install
popd
}
build_fuerte

phpize
./configure
make all -j4
sudo make install

echo "Use the most-up-to-date run-tests.. old ones like 5.3 don't report failure exit codes"
wget -O run-tests.php https://raw.githubusercontent.com/php/php-src/master/run-tests.php


rm -rf tmp-vpack tmp tmp-fuerte # coveralls may pick it up and lie about our coverage

echo "extension=arangodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
49 changes: 26 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
sudo: required
language: php
php:
- 7.2
- 7.1

services:
- docker
env:
global:
- TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff"
- REPORT_EXIT_STATUS=1
- ARANGODB_VERSION=3.2

jobs:
include:
- stage: build and test extension
env:
- DOCKER_COMPOSE_VERSION=1.16.1
- DEPENDENCIES="--prefer-lowest --prefer-stable"
script:
- docker info
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker-compose up -d --no-recreate arangodb
- ./get_fuerte
- docker-compose build arangodb-builder
- docker-compose run --rm arangodb-builder
- docker-compose build php
- docker run --rm -it --volume $(pwd):/app prooph/composer:7.1 update --prefer-dist $DEPENDENCIES
- docker-compose run --rm php vendor/bin/phpunit
- docker-compose down -v
addons:
hosts:
- arangodb

before_install:
- sudo apt-get update
- sudo apt-get install -y gdb valgrind
- sudo apt-get install -y git build-essential autoconf automake libtool bison re2c cmake libssl-dev libcurl4-openssl-dev libboost-system-dev libboost-thread-dev
- "./.travis.scripts/compile.sh"

before_script:
- wget https://www.arangodb.com/repositories/travisCI/setup_arangodb_${ARANGODB_VERSION}.sh
- chmod 777 setup_arangodb_${ARANGODB_VERSION}.sh
- ./setup_arangodb_${ARANGODB_VERSION}.sh

script:
- make test

after_script:
- killall -s SIGTERM arangod_x86_64
87 changes: 0 additions & 87 deletions CMakeLists.txt

This file was deleted.

8 changes: 3 additions & 5 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM arangodb-builder

COPY docker-entrypoint.sh /usr/local/bin/
COPY modules/arangodb.so /tmp

RUN echo "extension=libarangodb.so" > /usr/local/etc/php/conf.d/arangodb.ini \
&& ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat

ENTRYPOINT ["docker-entrypoint.sh"]
RUN echo "extension=arangodb.so" > /usr/local/etc/php/conf.d/arangodb.ini \
&& mv /tmp/arangodb.so $(php-config --extension-dir)
23 changes: 15 additions & 8 deletions Dockerfile.builder
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,30 @@ RUN buildDeps=' \
openssl-dev \
libc-dev \
pcre-dev \
autoconf \
' \
&& apk add --update $buildDeps \
&& docker-php-source extract

COPY deps /tmp

RUN cd /tmp/phpcpp \
&& sed -i 's/`\${PHP_CONFIG} \-\-ldflags`//g' Makefile \
&& make \
&& make install
RUN cd /tmp/velocypack \
&& mkdir -p build \
&& cd build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC \
&& make install

RUN cd /tmp/fuerte \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC \
&& make install

WORKDIR /app
VOLUME ["/app"]

RUN apk add --update bash && rm -rf /tmp/*

RUN docker-php-source extract
RUN apk add --update bash \
boost-system \
boost-thread \
&& rm -rf /tmp/*

ENTRYPOINT []
CMD bash -c "cd /app/build && cmake .. -DPHPCPP_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC && make"
CMD bash -c "cd /app && phpize && ./configure && make all -j4"
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ First install dependencies with
$ ./get_fuerte
```

and PHP dependencies with

```
$ docker run --rm -it --volume $(pwd):/app prooph/composer:7.1 update
```

This extension is build with [PHP-CPP](http://www.php-cpp.com/).
This extension is build with [native Zend Engine](http://www.phpinternalsbook.com/#php-7).
The build is simple with [Docker Compose](https://docs.docker.com/compose/install/).

```
Expand All @@ -27,6 +21,7 @@ $ docker-compose up -d --no-recreate arangodb

```
$ docker-compose run --rm arangodb-builder
$ docker-compose run --rm arangodb-builder make test
$ docker-compose build php
$ docker-compose run --rm php vendor/bin/phpunit
```
Expand All @@ -35,14 +30,16 @@ Cleanup

```
$ docker-compose down -v
$ docker-compose run --rm arangodb-builder make clean
$ docker-compose run --rm arangodb-builder phpize --clean
```

### Debugging
Check which symbols are in `build/libarangodb.so`. See [nm docs](https://linux.die.net/man/1/nm).
Check which symbols are in `modules/arangodb.so`. See [nm docs](https://linux.die.net/man/1/nm).

```
$ nm -g build/libarangodb.so | grep ArangoDb
$ ldd build/libarangodb.so
$ nm -g modules/arangodb.so | grep arangodb
$ ldd modules/arangodb.so
```

### UI
Expand Down
Empty file removed build/.gitkeep
Empty file.
Loading