| @@ -28,9 +28,8 @@ | ||
| 28 | 28 | private $tmp_summary; |
| 29 | 29 | private $tmp_diskio; |
| 30 | 30 | private $tmp_calls; |
| 31 | 31 | private $tmp_connections; |
| 32 | - private $tmp_rerun; | |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | 34 | * Initialize |
| 36 | 35 | */ |
| @@ -47,10 +46,8 @@ | ||
| 47 | 46 | $this->tmp_diskio = CODE_PROFILER_UPLOAD_DIR ."/$microtime." . |
| 48 | 47 | CODE_PROFILER_TMP_DISKIO_LOG; |
| 49 | 48 | $this->tmp_connections = CODE_PROFILER_UPLOAD_DIR ."/$microtime." . |
| 50 | 49 | CODE_PROFILER_TMP_CONNECTIONS_LOG; |
| 51 | - $this->tmp_rerun = CODE_PROFILER_UPLOAD_DIR ."/$microtime." . | |
| 52 | - CODE_PROFILER_TMP_RERUN_LOG; | |
| 53 | 50 | |
| 54 | 51 | if ( function_exists('hrtime') ) { |
| 55 | 52 | // PHP >=7.3 |
| 56 | 53 | self::$metrics = 'hrtime'; |
| @@ -77,10 +74,9 @@ | ||
| 77 | 74 | }, 1000 ); |
| 78 | 75 | |
| 79 | 76 | code_profiler_log_debug( |
| 80 | 77 | sprintf( |
| 81 | - // We cannot load translation here. | |
| 82 | - 'Setting theme to %s', | |
| 78 | + esc_html__('Setting theme to %s', 'code-profiler'), | |
| 83 | 79 | CODE_PROFILER_STYLESHEET |
| 84 | 80 | ) |
| 85 | 81 | ); |
| 86 | 82 | } else { |
| @@ -85,10 +81,9 @@ | ||
| 85 | 81 | ); |
| 86 | 82 | } else { |
| 87 | 83 | code_profiler_log_error( |
| 88 | 84 | sprintf( |
| 89 | - // We cannot load translation here. | |
| 90 | - 'Unable to switch theme, %s not found', | |
| 85 | + esc_html__('Unable to switch theme, %s not found', 'code-profiler'), | |
| 91 | 86 | CODE_PROFILER_STYLESHEET |
| 92 | 87 | ) |
| 93 | 88 | ); |
| 94 | 89 | } |
| @@ -112,10 +107,9 @@ | ||
| 112 | 107 | self::$buffer = $cp_options['buffer'] * 1000000; |
| 113 | 108 | } |
| 114 | 109 | code_profiler_log_debug( |
| 115 | 110 | sprintf( |
| 116 | - // We cannot load translation here. | |
| 117 | - 'Setting size of memory buffer to %sMB', | |
| 111 | + esc_html__('Setting size of memory buffer to %sMB', 'code-profiler'), | |
| 118 | 112 | self::$buffer / 1000000 |
| 119 | 113 | ) |
| 120 | 114 | ); |
| 121 | 115 | |
| @@ -127,10 +121,9 @@ | ||
| 127 | 121 | add_filter('pre_http_request', [ $this, 'pre_http_request'], 10000, 3 ); |
| 128 | 122 | add_action('http_api_debug', [ $this, 'http_api_debug'], 10000, 5 ); |
| 129 | 123 | register_shutdown_function( [ $this, 'code_profiler_shutdown'] ); |
| 130 | 124 | code_profiler_log_debug( |
| 131 | - // We cannot load translation here. | |
| 132 | - 'Starting profiler' | |
| 125 | + esc_html__('Starting profiler', 'code-profiler') | |
| 133 | 126 | ); |
| 134 | 127 | require 'class-stream.php'; |
| 135 | 128 | |
| 136 | 129 | // Clear the temporary log because the buffer will be appended to it |
| @@ -151,14 +144,8 @@ | ||
| 151 | 144 | CodeProfiler_Stream::stop(); |
| 152 | 145 | |
| 153 | 146 | fclose( self::$fh ); |
| 154 | 147 | |
| 155 | - // Summary file (metadata) | |
| 156 | - $summary = []; | |
| 157 | - if ( is_file( $this->tmp_rerun ) ) { | |
| 158 | - $summary['rerun'] = json_decode( file_get_contents( $this->tmp_rerun ), true ); | |
| 159 | - unlink( $this->tmp_rerun ); | |
| 160 | - } | |
| 161 | 148 | $summary['memory'] = memory_get_peak_usage(); |
| 162 | 149 | $summary['queries'] = get_num_queries() - 2; |
| 163 | 150 | $summary['precision'] = CODE_PROFILER_TICKS; |
| 164 | 151 | file_put_contents( $this->tmp_summary, json_encode( $summary ) ); |