@@ -47,26 +47,22 @@ PHONGO_API zend_class_entry *php_phongo_writeconcern_ce;
47
47
48
48
zend_object_handlers php_phongo_handler_writeconcern ;
49
49
50
- /* {{{ proto MongoDB\Driver\WriteConcern WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal[, boolean $fsync] ]])
50
+ /* {{{ proto MongoDB\Driver\WriteConcern WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal]])
51
51
Constructs a new WriteConcern */
52
52
PHP_METHOD (WriteConcern , __construct )
53
53
{
54
54
php_phongo_writeconcern_t * intern ;
55
55
zend_error_handling error_handling ;
56
- zval * w ;
56
+ zval * w , * journal ;
57
57
long wtimeout = 0 ;
58
- zend_bool journal = 0 ;
59
- zend_bool journal_is_null = 0 ;
60
- zend_bool fsync = 0 ;
61
- zend_bool fsync_is_null = 0 ;
62
58
63
59
(void )return_value ; (void )return_value_ptr ; (void )return_value_used ;
64
60
65
61
66
62
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
67
63
intern = (php_phongo_writeconcern_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
68
64
69
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z|lb!b! " , & w , & wtimeout , & journal , & journal_is_null , & fsync , & fsync_is_null ) == FAILURE ) {
65
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z|lz " , & w , & wtimeout , & journal ) == FAILURE ) {
70
66
zend_restore_error_handling (& error_handling TSRMLS_CC );
71
67
return ;
72
68
}
@@ -93,14 +89,9 @@ PHP_METHOD(WriteConcern, __construct)
93
89
}
94
90
95
91
switch (ZEND_NUM_ARGS ()) {
96
- case 4 :
97
- if (!fsync_is_null ) {
98
- mongoc_write_concern_set_fsync (intern -> write_concern , fsync );
99
- }
100
- /* fallthrough */
101
92
case 3 :
102
- if (! journal_is_null ) {
103
- mongoc_write_concern_set_journal (intern -> write_concern , journal );
93
+ if (Z_TYPE_P ( journal ) != IS_NULL ) {
94
+ mongoc_write_concern_set_journal (intern -> write_concern , Z_BVAL_P ( journal ) );
104
95
}
105
96
/* fallthrough */
106
97
case 2 :
@@ -184,37 +175,15 @@ PHP_METHOD(WriteConcern, getJournal)
184
175
}
185
176
/* }}} */
186
177
187
- /* {{{ proto null|boolean WriteConcern::getFsync()
188
- Returns the WriteConcern "fsync" option */
189
- PHP_METHOD (WriteConcern , getFsync )
190
- {
191
- php_phongo_writeconcern_t * intern ;
192
- (void )return_value_ptr ; (void )return_value_used ;
193
-
194
- intern = (php_phongo_writeconcern_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
195
-
196
- if (zend_parse_parameters_none () == FAILURE ) {
197
- return ;
198
- }
199
-
200
- if (intern -> write_concern -> fsync_ != MONGOC_WRITE_CONCERN_FSYNC_DEFAULT ) {
201
- RETURN_BOOL (mongoc_write_concern_get_fsync (intern -> write_concern ));
202
- }
203
-
204
- RETURN_NULL ();
205
- }
206
- /* }}} */
207
-
208
178
/**
209
179
* Value object for write concern used in issuing write operations.
210
180
*/
211
181
/* {{{ MongoDB\Driver\WriteConcern */
212
182
213
183
ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern___construct , 0 , 0 , 1 )
214
- ZEND_ARG_INFO (0 , wstring )
184
+ ZEND_ARG_INFO (0 , w )
215
185
ZEND_ARG_INFO (0 , wtimeout )
216
186
ZEND_ARG_INFO (0 , journal )
217
- ZEND_ARG_INFO (0 , fsync )
218
187
ZEND_END_ARG_INFO ();
219
188
220
189
ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getW , 0 , 0 , 0 )
@@ -226,15 +195,11 @@ ZEND_END_ARG_INFO();
226
195
ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getJournal , 0 , 0 , 0 )
227
196
ZEND_END_ARG_INFO ();
228
197
229
- ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getFsync , 0 , 0 , 0 )
230
- ZEND_END_ARG_INFO ();
231
-
232
198
static zend_function_entry php_phongo_writeconcern_me [] = {
233
199
PHP_ME (WriteConcern , __construct , ai_WriteConcern___construct , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
234
200
PHP_ME (WriteConcern , getW , ai_WriteConcern_getW , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
235
201
PHP_ME (WriteConcern , getWtimeout , ai_WriteConcern_getWtimeout , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
236
202
PHP_ME (WriteConcern , getJournal , ai_WriteConcern_getJournal , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
237
- PHP_ME (WriteConcern , getFsync , ai_WriteConcern_getFsync , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
238
203
PHP_FE_END
239
204
};
240
205
0 commit comments