Skip to content

Commit f4cea43

Browse files
committed
PHPC-936: Define PHP_MONGODB_VERSION and STABILITY constants
This removes the redundant MONGODB_VERSION constant renames the existing version and stability constants to be consistent with the format in PHP's extension skeleton: php/php-src@dcfd753
1 parent 35954e1 commit f4cea43

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

Diff for: CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ Update the version and stability constants in `php_phongo.h`. This should entail
165165
removing the version's "-dev" suffix and changing the stability to "stable":
166166

167167
```
168-
#define MONGODB_VERSION_S "1.1.8-dev"
169-
#define MONGODB_STABILITY_S "devel"
168+
#define PHP_MONGODB_VERSION "1.1.8-dev"
169+
#define PHP_MONGODB_STABILITY "devel"
170170
```
171171

172172
The above would be changed to:
173173

174174
```
175-
#define MONGODB_VERSION_S "1.1.8"
176-
#define MONGODB_STABILITY_S "stable"
175+
#define PHP_MONGODB_VERSION "1.1.8"
176+
#define PHP_MONGODB_STABILITY "stable"
177177
```
178178

179179
The Makefile targets for creating the PECL package depend on these constants, so
@@ -219,15 +219,15 @@ After tagging, the version and stability constants in `php_phongo.h` should be
219219
updated back to development status.
220220

221221
```
222-
#define MONGODB_VERSION_S "1.1.8"
223-
#define MONGODB_STABILITY_S "stable"
222+
#define PHP_MONGODB_VERSION "1.1.8"
223+
#define PHP_MONGODB_STABILITY "stable"
224224
```
225225

226226
The above would be changed to:
227227

228228
```
229-
#define MONGODB_VERSION_S "1.1.9-dev"
230-
#define MONGODB_STABILITY_S "devel"
229+
#define PHP_MONGODB_VERSION "1.1.9-dev"
230+
#define PHP_MONGODB_STABILITY "devel"
231231
```
232232

233233
Commit this change:

Diff for: php_phongo.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1496,8 +1496,8 @@ static mongoc_client_t *php_phongo_make_mongo_client(const mongoc_uri_t *uri, mo
14961496
#endif
14971497

14981498
MONGOC_DEBUG("Creating Manager, phongo-%s[%s] - mongoc-%s(%s), libbson-%s(%s), php-%s",
1499-
MONGODB_VERSION_S,
1500-
MONGODB_STABILITY_S,
1499+
PHP_MONGODB_VERSION,
1500+
PHP_MONGODB_STABILITY,
15011501
MONGOC_VERSION_S,
15021502
mongoc_version,
15031503
BSON_VERSION_S,
@@ -1929,7 +1929,7 @@ PHP_MINIT_FUNCTION(mongodb)
19291929
/* Set handshake options */
19301930
php_version_string = malloc(4 + sizeof(PHP_VERSION) + 1);
19311931
snprintf(php_version_string, 4 + sizeof(PHP_VERSION) + 1, "PHP %s", PHP_VERSION);
1932-
mongoc_handshake_data_append("ext-mongodb:PHP", MONGODB_VERSION_S, php_version_string);
1932+
mongoc_handshake_data_append("ext-mongodb:PHP", PHP_MONGODB_VERSION, php_version_string);
19331933
free(php_version_string);
19341934

19351935
/* Initialize libbson */
@@ -2008,8 +2008,8 @@ PHP_MINIT_FUNCTION(mongodb)
20082008
PHP_MINIT(ExecutionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);
20092009
PHP_MINIT(ConnectionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);
20102010

2011-
REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)MONGODB_VERSION_S, CONST_CS | CONST_PERSISTENT);
2012-
REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)MONGODB_STABILITY_S, CONST_CS | CONST_PERSISTENT);
2011+
REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)PHP_MONGODB_VERSION, CONST_CS | CONST_PERSISTENT);
2012+
REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)PHP_MONGODB_STABILITY, CONST_CS | CONST_PERSISTENT);
20132013

20142014
return SUCCESS;
20152015
}
@@ -2050,8 +2050,8 @@ PHP_MINFO_FUNCTION(mongodb)
20502050
{
20512051
php_info_print_table_start();
20522052
php_info_print_table_header(2, "MongoDB support", "enabled");
2053-
php_info_print_table_row(2, "MongoDB extension version", MONGODB_VERSION_S);
2054-
php_info_print_table_row(2, "MongoDB extension stability", MONGODB_STABILITY_S);
2053+
php_info_print_table_row(2, "MongoDB extension version", PHP_MONGODB_VERSION);
2054+
php_info_print_table_row(2, "MongoDB extension stability", PHP_MONGODB_STABILITY);
20552055

20562056
#ifdef HAVE_SYSTEM_LIBBSON
20572057
php_info_print_table_row(2, "libbson headers version", BSON_VERSION_S);
@@ -2167,7 +2167,7 @@ zend_module_entry mongodb_module_entry = {
21672167
NULL /* PHP_RINIT(mongodb)*/,
21682168
NULL /* PHP_RSHUTDOWN(mongodb)*/,
21692169
PHP_MINFO(mongodb),
2170-
MONGODB_VERSION,
2170+
PHP_MONGODB_VERSION,
21712171
PHP_MODULE_GLOBALS(mongodb),
21722172
PHP_GINIT(mongodb),
21732173
PHP_GSHUTDOWN(mongodb),

Diff for: php_phongo.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
extern zend_module_entry mongodb_module_entry;
2626

2727
/* FIXME: Its annoying to bump version. Move into phongo_version.h.in */
28-
#define MONGODB_VERSION_S "1.2.8-dev"
29-
#define MONGODB_STABILITY_S "devel"
30-
#define MONGODB_VERSION MONGODB_VERSION_S
28+
#define PHP_MONGODB_VERSION "1.2.8-dev"
29+
#define PHP_MONGODB_STABILITY "devel"
3130

3231
#ifdef PHP_WIN32
3332
# define PHONGO_API __declspec(dllexport)

0 commit comments

Comments
 (0)