Skip to content

Commit e6a5995

Browse files
committed
Merge pull request #614
2 parents c08f056 + 9cbd82b commit e6a5995

23 files changed

+123
-158
lines changed

config.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ if test "$MONGODB" != "no"; then
193193
src/MongoDB/Exception/SSLConnectionException.c \
194194
src/MongoDB/Exception/UnexpectedValueException.c \
195195
src/MongoDB/Exception/WriteException.c \
196-
src/MongoDB/Monitoring.c \
197196
src/MongoDB/Monitoring/CommandFailedEvent.c \
198197
src/MongoDB/Monitoring/CommandStartedEvent.c \
199198
src/MongoDB/Monitoring/CommandSubscriber.c \
200199
src/MongoDB/Monitoring/CommandSucceededEvent.c \
201-
src/MongoDB/Monitoring/Subscriber.c
200+
src/MongoDB/Monitoring/Subscriber.c \
201+
src/MongoDB/Monitoring/functions.c
202202
"
203203

204204
PHP_ARG_WITH(libbson, whether to use system libbson,

config.w32

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ if (PHP_MONGODB != "no") {
8585
EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
8686
ADD_SOURCES(configure_module_dirname + "/src", "bson.c bson-encode.c", "mongodb");
8787
ADD_SOURCES(configure_module_dirname + "/src/BSON", "Binary.c Decimal128.c Javascript.c MaxKey.c MinKey.c ObjectID.c Persistable.c Regex.c Serializable.c Timestamp.c Type.c TypeWrapper.c Unserializable.c UTCDateTime.c", "mongodb");
88-
ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorId.c Manager.c Monitoring.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
88+
ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorId.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
8989
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c ConnectionException.c ConnectionTimeoutException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c", "mongodb");
90-
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c", "mongodb");
90+
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c functions.c", "mongodb");
9191
ADD_SOURCES(configure_module_dirname + "/src/libbson/src/bson", PHP_MONGODB_BSON_SOURCES, "mongodb");
9292
ADD_SOURCES(configure_module_dirname + "/src/libbson/src/jsonsl", PHP_MONGODB_JSONSL_SOURCES, "mongodb");
9393
ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", PHP_MONGODB_MONGOC_SOURCES, "mongodb");

php_phongo.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
/* Our stuffz */
6868
#include "php_phongo.h"
6969
#include "php_bson.h"
70-
#include "src/MongoDB/Monitoring.h"
70+
#include "src/MongoDB/Monitoring/functions.h"
7171

7272
#undef MONGOC_LOG_DOMAIN
7373
#define MONGOC_LOG_DOMAIN "PHONGO"
@@ -2409,23 +2409,18 @@ ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromJSON, 0, 0, 1)
24092409
ZEND_ARG_INFO(0, json)
24102410
ZEND_END_ARG_INFO();
24112411

2412-
ZEND_BEGIN_ARG_INFO_EX(ai_Monitoring_addSubscriber, 0, 0, 1)
2413-
ZEND_ARG_INFO(0, subscriber)
2414-
ZEND_END_ARG_INFO()
2415-
2416-
ZEND_BEGIN_ARG_INFO_EX(ai_Monitoring_removeSubscriber, 0, 0, 1)
2417-
ZEND_ARG_INFO(0, subscriber)
2418-
ZEND_END_ARG_INFO()
2419-
2412+
ZEND_BEGIN_ARG_INFO_EX(ai_mongodb_driver_monitoring_subscriber, 0, 0, 1)
2413+
ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0)
2414+
ZEND_END_ARG_INFO();
24202415

24212416
static const zend_function_entry mongodb_functions[] = {
24222417
ZEND_NS_NAMED_FE("MongoDB\\BSON", fromPHP, PHP_FN(MongoDB_BSON_fromPHP), ai_bson_fromPHP)
24232418
ZEND_NS_NAMED_FE("MongoDB\\BSON", toPHP, PHP_FN(MongoDB_BSON_toPHP), ai_bson_toPHP)
24242419
ZEND_NS_NAMED_FE("MongoDB\\BSON", toJSON, PHP_FN(MongoDB_BSON_toJSON), ai_bson_toJSON)
24252420
ZEND_NS_NAMED_FE("MongoDB\\BSON", toExtendedJSON, PHP_FN(MongoDB_BSON_toExtendedJSON), ai_bson_toExtendedJSON)
24262421
ZEND_NS_NAMED_FE("MongoDB\\BSON", fromJSON, PHP_FN(MongoDB_BSON_fromJSON), ai_bson_fromJSON)
2427-
ZEND_NS_NAMED_FE("MongoDB\\Monitoring", addSubscriber, PHP_FN(MongoDB_Monitoring_addSubscriber), ai_Monitoring_addSubscriber)
2428-
ZEND_NS_NAMED_FE("MongoDB\\Monitoring", removeSubscriber, PHP_FN(MongoDB_Monitoring_removeSubscriber), ai_Monitoring_removeSubscriber)
2422+
ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", addSubscriber, PHP_FN(MongoDB_Driver_Monitoring_addSubscriber), ai_mongodb_driver_monitoring_subscriber)
2423+
ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", removeSubscriber, PHP_FN(MongoDB_Driver_Monitoring_removeSubscriber), ai_mongodb_driver_monitoring_subscriber)
24292424
PHP_FE_END
24302425
};
24312426
/* }}} */

