aaemnnosttv / wp-sqlite-db

A single file drop-in for using a SQLite database with WordPress. Based on the original SQLite Integration plugin.
561 stars 94 forks source link

Site Health Page Fatal Error #24

Closed kk6mrp closed 1 year ago

kk6mrp commented 2 years ago

I'm getting this error when I try to open the Site Health menu under Tools. Is it possible to add a filter for this?


2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:Stack trace:
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#0 /var/www/example.com/wp-admin/includes/class-wp-site-health.php(1163): WP_Site_Health->prepare_sql_data()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#1 /var/www/example.com/wp-admin/includes/class-wp-site-health.php(192): WP_Site_Health->get_test_sql_server()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#2 /var/www/example.com/wp-admin/includes/class-wp-site-health.php(137): WP_Site_Health->perform_test()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#3 /var/www/example.com/wp-includes/class-wp-hook.php(303): WP_Site_Health->enqueue_scripts()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#4 /var/www/example.com/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#5 /var/www/example.com/wp-includes/plugin.php(470): WP_Hook->do_action()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#6 /var/www/example.com/wp-admin/admin-header.php(102): do_action()
2021-12-10 10:03:10: (mod_fastcgi.c.451) FastCGI-stderr:#7 /var/www/example.com/wp-admin...
aaemnnosttv commented 2 years ago

Is it possible to add a filter for this?

The checks for the database in Site Health could probably be filtered/removed/replaced to prevent such an error, I think so. In this case though, WP seems to be calling a function which has been removed as of PHP 7.

What version of WP are you running?

kk6mrp commented 2 years ago

The latest version, 5.8.2.

kk6mrp commented 2 years ago

I've added the following to hide the Site Health information for now, looking through class-wp-site-health.php, it looks like it could be tricky to make the site health work well with the SQLite Integration.

// Remove Site Health Dashboard Widget
add_action('wp_dashboard_setup', 'themeprefix_remove_dashboard_widget' );
function themeprefix_remove_dashboard_widget() {
    remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
}

// Remove Site Health Sub Menu Item
add_action( 'admin_menu', 'remove_site_health_menu' );  
function remove_site_health_menu(){
    remove_submenu_page( 'tools.php','site-health.php' ); 
}
infostud commented 2 years ago

I just replaced the calls to mysql_get_client_info() with a static string '5.6.5'. The version string is checked for support of utf8mb4 and I think is mostly harmless. Similarly for mysql_get_serverinfo(). I'm running WP 6.0. Note the mysql versions of these and similar functions have been deprecated for a long while and replaced by mysqli_ and PDO versions.

aaemnnosttv commented 1 year ago

This has been fixed in a recent release; going to the Site Health screen no longer raises a fatal error 👍