| @@ -37,24 +37,24 @@ | ||
| 37 | 37 | public function sse_message( $data ) { |
| 38 | 38 | // Log the data into debug log file |
| 39 | 39 | $this->debug_log( $data ); |
| 40 | 40 | |
| 41 | - $log = get_transient( 'templately_fsi_log' ) ?: []; | |
| 41 | + $log = get_option( 'templately_fsi_log' ) ?: []; | |
| 42 | 42 | $log[] = $data; |
| 43 | - set_transient( 'templately_fsi_log', $log, 15 * MINUTE_IN_SECONDS ); | |
| 43 | + update_option( 'templately_fsi_log', $log ); | |
| 44 | 44 | |
| 45 | - if(Helper::should_flush()){ | |
| 46 | - echo "event: message\n"; | |
| 47 | - echo 'data: ' . wp_json_encode( $data ) . "\n\n"; | |
| 45 | + // if(Helper::should_flush()){ | |
| 46 | + // echo "event: message\n"; | |
| 47 | + // echo 'data: ' . wp_json_encode( $data ) . "\n\n"; | |
| 48 | 48 | |
| 49 | - // Extra padding. | |
| 50 | - echo esc_html( ':' . str_repeat( ' ', 2048 ) . "\n\n" ); | |
| 49 | + // // Extra padding. | |
| 50 | + // echo esc_html( ':' . str_repeat( ' ', 2048 ) . "\n\n" ); | |
| 51 | 51 | |
| 52 | - flush(); | |
| 53 | - } | |
| 54 | - else if($data['action'] === 'complete' || $data['action'] === 'error'){ | |
| 55 | - wp_send_json( $data ); | |
| 56 | - } | |
| 52 | + // flush(); | |
| 53 | + // } | |
| 54 | + // else if($data['action'] === 'complete' || $data['action'] === 'downloadComplete' || $data['action'] === 'error'){ | |
| 55 | + // wp_send_json( $data ); | |
| 56 | + // } | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Printing Error Logs in debug.log file. |
| @@ -65,10 +65,10 @@ | ||
| 65 | 65 | public function debug_log( $log ){ |
| 66 | 66 | if ( defined('TEMPLATELY_EVENT_LOG') && TEMPLATELY_EVENT_LOG === true ) { |
| 67 | 67 | if ( is_array( $log ) || is_object( $log ) ) { |
| 68 | 68 | error_log( print_r( $log, true ) ); |
| 69 | - } else { | |
| 69 | + } else if($log) { | |
| 70 | 70 | error_log( $log ); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |