| @@ -86,8 +86,9 @@ | ||
| 86 | 86 | $args = array( |
| 87 | 87 | 'post_type' => 'booktics-ex-service', |
| 88 | 88 | 'post_status' => array( 'publish', 'active', 'pending' ), |
| 89 | 89 | 'posts_per_page' => -1, |
| 90 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering services by meta fields | |
| 90 | 91 | 'meta_query' => array( |
| 91 | 92 | array( |
| 92 | 93 | 'key' => 'connected_services', |
| 93 | 94 | 'value' => "i:{$service_id}", |
| @@ -102,9 +103,11 @@ | ||
| 102 | 103 | foreach ( $extra_service_post_ids as $post_id ) { |
| 103 | 104 | try { |
| 104 | 105 | $extra_service_model = new Extra_Service_Model( $post_id ); |
| 105 | 106 | if ( ! $extra_service_model ) { |
| 106 | - error_log( "Failed to instantiate Extra_Service_Model for post_id: $post_id" ); | |
| 107 | + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 108 | + error_log( "Failed to instantiate Extra_Service_Model for post_id: $post_id" ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 109 | + } | |
| 107 | 110 | continue; |
| 108 | 111 | } |
| 109 | 112 | |
| 110 | 113 | $extra_service_array = $extra_service_model->to_array(); |
| @@ -122,16 +125,22 @@ | ||
| 122 | 125 | |
| 123 | 126 | $extra_service_array['connected_services'] = $connected_services; |
| 124 | 127 | $result = $extra_service_model->update( $extra_service_array ); |
| 125 | 128 | if ( is_wp_error( $result ) ) { |
| 126 | - error_log( 'Failed to update Extra_Service_Model during cleanup: ' . $result->get_error_message() ); | |
| 129 | + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 130 | + error_log( 'Failed to update Extra_Service_Model during cleanup: ' . $result->get_error_message() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 131 | + } | |
| 127 | 132 | } |
| 128 | 133 | } |
| 129 | 134 | } catch ( \Throwable $e ) { |
| 130 | - error_log( 'Exception in cleanup_connected_extra_services: ' . $e->getMessage() ); | |
| 135 | + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 136 | + error_log( 'Exception in cleanup_connected_extra_services: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 137 | + } | |
| 131 | 138 | } |
| 132 | 139 | } |
| 133 | 140 | } catch ( \Throwable $e ) { |
| 134 | - error_log( 'Exception in cleanup_connected_extra_services: ' . $e->getMessage() ); | |
| 141 | + if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 142 | + error_log( 'Exception in cleanup_connected_extra_services: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 143 | + } | |
| 135 | 144 | } |
| 136 | 145 | } |
| 137 | 146 | } |