Skip to content

PHPC-936: Define PHP_MONGODB_VERSION and STABILITY constants #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ Update the version and stability constants in `php_phongo.h`. This should entail
removing the version's "-dev" suffix and changing the stability to "stable":

```
#define MONGODB_VERSION_S "1.1.8-dev"
#define MONGODB_STABILITY_S "devel"
#define PHP_MONGODB_VERSION "1.1.8-dev"
#define PHP_MONGODB_STABILITY "devel"
```

The above would be changed to:

```
#define MONGODB_VERSION_S "1.1.8"
#define MONGODB_STABILITY_S "stable"
#define PHP_MONGODB_VERSION "1.1.8"
#define PHP_MONGODB_STABILITY "stable"
```

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

```
#define MONGODB_VERSION_S "1.1.8"
#define MONGODB_STABILITY_S "stable"
#define PHP_MONGODB_VERSION "1.1.8"
#define PHP_MONGODB_STABILITY "stable"
```

The above would be changed to:

```
#define MONGODB_VERSION_S "1.1.9-dev"
#define MONGODB_STABILITY_S "devel"
#define PHP_MONGODB_VERSION "1.1.9-dev"
#define PHP_MONGODB_STABILITY "devel"
```

Commit this change:
Expand Down
16 changes: 8 additions & 8 deletions php_phongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,8 @@ static mongoc_client_t *php_phongo_make_mongo_client(const mongoc_uri_t *uri, mo
#endif

MONGOC_DEBUG("Creating Manager, phongo-%s[%s] - mongoc-%s(%s), libbson-%s(%s), php-%s",
MONGODB_VERSION_S,
MONGODB_STABILITY_S,
PHP_MONGODB_VERSION,
PHP_MONGODB_STABILITY,
MONGOC_VERSION_S,
mongoc_version,
BSON_VERSION_S,
Expand Down Expand Up @@ -1929,7 +1929,7 @@ PHP_MINIT_FUNCTION(mongodb)
/* Set handshake options */
php_version_string = malloc(4 + sizeof(PHP_VERSION) + 1);
snprintf(php_version_string, 4 + sizeof(PHP_VERSION) + 1, "PHP %s", PHP_VERSION);
mongoc_handshake_data_append("ext-mongodb:PHP", MONGODB_VERSION_S, php_version_string);
mongoc_handshake_data_append("ext-mongodb:PHP", PHP_MONGODB_VERSION, php_version_string);
free(php_version_string);

/* Initialize libbson */
Expand Down Expand Up @@ -2008,8 +2008,8 @@ PHP_MINIT_FUNCTION(mongodb)
PHP_MINIT(ExecutionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ConnectionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);

REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)MONGODB_VERSION_S, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)MONGODB_STABILITY_S, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)PHP_MONGODB_VERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)PHP_MONGODB_STABILITY, CONST_CS | CONST_PERSISTENT);

return SUCCESS;
}
Expand Down Expand Up @@ -2050,8 +2050,8 @@ PHP_MINFO_FUNCTION(mongodb)
{
php_info_print_table_start();
php_info_print_table_header(2, "MongoDB support", "enabled");
php_info_print_table_row(2, "MongoDB extension version", MONGODB_VERSION_S);
php_info_print_table_row(2, "MongoDB extension stability", MONGODB_STABILITY_S);
php_info_print_table_row(2, "MongoDB extension version", PHP_MONGODB_VERSION);
php_info_print_table_row(2, "MongoDB extension stability", PHP_MONGODB_STABILITY);

#ifdef HAVE_SYSTEM_LIBBSON
php_info_print_table_row(2, "libbson headers version", BSON_VERSION_S);
Expand Down Expand Up @@ -2167,7 +2167,7 @@ zend_module_entry mongodb_module_entry = {
NULL /* PHP_RINIT(mongodb)*/,
NULL /* PHP_RSHUTDOWN(mongodb)*/,
PHP_MINFO(mongodb),
MONGODB_VERSION,
PHP_MONGODB_VERSION,
PHP_MODULE_GLOBALS(mongodb),
PHP_GINIT(mongodb),
PHP_GSHUTDOWN(mongodb),
Expand Down
5 changes: 2 additions & 3 deletions php_phongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
extern zend_module_entry mongodb_module_entry;

/* FIXME: Its annoying to bump version. Move into phongo_version.h.in */
#define MONGODB_VERSION_S "1.2.8-dev"
#define MONGODB_STABILITY_S "devel"
#define MONGODB_VERSION MONGODB_VERSION_S
#define PHP_MONGODB_VERSION "1.2.8-dev"
#define PHP_MONGODB_STABILITY "devel"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguments of the extension skeleton aside, these names are also more consistent with the MONGODB_VERSION and MONGODB_STABILITY constants we define for userland.

As for MONGODB_VERSION, I found no references to it apart from zend_module_entry. This seemed ripe for removal after updated the struct to use PHP_MONGODB_VERSION.


#ifdef PHP_WIN32
# define PHONGO_API __declspec(dllexport)
Expand Down