PluginProbe
Code Profiler – WordPress Performance Profiling and Debugging Made Easy / 1.9.6
Code Profiler – WordPress Performance Profiling and Debugging Made Easy v1.9.6
1.9.6 1.9.5 1.9.4 1.9.3 trunk 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 All 41 releases
← All changes | lib/class-troubleshooter.php +86 -5 1.6.61.9.6 View file →
@@ -6,10 +6,10 @@
6 6 | | | / _ \ / _` |/ _ \ | |_) | '__/ _ \| |_| | |/ _ \ '__| |
7 7 | | |__| (_) | (_| | __/ | __/| | | (_) | _| | | __/ | |
8 8 | \____\___/ \__,_|\___| |_| |_| \___/|_| |_|_|\___|_| |
9 9 | |
10 - | (c) Jerome Bruandet ~ https://code-profiler.com/ |
11 - +=====================================================================+
10 + | (c) Jerome Bruandet ~ https://nintechnet.com/codeprofiler/ |
11 + +=====================================================================+ 2024-08-14
12 12 */
13 13
14 14 if (! defined('ABSPATH') ) {
15 15 die('Forbidden');
@@ -29,13 +29,15 @@
29 29 */
30 30 public function __construct() {
31 31
32 32 $this->get_system_info('sysinfo');
33 + $this->test_admin_ajax('admin-ajax');
33 34 $this->cp_info('code-profiler');
34 35 $this->function_exists('code-profiler');
35 36 $this->check_wpdb('wpdb');
36 37 $this->check_cache('cache');
37 38 $this->check_proxy('proxy');
39 + $this->is_multisite('multisite');
38 40 $this->get_all_plugins('plugins');
39 41 $this->get_theme('themes');
40 42 $this->get_cp_config();
41 43
@@ -55,8 +57,14 @@
55 57 private function get_system_info( $key ) {
56 58
57 59 $this->buffer[ $key ]['OS'] = php_uname();
58 60
61 + if (! empty( $_SERVER['SERVER_NAME'] ) ) {
62 + $this->buffer[ $key ]['SERVER_NAME'] = $_SERVER['SERVER_NAME'];
63 + } else {
64 + $this->buffer[ $key ]['SERVER_NAME'] = 'N/A';
65 + }
66 +
59 67 if (! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
60 68 $this->buffer[ $key ]['HTTP server'] = $_SERVER['SERVER_SOFTWARE'];
61 69 } else {
62 70 $this->buffer[ $key ]['HTTP server'] = 'N/A';
@@ -84,9 +92,9 @@
84 92 if (! empty( $tmp ) ) {
85 93 if ( is_writable( $tmp ) ) {
86 94 $tmp .= ' (writable)';
87 95 } else {
88 - $tmp .= ' (not writable!)';
96 + $tmp .= ' (not writable!)' .' ⚠️';
89 97 }
90 98 }
91 99 $tmp = $this->shorten_path( $tmp );
92 100 $this->buffer[ $key ]['Temp directory'] = $tmp;
@@ -132,10 +140,40 @@
132 140 $wp_debug = $this->shorten_path( $wp_debug ) ." (". number_format( $filesize ) ." bytes)";
133 141 }
134 142 $this->buffer[ $key ]['WordPress']['WP_DEBUG_LOG'] = $wp_debug;
135 143
144 + /**
145 + * WPMU plugins directory.
146 + */
147 + $this->buffer[ $key ]['WordPress']['WPMU_PLUGIN_DIR']['DIR'] =
148 + $this->shorten_path( WPMU_PLUGIN_DIR );
149 + $this->buffer[ $key ]['WordPress']['WPMU_PLUGIN_DIR']['writable'] =
150 + is_writable( WPMU_PLUGIN_DIR );
151 +
152 + /**
153 + * SAVEQUERIES: make sure it is not set to false.
154 + */
155 + if ( defined('SAVEQUERIES') ) {
156 + if ( SAVEQUERIES === false ) {
157 + $this->buffer[ $key ]['WordPress']['SAVEQUERIES'] = 'FALSE' .' ⚠️';
158 + } else {
159 + $this->buffer[ $key ]['WordPress']['SAVEQUERIES'] = SAVEQUERIES;
160 + }
161 + } else {
162 + $this->buffer[ $key ]['WordPress']['SAVEQUERIES'] = 'N/A';
163 + }
164 +
165 + /**
166 + * xdebug.
167 + */
168 + if ( extension_loaded('xdebug') ) {
169 + $this->buffer[ $key ]['Xdebug'] = esc_html__('Extension is loaded', 'code-profiler') .' ⚠️';
170 + } else {
171 + $this->buffer[ $key ]['Xdebug'] = '0';
172 + }
136 173 }
137 174
175 +
138 176 /**
139 177 * Verify if some important PHP functions are available.
140 178 */
141 179 private function function_exists( $key ) {
@@ -241,8 +279,23 @@
241 279 }
242 280
243 281
244 282 /**
283 + * Check if that is a multisite installation.
284 + */
285 + private function is_multisite( $key ) {
286 +
287 + if ( is_multisite() ) {
288 + global $current_blog;
289 + $this->buffer[ $key ] = "site: {$current_blog->site_id}, blog: {$current_blog->blog_id}";
290 + return;
291 + }
292 +
293 + $this->buffer[ $key ] = 0;
294 + }
295 +
296 +
297 + /**
245 298 * Retrieve the list of all plugins and sort them
246 299 * (active or disabled).
247 300 */
248 301 private function get_all_plugins( $key ) {
@@ -322,9 +375,8 @@
322 375 $cp_options = get_option('code-profiler');
323 376
324 377 $list = [
325 378 'hide_empty_value',
326 - 'warn_composer',
327 379 'enable_wpcli',
328 380 'disable_wpcron',
329 381 // 'disable_db-php',
330 382 'http_response',
@@ -329,9 +381,10 @@
329 381 // 'disable_db-php',
330 382 'http_response',
331 383 // 'backtrace_limit',
332 384 'accuracy',
333 - 'buffer'
385 + 'buffer',
386 + 'exclusions'
334 387 ];
335 388 foreach( $list as $element ) {
336 389 $this->buffer['options'][ $element ] = isset( $cp_options[ $element ] )? $cp_options[ $element ]:0;
337 390 }
@@ -342,8 +395,36 @@
342 395 */
343 396 private function shorten_path( $path ) {
344 397
345 398 return str_replace( ABSPATH, '', $path );
399 + }
400 +
401 +
402 + /**
403 + * Test if admin-ajax is accessible.
404 + */
405 + private function test_admin_ajax( $key ) {
406 +
407 + $headers = [
408 + // Devs must be allowed to use it on localhost over TLS too
409 + 'sslverify' => apply_filters('https_local_ssl_verify', false )
410 + ];
411 + $res = wp_safe_remote_get( admin_url('admin-ajax.php?action=generate-password'), $headers );
412 +
413 + /* Translators: Error message */
414 + $error = __('Error: %s', 'code-profiler');
415 +
416 + // Connection error
417 + if ( is_wp_error( $res ) ) {
418 + $msg = sprintf( $error, $res->get_error_message() );
419 +
420 + } elseif ( $res['response']['code'] != 200 ) {
421 + $msg = sprintf( $error, $res['response']['code'] ." ". $res['response']['message'] );
422 +
423 + } else {
424 + $msg = "OK";
425 + }
426 + $this->buffer[ $key ]['access'] = $msg;
346 427 }
347 428
348 429 }
349 430