From 3de8680c65a227275287e6398d45ef93dcb4cace Mon Sep 17 00:00:00 2001 From: Robin Speekenbrink Date: Tue, 5 Jul 2016 22:38:12 +0200 Subject: [PATCH] tried to get the extension to work.. I've updated the raffle script (test.php) in order to dynamically read the given file, add the names. The problem is... all it currently does is return "yes" ? --- jaytaph-php7-extension/Dockerfile | 20 ++++++++++++++++++++ jaytaph-php7-extension/test.php | 14 +++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 jaytaph-php7-extension/Dockerfile diff --git a/jaytaph-php7-extension/Dockerfile b/jaytaph-php7-extension/Dockerfile new file mode 100644 index 0000000..82efac2 --- /dev/null +++ b/jaytaph-php7-extension/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.4 +MAINTAINER robin@kingsquare.nl + +# build it and they will com.. pile +RUN apk add --no-cache autoconf gcc g++ make + +# Create working dir +RUN mkdir -p /var/app +COPY . /var/app +WORKDIR /var/app + +# compile it and they will raffle +RUN phpize && \ + ./configure && \ + make && \ + make install && + echo "extension=domcode.so" >> /usr/local/etc/php/conf.d/domcode.ini + +CMD ["php", "test.php", "/var/names/current"] + diff --git a/jaytaph-php7-extension/test.php b/jaytaph-php7-extension/test.php index 0ba53a0..9ca2aec 100644 --- a/jaytaph-php7-extension/test.php +++ b/jaytaph-php7-extension/test.php @@ -1,8 +1,12 @@ addname('foo'); -$d->addname('bar'); -$d->addname('baz'); +$filename = !empty($argv[1]) && is_readable($argv[1]) ? realpath($argv[1]) : ''; +if (empty($filename)) { + die('please use `php test.php path_to_file`'); +} -echo $d->raffle(); +$d = new DomCode(); +foreach (array_filter(file($filename)) as $name) { + $d->addname($name); +} +echo $d->raffle().PHP_EOL;