src/MongoDB/Monitoring/CommandFailedEvent.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
/*
2-
+---------------------------------------------------------------------------+
3-
| PHP Driver for MongoDB |
4-
+---------------------------------------------------------------------------+
5-
| Copyright 2016-2016 MongoDB, Inc. |
6-
| |
7-
| Licensed under the Apache License, Version 2.0 (the "License"); |
8-
| you may not use this file except in compliance with the License. |
9-
| You may obtain a copy of the License at |
10-
| |
11-
| http://www.apache.org/licenses/LICENSE-2.0 |
12-
| |
13-
| Unless required by applicable law or agreed to in writing, software |
14-
| distributed under the License is distributed on an "AS IS" BASIS, |
15-
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16-
| See the License for the specific language governing permissions and |
17-
| limitations under the License. |
18-
+---------------------------------------------------------------------------+
19-
| Copyright (c) 2016-2016 MongoDB, Inc. |
20-
+---------------------------------------------------------------------------+
21-
*/
2+
* Copyright 2016-2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
2216

2317
#ifdef HAVE_CONFIG_H
2418
# include "config.h"

src/MongoDB/Monitoring/CommandStartedEvent.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
/*
2-
+---------------------------------------------------------------------------+
3-
| PHP Driver for MongoDB |
4-
+---------------------------------------------------------------------------+
5-
| Copyright 2016-2016 MongoDB, Inc. |
6-
| |
7-
| Licensed under the Apache License, Version 2.0 (the "License"); |
8-
| you may not use this file except in compliance with the License. |
9-
| You may obtain a copy of the License at |
10-
| |
11-
| http://www.apache.org/licenses/LICENSE-2.0 |
12-
| |
13-
| Unless required by applicable law or agreed to in writing, software |
14-
| distributed under the License is distributed on an "AS IS" BASIS, |
15-
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16-
| See the License for the specific language governing permissions and |
17-
| limitations under the License. |
18-
+---------------------------------------------------------------------------+
19-
| Copyright (c) 2016-2016 MongoDB, Inc. |
20-
+---------------------------------------------------------------------------+
21-
*/
2+
* Copyright 2016-2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
2216

2317
#ifdef HAVE_CONFIG_H
2418
# include "config.h"

src/MongoDB/Monitoring/CommandSubscriber.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
/*
2-
+---------------------------------------------------------------------------+
3-
| PHP Driver for MongoDB |
4-
+---------------------------------------------------------------------------+
5-
| Copyright 2016-2016 MongoDB, Inc. |
6-
| |
7-
| Licensed under the Apache License, Version 2.0 (the "License"); |
8-
| you may not use this file except in compliance with the License. |
9-
| You may obtain a copy of the License at |
10-
| |
11-
| http://www.apache.org/licenses/LICENSE-2.0 |
12-
| |
13-
| Unless required by applicable law or agreed to in writing, software |
14-
| distributed under the License is distributed on an "AS IS" BASIS, |
15-
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16-
| See the License for the specific language governing permissions and |
17-
| limitations under the License. |
18-
+---------------------------------------------------------------------------+
19-
| Copyright (c) 2016-2016 MongoDB, Inc. |
20-
+---------------------------------------------------------------------------+
21-
*/
2+
* Copyright 2016-2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
2216

2317
#ifdef HAVE_CONFIG_H
2418
# include "config.h"

src/MongoDB/Monitoring/CommandSucceededEvent.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
/*
2-
+---------------------------------------------------------------------------+
3-
| PHP Driver for MongoDB |
4-
+---------------------------------------------------------------------------+
5-
| Copyright 2016-2016 MongoDB, Inc. |
6-
| |
7-
| Licensed under the Apache License, Version 2.0 (the "License"); |
8-
| you may not use this file except in compliance with the License. |
9-
| You may obtain a copy of the License at |
10-
| |
11-
| http://www.apache.org/licenses/LICENSE-2.0 |
12-
| |
13-
| Unless required by applicable law or agreed to in writing, software |
14-
| distributed under the License is distributed on an "AS IS" BASIS, |
15-
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16-
| See the License for the specific language governing permissions and |
17-
| limitations under the License. |
18-
+---------------------------------------------------------------------------+
19-
| Copyright (c) 2016-2016 MongoDB, Inc. |
20-
+---------------------------------------------------------------------------+
21-
*/
2+
* Copyright 2016-2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
2216

