| @@ -17,10 +17,8 @@ | ||
| 17 | 17 | |
| 18 | 18 | // ===================================================================== |
| 19 | 19 | // Display the profiler's log. |
| 20 | 20 | |
| 21 | -require __DIR__.'/class-logs.php'; | |
| 22 | - | |
| 23 | 21 | // Delete the log? |
| 24 | 22 | if (! empty( $_POST['cp-delete-log'] ) ) { |
| 25 | 23 | if ( empty( $_POST['cp_nonce'] ) || ! wp_verify_nonce( $_POST['cp_nonce'], 'cp_delete_log') ) { |
| 26 | 24 | printf( |
| @@ -147,19 +145,21 @@ | ||
| 147 | 145 | <table class="form-table"> |
| 148 | 146 | <tr> |
| 149 | 147 | <td width="100%"> |
| 150 | 148 | <textarea dir="auto" name="cptxtlog" class="large-text code" style="height:<?php echo $th; ?>px;" wrap="off" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"><?php |
| 149 | + | |
| 151 | 150 | /** |
| 152 | - * Display the last HTTP response log. | |
| 151 | + * Search for an eventual "last_request.1727412303.5681.log" file. | |
| 153 | 152 | */ |
| 154 | - $log = CodeProfiler_Logs::get_HTTP_log(); | |
| 155 | - if ( $log === false ) { | |
| 153 | + $file = code_profiler_glob( CODE_PROFILER_UPLOAD_DIR, '^last_request\.\d+?\.\d+?\.log$', true ); | |
| 154 | + if ( empty( $file[0] ) ) { | |
| 156 | 155 | echo "\n\n > " . esc_html__('The HTTP response log is empty.', 'code-profiler'); |
| 157 | 156 | } else { |
| 157 | + $log = file_get_contents( $file[0] ); | |
| 158 | 158 | echo esc_textarea( $log ); |
| 159 | 159 | } |
| 160 | 160 | ?></textarea> |
| 161 | - <p class="description"><?php esc_html_e('The log shows the HTTP request and its payload, the response headers and body for the last profile.', 'code-profiler') ?></p> | |
| 161 | + <p class="description"><?php esc_html_e('The log shows the HTTP response headers and body for the last profile.', 'code-profiler') ?></p> | |
| 162 | 162 | </td> |
| 163 | 163 | </tr> |
| 164 | 164 | </table> |
| 165 | 165 | <?php |