Commit 31789660 authored by Ondrej Sury's avatar Ondrej Sury

Merge tag 'upstream/1.2.0'

Upstream version 1.2.0

# gpg: Signature made 2016-12-01T11:18:24 CET
# gpg:                using RSA key 0x0C99B70EF4FCBB07
# gpg: Good signature from "Ondřej Surý <ondrej@sury.org>" [ultimate]
# gpg:                 aka "[jpeg image of size 3934]" [ultimate]
# gpg:                 aka "Ondřej Surý <ondrej@debian.org>" [ultimate]
# gpg:                 aka "Ondřej Surý <ondrej.sury@nic.cz>" [ultimate]
# Primary key fingerprint: 30B9 33D8 0FCE 3D98 1A2D  38FB 0C99 B70E F4FC BB07
parents 57989f21 b30fb07c
MongoDB Driver for PHP
Hannes Magnusson, Jeremy Mikola, Derick Rethans
.PHONY: coverage testclean package package.xml
DATE=`date +%Y-%m-%d--%H-%M-%S`
MONGODB_VERSION=$(shell php -n -dextension=modules/mongodb.so -r 'echo MONGODB_VERSION;')
MONGODB_MINOR=$(shell echo $(MONGODB_VERSION) | cut -d. -f1,2)
MONGODB_STABILITY=$(shell php -n -dextension=modules/mongodb.so -r 'echo MONGODB_STABILITY;')
LIB_PATH=vendor/mongodb/mongodb
COMPOSER_ARGS=update --no-interaction --prefer-source
PHPUNIT_ARGS=--process-isolation
help:
@echo -e "\t$$ make vm"
@echo -e "\t - Launches VMs for running multiple MongoDB variations"
@echo -e "\t$$ make list-servers"
@echo -e "\t - Lists running servers, and their URIs"
@echo -e "\t$$ make test-bootstrap"
@echo -e "\t - Starts up MongoDB through mongo-orchestration"
@echo ""
@echo -e "\t$$ make coveralls"
@echo -e "\t - Creates code coverage report using coveralls"
@echo -e "\t$$ make coverage"
@echo -e "\t - Creates code coverage report using gcov"
@echo ""
@echo -e "\t$$ make composer"
@echo -e "\t - Installs test dependencies using composer"
@echo ""
@echo -e "\t$$ make distcheck"
@echo -e "\t - Builds the archive, runs the virtual tests"
@echo ""
@echo -e "\t$$ make package.xml"
@echo -e "\t - Creates a package.xml file with empty release notes"
@echo -e "\t$$ make package"
@echo -e "\t - Creates the pecl archive to use for provisioning"
@echo -e "\t$$ make test-virtual"
@echo -e "\t - Provisions some VMs, installs the pecl archive and executes the tests"
mv-coverage:
@if test -e $(top_srcdir)/coverage; then \
echo "Moving previous coverage run to coverage-$(DATE)"; \
mv coverage coverage-$(DATE); \
fi
lcov-coveralls:
lcov --gcov-tool $(top_srcdir)/.llvm-cov.sh --capture --directory . --output-file .coverage.lcov --no-external
lcov-local:
lcov --gcov-tool $(top_srcdir)/.llvm-cov.sh --capture --derive-func-data --directory . --output-file .coverage.lcov --no-external
coverage: mv-coverage lcov-local
genhtml .coverage.lcov --legend --title "mongodb code coverage" --output-directory coverage
coveralls: mv-coverage lcov-coveralls
coveralls --exclude src/libbson --exclude src/libmongoc --exclude src/contrib --exclude lib --exclude tests
composer:
@command -v composer >/dev/null 2>&1; \
if test $$? -eq 0; then \
composer $(COMPOSER_ARGS) ;\
if test -d $(LIB_PATH); then \
composer $(COMPOSER_ARGS) --working-dir $(LIB_PATH) ;\
fi \
elif test -r composer.phar; then \
php composer.phar $(COMPOSER_ARGS); \
if test -d $(LIB_PATH); then \
php $(top_srcdir)/composer.phar $(COMPOSER_ARGS) --working-dir $(LIB_PATH) ;\
fi \
else \
echo "Cannot find composer :("; \
echo "Aborting."; \
exit 1; \
fi
vm:
@command -v vagrant >/dev/null 2>&1 || { echo >&2 "Vagrant needs to be installed to run vms"; exit 1; }
@vagrant up ldap mo
list-servers:
php scripts/list-servers.php
test-bootstrap:
php scripts/start-servers.php
distcheck: package test-virtual
test-virtual: package
sh ./scripts/run-tests-on.sh freebsd
sh ./scripts/run-tests-on.sh precise32
sh ./scripts/run-tests-on.sh precise64
testunit: composer
@command -v phpunit >/dev/null 2>&1; \
if test $$? -eq 0; then \
pushd $(LIB_PATH) ;\
phpunit $(PHPUNIT_ARGS) ;\
popd ;\
elif test -r phpunit.phar; then \
pushd $(LIB_PATH) ;\
php $(top_srcdir)/phpunit.phar $(PHPUNIT_ARGS) ;\
popd ;\
else \
echo "Cannot find phpunit :("; \
echo "Aborting."; \
exit 1; \
fi
testall: composer test testunit
testclean:
@for group in generic standalone; do \
find $(top_srcdir)/tests/$$group -type f -name "*.diff" -o -name "*.exp" -o -name "*.log" -o -name "*.mem" -o -name "*.out" -o -name "*.php" -o -name "*.sh" | xargs rm -f; \
done;
package:
pecl package package.xml
package.xml:
php bin/prep-release.php $(MONGODB_VERSION) $(MONGODB_STABILITY)
# pecl/mongodb (MongoDB driver for PHP)
[![Build Status](https://api.travis-ci.org/mongodb/mongo-php-driver.png?branch=master)](https://travis-ci.org/mongodb/mongo-php-driver)
[![Coverage Status](https://coveralls.io/repos/mongodb/mongo-php-driver/badge.svg?branch=master&service=github)](https://coveralls.io/github/mongodb/mongo-php-driver?branch=master)
This is the low-level PHP driver for MongoDB. The API is the same
as the HHVM driver for MongoDB. The documentation for both of them is the same,
and can be found at http://docs.php.net/manual/en/set.mongodb.php
The driver is written to be a bare bone layer to talk to MongoDB, and
therefore misses many convenience features. Instead, these convenience methods
have been split out into a layer written in PHP, the
[MongoDB Library](http://mongodb.github.io/mongo-php-library/).
Using this library should be your preferred way of interacting with MongoDB.
Please note that the new HHVM and PHP drivers implement a **different API**
from the legacy driver at http://pecl.php.net/package/mongo; therefore
existing libraries that use the legacy driver (e.g.
[Doctrine MongoDB's ODM](http://doctrine-mongodb-odm.readthedocs.org/en/latest/))
will not work with the new drivers.
In the long run, we hope that userland packages will be built atop this driver
to implement various APIs (e.g. a BC layer for the existing driver, new fluent
interfaces), management utilities (for creating admin utilities and cluster
management applications), and other interesting libraries.
## Documentation
- http://docs.php.net/set.mongodb
## Installation
To build and install the driver:
```
$ pecl install mongodb
$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
```
We recommend using this extension in conjunction with our
[userland library](https://github.com/mongodb/mongo-php-library),
which is distributed as
[mongodb/mongodb](https://packagist.org/packages/mongodb/mongodb) for Composer.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## Related Projects
- [HHVM Implementation of this driver](https://github.com/mongodb/mongo-hhvm-driver)
- [Official high-level library](https://github.com/mongodb/mongo-php-library)
- [MongoDB Transistor](https://github.com/bjori/mongo-php-transistor) Lightweight ODM using the [Persistable](http://php.net/bson\\persistable) interface
This diff is collapsed.
// vim:ft=javascript
function mongodb_generate_header(inpath, outpath, replacements)
{
STDOUT.WriteLine("Generating " + outpath);
var infile = FSO.OpenTextFile(inpath, 1);
var outdata = infile.ReadAll();
infile.Close();
for (var key in replacements) {
var replacement = replacements[key];
if (typeof replacement === 'string') {
replacement = replacement.replace(/"/g, '\\"');
}
outdata = outdata.replace("@" + key + "@", replacement);
}
var outfile = FSO.CreateTextFile(outpath, true);
outfile.Write(outdata);
outfile.Close();
}
function mongodb_parse_version_file(inpath, prefix)
{
var infile = FSO.OpenTextFile(inpath, 1);
var version = infile.ReadLine();
infile.Close();
var xyz_pre = version.split("-");
var xyz = xyz_pre[0].split(".");
var replacements = {};
replacements[prefix + "VERSION"] = version;
replacements[prefix + "MAJOR_VERSION"] = xyz[0];
replacements[prefix + "MINOR_VERSION"] = xyz[1];
replacements[prefix + "MICRO_VERSION"] = xyz[2];
replacements[prefix + "PRERELEASE_VERSION"] = xyz_pre[1];
return replacements;