2317
#ifdef HAVE_CONFIG_H
2418
# include "config.h"

src/MongoDB/Monitoring/Subscriber.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
/*
2-
+---------------------------------------------------------------------------+
3-
| PHP Driver for MongoDB |
4-
+---------------------------------------------------------------------------+
5-
| Copyright 2016-2016 MongoDB, Inc. |
6-
| |
7-
| Licensed under the Apache License, Version 2.0 (the "License"); |
8-
| you may not use this file except in compliance with the License. |
9-
| You may obtain a copy of the License at |
10-
| |
11-
| http://www.apache.org/licenses/LICENSE-2.0 |
12-
| |
13-
| Unless required by applicable law or agreed to in writing, software |
14-
| distributed under the License is distributed on an "AS IS" BASIS, |
15-
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16-
| See the License for the specific language governing permissions and |
17-
| limitations under the License. |
18-
+---------------------------------------------------------------------------+
19-
| Copyright (c) 2016-2016 MongoDB, Inc. |
20-
+---------------------------------------------------------------------------+
21-
*/
2+
* Copyright 2016-2017 MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
2216

2317
#ifdef HAVE_CONFIG_H
2418
# include "config.h"
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2017 MongoDB, Inc.
2+
* Copyright 2016-2017 MongoDB, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,9 +34,9 @@ static char *php_phongo_make_subscriber_hash(zval *subscriber TSRMLS_DC)
3434
return hash;
3535
}
3636

37-
/* {{{ proto void MongoDB\Monitoring::addSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
37+
/* {{{ proto void MongoDB\Driver\Monitoring\addSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
3838
Adds a monitoring subscriber to the set of subscribers */
39-
PHP_FUNCTION(MongoDB_Monitoring_addSubscriber)
39+
PHP_FUNCTION(MongoDB_Driver_Monitoring_addSubscriber)
4040
{
4141
zval *zSubscriber = NULL;
4242
char *hash;
@@ -59,6 +59,7 @@ PHP_FUNCTION(MongoDB_Monitoring_addSubscriber)
5959
}
6060

6161
hash = php_phongo_make_subscriber_hash(zSubscriber TSRMLS_CC);
62+
6263
/* If we have already stored the subscriber, bail out. Otherwise, add
6364
* subscriber to list */
6465
#if PHP_VERSION_ID >= 70000
@@ -81,9 +82,9 @@ PHP_FUNCTION(MongoDB_Monitoring_addSubscriber)
8182
}
8283
/* }}} */
8384

84-
/* {{{ proto void MongoDB\Monitoring::removeSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
85+
/* {{{ proto void MongoDB\Driver\Monitoring\removeSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
8586
Removes a monitoring subscriber from the set of subscribers */
86-
PHP_FUNCTION(MongoDB_Monitoring_removeSubscriber)
87+
PHP_FUNCTION(MongoDB_Driver_Monitoring_removeSubscriber)
8788
{
8889
zval *zSubscriber = NULL;
8990
char *hash;
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2017 MongoDB, Inc.
2+
* Copyright 2016-2017 MongoDB, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef PHONGO_MONITORING_H
18-
#define PHONGO_MONITORING_H
17+
#ifndef PHONGO_MONITORING_FUNCTIONS_H
18+
#define PHONGO_MONITORING_FUNCTIONS_H
1919

2020
#include <php.h>
2121

22-
PHP_FUNCTION(MongoDB_Monitoring_addSubscriber);
23-
PHP_FUNCTION(MongoDB_Monitoring_removeSubscriber);
22+
PHP_FUNCTION(MongoDB_Driver_Monitoring_addSubscriber);
23+
PHP_FUNCTION(MongoDB_Driver_Monitoring_removeSubscriber);
2424

25-
#endif /* PHONGO_BSON_H */
25+
#endif /* PHONGO_MONITORING_FUNCTIONS_H */
2626

2727

2828
/*
@@ -33,4 +33,3 @@ PHP_FUNCTION(MongoDB_Monitoring_removeSubscriber);
3333
* vim600: noet sw=4 ts=4 fdm=marker
3434
* vim<600: noet sw=4 ts=4
3535
*/
36-

0 commit comments

Comments
 (0)