Changeset 5131
- Timestamp:
- 03/08/2017 07:31:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php
r5112 r5131 418 418 419 419 while ( '' !== $request_url ) { 420 $this->log( 'fetching more events from: ' . var_export( $request_url, true ) ); 421 420 422 $response = $this->remote_get( $request_url ); 421 423 $body = json_decode( wp_remote_retrieve_body( $response ) ); 422 424 423 $this->log( ' fetching more events');425 $this->log( 'pruned response - ' . print_r( $this->prune_response_for_log( $response ), true ) ); 424 426 425 427 if ( ! empty ( $body->results ) ) { … … 498 500 499 501 while ( '' !== $request_url ) { 500 $this->log( 'fetching more groups ');502 $this->log( 'fetching more groups from: ' . var_export( $request_url, true ) ); 501 503 502 504 $response = $this->remote_get( $request_url ); 503 505 $body = json_decode( wp_remote_retrieve_body( $response ) ); 506 507 $this->log( 'pruned response - ' . print_r( $this->prune_response_for_log( $response ), true ) ); 504 508 505 509 if ( ! empty ( $body->results ) ) { … … 689 693 * To avoid storing too much data, the log is reset during each run, and only $limit rows are stored 690 694 * 695 * @todo Remove this when the stuck cron job bug is fixed 696 * 691 697 * @param string $message 692 698 */ … … 718 724 update_option( 'owpe_log', $this->log, false ); 719 725 } 726 727 /** 728 * Prune an HTTP response so the relevant data can be logged for troubleshooting 729 * 730 * @todo Remove this when the stuck cron job bug is fixed 731 * 732 * @param WP_HTTP_Response $response 733 * 734 * @return array 735 */ 736 protected function prune_response_for_log( $response ) { 737 $pruned_response = (array) $response; 738 739 if ( isset( $pruned_response['body'] ) ) { 740 $pruned_response['original_body_meta'] = sprintf( 741 'type: %s / length: %s', 742 gettype( $pruned_response['body'] ), 743 is_string( $pruned_response['body'] ) ? strlen( $pruned_response['body'] ) : 'not a string' 744 ); 745 $pruned_response['body'] = (array) json_decode( $pruned_response['body'] ); 746 747 if ( isset( $pruned_response['body']['results'] ) ) { 748 $pruned_response['body']['results'] = 'pruned'; 749 } 750 } 751 752 if ( isset( $pruned_response['http_response'] ) ) { 753 unset( $pruned_response['http_response'] ); 754 } 755 756 if ( isset( $pruned_response['cookies'] ) ) { 757 unset( $pruned_response['cookies'] ); 758 } 759 760 if ( isset( $pruned_response['filename'] ) ) { 761 unset( $pruned_response['filename'] ); 762 } 763 764 return $pruned_response; 765 } 720 766 } 721 767
Note: See TracChangeset
for help on using the changeset viewer.