joedolson / my-calendar

My Calendar WordPress Plugin
https://www.joedolson.com/my-calendar/
GNU General Public License v3.0
19 stars 16 forks source link

MySQL max_user_connections error using MC with remote database #567

Closed Joerg-P closed 1 year ago

Joerg-P commented 1 year ago

See https://wordpress.org/support/topic/mysql-error-using-mc-with-remote-database/#post-17011828 for description

Fix: The max_connection error is in include/db.php line 135. Every request to the remote database opens a new connection to the remote database. Here is a fix:

function mc_is_remote_db() { global $wpdb; global $remotedb; $mcdb = $wpdb;

if ( ‘true’ === mc_get_option( ‘remote’ ) && function_exists( ‘mc_remote_db’ ) ) { if ( !isset( $remotedb ) ) { $remotedb = mc_remote_db(); } $mcdb = $remotedb; } return $mcdb; }

The Warning can be removed in my-calendar-locations.php line 203

if ( ! $post_id && isset($mcdb->postmeta) ) {