@@ -48,7 +48,7 @@ ZEND_EXTERN_MODULE_GLOBALS(mongo)
48
48
49
49
zend_class_entry * mongo_ce_Collection = NULL ;
50
50
51
- static int is_gle_op (zval * coll , zval * options , mongo_server_options * server_options TSRMLS_DC );
51
+ static int is_gle_op (zval * coll , zval * options , mongo_server_options * server_options , int silent TSRMLS_DC );
52
52
static void do_gle_op (mongo_con_manager * manager , mongo_connection * connection , zval * cursor_z , mongo_buffer * buf , zval * return_value TSRMLS_DC );
53
53
static zval * append_getlasterror (zval * coll , mongo_buffer * buf , zval * options , mongo_connection * connection TSRMLS_DC );
54
54
static char * to_index_string (zval * zkeys , int * key_len TSRMLS_DC );
@@ -609,7 +609,7 @@ static int send_message(zval *this_ptr, mongo_connection *connection, mongo_buff
609
609
return 0 ;
610
610
}
611
611
612
- if (is_gle_op (this_ptr , options , & link -> servers -> options TSRMLS_CC )) {
612
+ if (is_gle_op (this_ptr , options , & link -> servers -> options , NOISY TSRMLS_CC )) {
613
613
zval * cursor = append_getlasterror (this_ptr , buf , options , connection TSRMLS_CC );
614
614
if (cursor ) {
615
615
do_gle_op (link -> manager , connection , cursor , buf , return_value TSRMLS_CC );
@@ -632,7 +632,7 @@ static int send_message(zval *this_ptr, mongo_connection *connection, mongo_buff
632
632
* on whether a write concern ("w" or "safe") or fsync/journal options are
633
633
* specified.
634
634
*/
635
- static int is_gle_op (zval * coll , zval * options , mongo_server_options * server_options TSRMLS_DC )
635
+ static int is_gle_op (zval * coll , zval * options , mongo_server_options * server_options , int silent TSRMLS_DC )
636
636
{
637
637
int gle_op = 0 , default_fsync , default_journal , coll_w = 0 ;
638
638
zval * z_coll_w ;
@@ -674,10 +674,14 @@ static int is_gle_op(zval *coll, zval *options, mongo_server_options *server_opt
674
674
}
675
675
break ;
676
676
default :
677
- php_error_docref (NULL TSRMLS_CC , E_WARNING , "The value of the 'w' option either needs to be a integer or string" );
677
+ if (silent == NOISY ) {
678
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "The value of the 'w' option either needs to be a integer or string" );
679
+ }
678
680
}
679
681
} else if (zend_hash_find (HASH_P (options ), "safe" , strlen ("safe" ) + 1 , (void * * ) & gle_pp ) == SUCCESS ) {
680
- php_error_docref (NULL TSRMLS_CC , E_DEPRECATED , "The 'safe' option is deprecated, please use 'w' instead" );
682
+ if (silent == NOISY ) {
683
+ php_error_docref (NULL TSRMLS_CC , E_DEPRECATED , "The 'safe' option is deprecated, please use 'w' instead" );
684
+ }
681
685
682
686
switch (Z_TYPE_PP (gle_pp )) {
683
687
case IS_STRING :
@@ -691,7 +695,9 @@ static int is_gle_op(zval *coll, zval *options, mongo_server_options *server_opt
691
695
}
692
696
break ;
693
697
default :
694
- php_error_docref (NULL TSRMLS_CC , E_WARNING , "The value of the 'safe' option either needs to be a boolean or a string" );
698
+ if (silent == NOISY ) {
699
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "The value of the 'safe' option either needs to be a boolean or a string" );
700
+ }
695
701
}
696
702
} else if (coll_w >= 1 ) {
697
703
gle_op = 1 ;
@@ -722,7 +728,9 @@ static int is_gle_op(zval *coll, zval *options, mongo_server_options *server_opt
722
728
gle_op = (coll_w >= 1 || default_fsync == 1 || default_journal == 1 );
723
729
}
724
730
725
- mongo_manager_log (MonGlo (manager ), MLOG_IO , MLOG_FINE , "is_gle_op: %s" , gle_op ? "yes" : "no" );
731
+ if (silent == NOISY ) {
732
+ mongo_manager_log (MonGlo (manager ), MLOG_IO , MLOG_FINE , "is_gle_op: %s" , gle_op ? "yes" : "no" );
733
+ }
726
734
return gle_op ;
727
735
}
728
736
@@ -1135,7 +1143,7 @@ static void php_mongo_collection_insert(zval *z_collection, zval *document, zval
1135
1143
RETURN_FALSE ;
1136
1144
}
1137
1145
1138
- is_acknowledged = is_gle_op (z_collection , z_write_options , & link -> servers -> options TSRMLS_CC );
1146
+ is_acknowledged = is_gle_op (z_collection , z_write_options , & link -> servers -> options , QUIET TSRMLS_CC );
1139
1147
supports_command = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_WRITE_API );
1140
1148
supports_opcode = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_RELEASE_2_4_AND_BEFORE );
1141
1149
@@ -1518,7 +1526,7 @@ static void php_mongocollection_update(zval *this_ptr, mongo_collection *c, zval
1518
1526
RETURN_FALSE ;
1519
1527
}
1520
1528
1521
- is_acknowledged = is_gle_op (this_ptr , z_write_options , & link -> servers -> options TSRMLS_CC );
1529
+ is_acknowledged = is_gle_op (this_ptr , z_write_options , & link -> servers -> options , QUIET TSRMLS_CC );
1522
1530
supports_command = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_WRITE_API );
1523
1531
supports_opcode = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_RELEASE_2_4_AND_BEFORE );
1524
1532
@@ -1637,7 +1645,7 @@ static void php_mongocollection_remove(zval *this_ptr, mongo_collection *c, zval
1637
1645
RETURN_FALSE ;
1638
1646
}
1639
1647
1640
- is_acknowledged = is_gle_op (this_ptr , z_write_options , & link -> servers -> options TSRMLS_CC );
1648
+ is_acknowledged = is_gle_op (this_ptr , z_write_options , & link -> servers -> options , QUIET TSRMLS_CC );
1641
1649
supports_command = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_WRITE_API );
1642
1650
supports_opcode = php_mongo_api_connection_supports_feature (connection , PHP_MONGO_API_RELEASE_2_4_AND_BEFORE );
1643
1651
0 commit comments