From 14de1e3a35bf32b05f29f34f9fdbd358504bc7e0 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 21 Nov 2017 11:37:34 +0000 Subject: [PATCH] PHPC-995: Drop support for MongoDB 2.4 --- CONTRIBUTING.md | 1 - scripts/presets/standalone-24.json | 15 -------- scripts/start-servers.php | 3 -- .../ubuntu/mongo-orchestration-config.json | 3 +- scripts/ubuntu/mongo-orchestration.sh | 3 -- src/MongoDB/BulkWrite.c | 29 ---------------- tests/bulk/bulkwrite-insert_error-004.phpt | 34 ------------------- tests/utils/basic.inc | 1 - 8 files changed, 1 insertion(+), 88 deletions(-) delete mode 100644 scripts/presets/standalone-24.json delete mode 100644 tests/bulk/bulkwrite-insert_error-004.phpt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2fc96f62c..789627be8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,6 @@ URIs and resemble the following: ``` { "STANDALONE": "mongodb:\/\/192.168.112.10:2000", - "STANDALONE_24": "mongodb:\/\/192.168.112.10:2500", "STANDALONE_26": "mongodb:\/\/192.168.112.10:2600", "STANDALONE_30": "mongodb:\/\/192.168.112.10:2700", "STANDALONE_SSL": "mongodb:\/\/192.168.112.10:2100", diff --git a/scripts/presets/standalone-24.json b/scripts/presets/standalone-24.json deleted file mode 100644 index 4c2478642..000000000 --- a/scripts/presets/standalone-24.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "mongod", - "id" : "STANDALONE_24", - "procParams": { - "dbpath": "/tmp/standalone-24/", - "ipv6": true, - "logappend": true, - "logpath": "/tmp/standalone-24/mongod.log", - "journal": true, - "port": 2500, - "setParameter": {"enableTestCommands": 1} - }, - "version": "24-release" -} - diff --git a/scripts/start-servers.php b/scripts/start-servers.php index 634373ac5..80238ff7d 100644 --- a/scripts/start-servers.php +++ b/scripts/start-servers.php @@ -19,7 +19,6 @@ function lap() { $PRESETS = [ "standalone" => [ "scripts/presets/standalone.json", - "scripts/presets/standalone-24.json", "scripts/presets/standalone-26.json", "scripts/presets/standalone-30.json", "scripts/presets/standalone-ssl.json", @@ -124,7 +123,6 @@ function mo_http_request($uri, $context) { wget --body-data='' --method='GET' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/STANDALONE-AUTH wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/STANDALONE -wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/STANDALONE-24 wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/STANDALONE-26 wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/RS-two wget --body-data='' --method='DELETE' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers/RS-arbiter @@ -141,7 +139,6 @@ function mo_http_request($uri, $context) { wget --body-data='' --method='GET' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/replica_sets wget --body-data='{"preset":"\/phongo\/\/scripts\/presets\/standalone.json"}' --method='POST' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers -wget --body-data='{"preset":"\/phongo\/\/scripts\/presets\/standalone-24.json"}' --method='POST' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers wget --body-data='{"preset":"\/phongo\/\/scripts\/presets\/standalone-26.json"}' --method='POST' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers wget --body-data='{"preset":"\/phongo\/\/scripts\/presets\/standalone-ssl.json"}' --method='POST' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers wget --body-data='{"preset":"\/phongo\/\/scripts\/presets\/standalone-auth.json"}' --method='POST' --header='Accept: application/json' --header='Content-type: application/x-www-form-urlencoded' http://192.168.112.10:8889/servers diff --git a/scripts/ubuntu/mongo-orchestration-config.json b/scripts/ubuntu/mongo-orchestration-config.json index 482f3c28d..0bd2e3b5c 100644 --- a/scripts/ubuntu/mongo-orchestration-config.json +++ b/scripts/ubuntu/mongo-orchestration-config.json @@ -2,7 +2,6 @@ "releases": { "32-release": "/home/vagrant/3.2.0/usr/bin", "30-release": "/home/vagrant/3.0.3/usr/bin", - "26-release": "/home/vagrant/2.6.9/usr/bin", - "24-release": "/home/vagrant/2.4.13/usr/bin" + "26-release": "/home/vagrant/2.6.9/usr/bin" } } diff --git a/scripts/ubuntu/mongo-orchestration.sh b/scripts/ubuntu/mongo-orchestration.sh index 72d014af3..e21fada37 100644 --- a/scripts/ubuntu/mongo-orchestration.sh +++ b/scripts/ubuntu/mongo-orchestration.sh @@ -5,7 +5,6 @@ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/3.2 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-3.2.list echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/3.0 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-3.0.list echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/2.6 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-2.6.list -echo 'deb http://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/2.4 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise-2.4.list apt-get update apt-get install -y libsnmp15 libgsasl7 @@ -14,8 +13,6 @@ sudo apt-get download mongodb-enterprise-server=3.2.0 sudo apt-get download mongodb-enterprise-mongos=3.2.0 sudo apt-get download mongodb-enterprise-server=3.0.3 sudo apt-get download mongodb-enterprise-server=2.6.9 -sudo apt-get download mongodb-10gen-enterprise=2.4.13 -dpkg -x mongodb-10gen-enterprise_2.4.13_amd64.deb 2.4.13 dpkg -x mongodb-enterprise-server_2.6.9_amd64.deb 2.6.9 dpkg -x mongodb-enterprise-server_3.0.3_amd64.deb 3.0.3 dpkg -x mongodb-enterprise-server_3.2.0_amd64.deb 3.2.0 diff --git a/src/MongoDB/BulkWrite.c b/src/MongoDB/BulkWrite.c index f93680b3e..015d6334a 100644 --- a/src/MongoDB/BulkWrite.c +++ b/src/MongoDB/BulkWrite.c @@ -31,20 +31,6 @@ zend_class_entry *php_phongo_bulkwrite_ce; -/* Returns whether the insert document appears to be a legacy index. */ -static inline bool php_phongo_bulkwrite_insert_is_legacy_index(bson_t *bdocument) /* {{{ */ -{ - bson_iter_t iter; - - if (bson_iter_init_find(&iter, bdocument, "key") && BSON_ITER_HOLDS_DOCUMENT(&iter) && - bson_iter_init_find(&iter, bdocument, "name") && BSON_ITER_HOLDS_UTF8(&iter) && - bson_iter_init_find(&iter, bdocument, "ns") && BSON_ITER_HOLDS_UTF8(&iter)) { - return true; - } - - return false; -} /* }}} */ - /* Extracts the "_id" field of a BSON document into a return value. */ static void php_phongo_bulkwrite_extract_id(bson_t *doc, zval **return_value) /* {{{ */ { @@ -243,21 +229,6 @@ static PHP_METHOD(BulkWrite, insert) goto cleanup; } - /* If the insert document appears to be a legacy index, instruct libmongoc - * to allow dots in BSON keys by setting the "legacyIndex" option. - * - * Note: php_phongo_zval_to_bson() may have added an ObjectId if the "_id" - * field was unset. We don't know at this point if the insert is destined - * for a pre-2.6 server's "system.indexes" collection, but legacy index - * creation will ignore the "_id" so there is no harm in leaving it. In the - * event php_phongo_bulkwrite_insert_is_legacy_index() returns a false - * positive, we absolutely want ObjectId added if "_id" was unset. */ - if (php_phongo_bulkwrite_insert_is_legacy_index(&bdocument) && - !BSON_APPEND_BOOL(&boptions, "legacyIndex", true)) { - phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error appending \"legacyIndex\" option"); - goto cleanup; - } - if (!mongoc_bulk_operation_insert_with_opts(intern->bulk, &bdocument, &boptions, &error)) { phongo_throw_exception_from_bson_error_t(&error TSRMLS_CC); goto cleanup; diff --git a/tests/bulk/bulkwrite-insert_error-004.phpt b/tests/bulk/bulkwrite-insert_error-004.phpt deleted file mode 100644 index e967bda64..000000000 --- a/tests/bulk/bulkwrite-insert_error-004.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -MongoDB\Driver\BulkWrite::insert() with invalid insert document (legacy index) ---FILE-- -insert(['' => 1, 'key' => ['a.b' => 1], 'name' => 'a.b_1', 'ns' => 'foo']); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; - -echo throws(function() use ($bulk) { - $bulk->insert(['$x' => 1, 'key' => ['a.b' => 1], 'name' => 'a.b_1', 'ns' => 'foo']); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; - -echo throws(function() use ($bulk) { - $bulk->insert(["\xc3\x28" => 1, 'key' => ['a.b' => 1], 'name' => 'a.b_1', 'ns' => 'foo']); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; - -?> -===DONE=== - ---EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%s contains invalid key: empty key - -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%s contains invalid key: keys cannot begin with "$": "$x" - -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%s contains invalid key: corrupt BSON -===DONE=== diff --git a/tests/utils/basic.inc b/tests/utils/basic.inc index 1292fc653..5f26ed4a6 100644 --- a/tests/utils/basic.inc +++ b/tests/utils/basic.inc @@ -13,7 +13,6 @@ if (!$config) { $servers = array( "STANDALONE" => "", - "STANDALONE_24" => "", "STANDALONE_26" => "", "STANDALONE_30" => "", "STANDALONE_SSL" => "",