Health Check - Version 1.4.1

Version Description

Download this release

Release Info

Developer Clorith
Plugin Icon 128x128 Health Check
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.4.0 to 1.4.1

assets/javascript/health-check.js CHANGED
@@ -256,6 +256,10 @@ jQuery( document ).ready( function( $ ) {
256
  } );
257
 
258
  function AppendIssue( issue ) {
 
 
 
 
259
  const template = wp.template( 'health-check-issue' ),
260
  issueWrapper = $( '#health-check-issues-' + issue.status );
261
 
256
  } );
257
 
258
  function AppendIssue( issue ) {
259
+ if ( typeof issue === 'undefined' || typeof issue.status === 'undefined' ) {
260
+ return;
261
+ }
262
+
263
  const template = wp.template( 'health-check-issue' ),
264
  issueWrapper = $( '#health-check-issues-' + issue.status );
265
 
health-check.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin URI: https://wordpress.org/plugins/health-check/
10
  * Description: Checks the health of your WordPress install.
11
  * Author: The WordPress.org community
12
- * Version: 1.4.0
13
  * Author URI: https://wordpress.org/plugins/health-check/
14
  * Text Domain: health-check
15
  */
@@ -35,7 +35,7 @@ define( 'HEALTH_CHECK_MYSQL_MIN_VERSION', '5.0' );
35
  define( 'HEALTH_CHECK_MYSQL_REC_VERSION', '5.6' );
36
 
37
  // Set the plugin version.
38
- define( 'HEALTH_CHECK_PLUGIN_VERSION', '1.4.0' );
39
 
40
  // Set the plugin file.
41
  define( 'HEALTH_CHECK_PLUGIN_FILE', __FILE__ );
9
  * Plugin URI: https://wordpress.org/plugins/health-check/
10
  * Description: Checks the health of your WordPress install.
11
  * Author: The WordPress.org community
12
+ * Version: 1.4.1
13
  * Author URI: https://wordpress.org/plugins/health-check/
14
  * Text Domain: health-check
15
  */
35
  define( 'HEALTH_CHECK_MYSQL_REC_VERSION', '5.6' );
36
 
37
  // Set the plugin version.
38
+ define( 'HEALTH_CHECK_PLUGIN_VERSION', '1.4.1' );
39
 
40
  // Set the plugin file.
41
  define( 'HEALTH_CHECK_PLUGIN_FILE', __FILE__ );
includes/class-health-check-dashboard-widget.php CHANGED
@@ -20,12 +20,12 @@ class Health_Check_Dashboard_Widget {
20
  }
21
 
22
  function widget_render() {
23
- $issue_counts = get_transient( 'health-check-site-status-result' );
24
 
25
- if ( false !== $issue_counts ) {
26
- $issue_counts = json_decode( $issue_counts );
27
  } else {
28
- $issue_counts = array(
29
  'good' => 0,
30
  'recommended' => 0,
31
  'critical' => 0,
@@ -42,10 +42,30 @@ class Health_Check_Dashboard_Widget {
42
  </svg>
43
  </div>
44
  <div class="site-health-progress-label">
45
- <?php _e( 'Results are still loading&hellip;', 'health-check' ); ?>
 
 
 
 
46
  </div>
47
  </div>
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  <p>
50
  <?php if ( $issue_counts->critical > 0 ) : ?>
51
  <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve the performance or security of your website.', 'health-check' ); ?>
@@ -55,8 +75,9 @@ class Health_Check_Dashboard_Widget {
55
  <?php _e( 'Your site scores pretty well on the Health Check, but there are still some things you can do to improve the performance and security of your website.', 'health-check' ); ?>
56
  <?php endif; ?>
57
  </p>
 
58
 
59
- <?php if ( $issues_total > 0 ) : ?>
60
  <p>
61
  <?php
62
  printf(
20
  }
21
 
22
  function widget_render() {
23
+ $get_issues = get_transient( 'health-check-site-status-result' );
24
 
25
+ if ( false !== $get_issues ) {
26
+ $issue_counts = json_decode( $get_issues );
27
  } else {
28
+ $issue_counts = (object) array(
29
  'good' => 0,
30
  'recommended' => 0,
31
  'critical' => 0,
42
  </svg>
43
  </div>
44
  <div class="site-health-progress-label">
45
+ <?php if ( false === $get_issues ) : ?>
46
+ <?php _e( 'No information yet&hellip;', 'health-check' ); ?>
47
+ <?php else : ?>
48
+ <?php _e( 'Results are still loading&hellip;', 'health-check' ); ?>
49
+ <?php endif; ?>
50
  </div>
51
  </div>
52
 
53
+ <?php if ( false === $get_issues ) : ?>
54
+ <p>
55
+ <?php _e( 'No Site Health information has been gathered yet, you can do so by visiting the Site Health page, alternatively the checks will run automatically once every week.', 'health-check' ); ?>
56
+ </p>
57
+
58
+ <p>
59
+ <?php
60
+ printf(
61
+ // translators: %s: URL for the Site Health page.
62
+ __( '<a href="%s">Visit the Site Health page</a> to gather information on about your site..', 'health-check' ),
63
+ esc_url( admin_url( 'tools.php?page=health-check' ) )
64
+ );
65
+ ?>
66
+ </p>
67
+
68
+ <?php else : ?>
69
  <p>
70
  <?php if ( $issue_counts->critical > 0 ) : ?>
71
  <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve the performance or security of your website.', 'health-check' ); ?>
75
  <?php _e( 'Your site scores pretty well on the Health Check, but there are still some things you can do to improve the performance and security of your website.', 'health-check' ); ?>
76
  <?php endif; ?>
77
  </p>
78
+ <?php endif; ?>
79
 
80
+ <?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
81
  <p>
82
  <?php
83
  printf(
includes/class-health-check-debug-data.php CHANGED
@@ -747,7 +747,7 @@ class Health_Check_Debug_Data {
747
  $extension = null;
748
  }
749
 
750
- $server = $wpdb->db_version();
751
 
752
  if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
753
  $client_version = $wpdb->dbh->client_info;
747
  $extension = null;
748
  }
749
 
750
+ $server = $wpdb->get_var( 'SELECT VERSION()' );
751
 
752
  if ( isset( $wpdb->use_mysqli ) && $wpdb->use_mysqli ) {
753
  $client_version = $wpdb->dbh->client_info;
includes/class-health-check-site-status.php CHANGED
@@ -52,7 +52,7 @@ class Health_Check_Site_Status {
52
  $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
53
  }
54
 
55
- $this->mysql_server_version = $wpdb->db_version();
56
  }
57
 
58
  $this->health_check_mysql_rec_version = '5.6';
52
  $mysql_server_type = mysql_get_server_info( $wpdb->dbh );
53
  }
54
 
55
+ $this->mysql_server_version = $wpdb->get_var( 'SELECT VERSION()' );
56
  }
57
 
58
  $this->health_check_mysql_rec_version = '5.6';
includes/tools/class-health-check-plugin-compatibility.php CHANGED
@@ -1,131 +1,131 @@
1
- <?php
2
-
3
- class Health_Check_Plugin_Compatibility extends Health_Check_Tool {
4
-
5
- public function __construct() {
6
- $this->label = __( 'Plugin compatibility', 'health-check' );
7
- $this->description = sprintf(
8
- '%s<br>%s',
9
- __( 'Attempt to identify the compatibility of your plugins before upgrading PHP, note that a compatibility check may not always be accurate, and you may want to contact the plugin author to confirm that things will continue working.', 'health-check' ),
10
- __( 'The compatibility check will need to send requests to the <a href="https://wptide.org">WPTide</a> project to fetch the test results for each of your plugins.', 'health-check' )
11
- );
12
-
13
- add_action( 'wp_ajax_health-check-tools-plugin-compat', array( $this, 'check_plugin_version' ) );
14
-
15
- parent::__construct();
16
- }
17
-
18
- public function tab_content() {
19
- ?>
20
- <table class="wp-list-table widefat fixed striped" id="health-check-tool-plugin-compat-list">
21
- <thead>
22
- <tr>
23
- <th>Plugin</th>
24
- <th>Version</th>
25
- <th>Minimum PHP</th>
26
- <th>Highest supported PHP</th>
27
- </tr>
28
- </thead>
29
-
30
- <tbody>
31
- <?php
32
- $plugins = get_plugins();
33
-
34
- foreach ( $plugins as $slug => $plugin ) {
35
- printf(
36
- '<tr data-plugin-slug="%s" data-plugin-version="%s" data-plugin-checked="false"><td>%s</td><td>%s</td><td>%s</td><td class="supported-version">%s</td></tr>',
37
- esc_attr( $slug ),
38
- esc_attr( $plugin['Version'] ),
39
- $plugin['Name'],
40
- $plugin['Version'],
41
- ( isset( $plugin['RequiresPHP'] ) && ! empty( $plugin['RequiresPHP'] ) ? $plugin['RequiresPHP'] : '&mdash;' ),
42
- '<span class="spinner"></span>'
43
- );
44
- }
45
- ?>
46
- </tbody>
47
- </table>
48
-
49
- <p>
50
- <button type="button" class="button button-primary" id="health-check-tool-plugin-compat">
51
- <?php _e( 'Check plugins', 'health-check' ); ?>
52
- </button>
53
- </p>
54
- <?php
55
- }
56
-
57
- function check_plugin_version() {
58
- check_ajax_referer( 'health-check-tools-plugin-compat' );
59
-
60
- if ( ! current_user_can( 'view_site_health_checks' ) ) {
61
- wp_send_json_error();
62
- }
63
-
64
- $response = array(
65
- 'version' => $this->get_highest_supported_php( $_POST['slug'], $_POST['version'] ),
66
- );
67
-
68
- wp_send_json_success( $response );
69
-
70
- wp_die();
71
- }
72
-
73
- function get_highest_supported_php( $slug, $version ) {
74
- $versions = $this->get_supported_php( $slug, $version );
75
-
76
- if ( empty( $versions ) ) {
77
- return __( 'Could not be determined', 'health-check' );
78
- }
79
-
80
- $highest = 0;
81
-
82
- foreach ( $versions as $version ) {
83
- if ( $highest < $version ) {
84
- $highest = $version;
85
- }
86
- }
87
-
88
- return $highest;
89
- }
90
-
91
- function get_supported_php( $slug, $version ) {
92
- // Clean up the slug, in case it's got more details
93
- if ( stristr( $slug, '/' ) ) {
94
- $parts = explode( '/', $slug );
95
- $slug = $parts[0];
96
- }
97
-
98
- $transient_name = sprintf(
99
- 'health-check-tide-%s-%s',
100
- $slug,
101
- $version
102
- );
103
-
104
- $tide_versions = get_transient( $transient_name );
105
-
106
- if ( false === $tide_versions ) {
107
- $tide_api_respone = wp_remote_get(
108
- sprintf(
109
- 'https://wptide.org/api/tide/v1/audit/wporg/plugin/%s',
110
- $slug
111
- )
112
- );
113
-
114
- $tide_response = wp_remote_retrieve_body( $tide_api_respone );
115
-
116
- $json = json_decode( $tide_response );
117
-
118
- if ( empty( $json ) ) {
119
- $tide_versions = array();
120
- } else {
121
- $tide_versions = $json[0]->reports->phpcs_phpcompatibility->compatible_versions;
122
- }
123
-
124
- set_transient( $transient_name, $tide_versions, 1 * WEEK_IN_SECONDS );
125
- }
126
-
127
- return $tide_versions;
128
- }
129
- }
130
-
131
- new Health_Check_Plugin_Compatibility();
1
+ <?php
2
+
3
+ class Health_Check_Plugin_Compatibility extends Health_Check_Tool {
4
+
5
+ public function __construct() {
6
+ $this->label = __( 'Plugin compatibility', 'health-check' );
7
+ $this->description = sprintf(
8
+ '%s<br>%s',
9
+ __( 'Attempt to identify the compatibility of your plugins before upgrading PHP, note that a compatibility check may not always be accurate, and you may want to contact the plugin author to confirm that things will continue working.', 'health-check' ),
10
+ __( 'The compatibility check will need to send requests to the <a href="https://wptide.org">WPTide</a> project to fetch the test results for each of your plugins.', 'health-check' )
11
+ );
12
+
13
+ add_action( 'wp_ajax_health-check-tools-plugin-compat', array( $this, 'check_plugin_version' ) );
14
+
15
+ parent::__construct();
16
+ }
17
+
18
+ public function tab_content() {
19
+ ?>
20
+ <table class="wp-list-table widefat fixed striped" id="health-check-tool-plugin-compat-list">
21
+ <thead>
22
+ <tr>
23
+ <th><?php _e( 'Plugin', 'health-check' ); ?></th>
24
+ <th><?php _e( 'Version', 'health-check' ); ?></th>
25
+ <th><?php _e( 'Minimum PHP', 'health-check' ); ?></th>
26
+ <th><?php _e( 'Highest supported PHP', 'health-check' ); ?></th>
27
+ </tr>
28
+ </thead>
29
+
30
+ <tbody>
31
+ <?php
32
+ $plugins = get_plugins();
33
+
34
+ foreach ( $plugins as $slug => $plugin ) {
35
+ printf(
36
+ '<tr data-plugin-slug="%s" data-plugin-version="%s" data-plugin-checked="false"><td>%s</td><td>%s</td><td>%s</td><td class="supported-version">%s</td></tr>',
37
+ esc_attr( $slug ),
38
+ esc_attr( $plugin['Version'] ),
39
+ $plugin['Name'],
40
+ $plugin['Version'],
41
+ ( isset( $plugin['RequiresPHP'] ) && ! empty( $plugin['RequiresPHP'] ) ? $plugin['RequiresPHP'] : '&mdash;' ),
42
+ '<span class="spinner"></span>'
43
+ );
44
+ }
45
+ ?>
46
+ </tbody>
47
+ </table>
48
+
49
+ <p>
50
+ <button type="button" class="button button-primary" id="health-check-tool-plugin-compat">
51
+ <?php _e( 'Check plugins', 'health-check' ); ?>
52
+ </button>
53
+ </p>
54
+ <?php
55
+ }
56
+
57
+ function check_plugin_version() {
58
+ check_ajax_referer( 'health-check-tools-plugin-compat' );
59
+
60
+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
61
+ wp_send_json_error();
62
+ }
63
+
64
+ $response = array(
65
+ 'version' => $this->get_highest_supported_php( $_POST['slug'], $_POST['version'] ),
66
+ );
67
+
68
+ wp_send_json_success( $response );
69
+
70
+ wp_die();
71
+ }
72
+
73
+ function get_highest_supported_php( $slug, $version ) {
74
+ $versions = $this->get_supported_php( $slug, $version );
75
+
76
+ if ( empty( $versions ) ) {
77
+ return __( 'Could not be determined', 'health-check' );
78
+ }
79
+
80
+ $highest = 0;
81
+
82
+ foreach ( $versions as $version ) {
83
+ if ( $highest < $version ) {
84
+ $highest = $version;
85
+ }
86
+ }
87
+
88
+ return $highest;
89
+ }
90
+
91
+ function get_supported_php( $slug, $version ) {
92
+ // Clean up the slug, in case it's got more details
93
+ if ( stristr( $slug, '/' ) ) {
94
+ $parts = explode( '/', $slug );
95
+ $slug = $parts[0];
96
+ }
97
+
98
+ $transient_name = sprintf(
99
+ 'health-check-tide-%s-%s',
100
+ $slug,
101
+ $version
102
+ );
103
+
104
+ $tide_versions = get_transient( $transient_name );
105
+
106
+ if ( false === $tide_versions ) {
107
+ $tide_api_respone = wp_remote_get(
108
+ sprintf(
109
+ 'https://wptide.org/api/tide/v1/audit/wporg/plugin/%s',
110
+ $slug
111
+ )
112
+ );
113
+
114
+ $tide_response = wp_remote_retrieve_body( $tide_api_respone );
115
+
116
+ $json = json_decode( $tide_response );
117
+
118
+ if ( empty( $json ) ) {
119
+ $tide_versions = array();
120
+ } else {
121
+ $tide_versions = $json[0]->reports->phpcs_phpcompatibility->compatible_versions;
122
+ }
123
+
124
+ set_transient( $transient_name, $tide_versions, 1 * WEEK_IN_SECONDS );
125
+ }
126
+
127
+ return $tide_versions;
128
+ }
129
+ }
130
+
131
+ new Health_Check_Plugin_Compatibility();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: wordpressdotorg, westi, pento, Clorith
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 5.2
7
- Stable tag: 1.4.0
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -49,6 +49,11 @@ At this time, the plugin has been tested with every version of PHP from 5.2 thro
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
52
  = v1.4.0 =
53
  * Fix a bug when viewing the Site Health page if enabling the Health Check plugin in troubleshooting mode.
54
  * Fix an inconsistency with how database versions are checked.
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 5.2
7
+ Stable tag: 1.4.1
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
49
 
50
  == Changelog ==
51
 
52
+ = v1.4.1 =
53
+ * Fixed SQL version checks for various MariaDB installs.
54
+ * Fixed a warning being generated in logfiles for first-time users with no existing Site Health history.
55
+ * Added missing translation function for the new PHP compatibility tool.
56
+
57
  = v1.4.0 =
58
  * Fix a bug when viewing the Site Health page if enabling the Health Check plugin in troubleshooting mode.
59
  * Fix an inconsistency with how database versions are checked.