Skip to content

Commit 6dc9f1e

Browse files
Merge pull request #33 from pantheon-systems/30-fix-wpdb-error
Don't check for failback flush when `$wpdb->options` isn't yet available
2 parents 3c97e9c + 184f897 commit 6dc9f1e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

object-cache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,9 @@ function __construct() {
819819
add_action( 'admin_notices', array( $this, 'wp_action_admin_notices_warn_missing_redis' ) );
820820
}
821821

822-
if ( $this->is_redis_failback_flush_enabled() ) {
822+
// $wpdb->options can be unset before multisite loads
823+
// It's safe to skip here if unset, because cache will be reinitialized when `$blog_id` is available
824+
if ( $this->is_redis_failback_flush_enabled() && ! empty( $wpdb->options ) ) {
823825
$this->do_redis_failback_flush = (bool) $wpdb->get_results( "SELECT option_value FROM {$wpdb->options} WHERE option_name='wp_redis_do_redis_failback_flush'" );
824826
if ( $this->is_redis_connected && $this->do_redis_failback_flush ) {
825827
$ret = $this->_call_redis( 'flushAll' );

0 commit comments

Comments
 (0)