supports_transactions() ) { return false; } $table = $wpdb->options ?? $wpdb->prefix . 'options'; $row = $wpdb->get_row( $wpdb->prepare( 'SELECT TABLE_NAME AS Name, ENGINE AS Engine FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = %s LIMIT 1', $table ), ARRAY_A ); return is_array( $row ) && ( $row['Name'] ?? '' ) === $table && 'innodb' === strtolower( (string) ( $row['Engine'] ?? '' ) ); } /** * Return whether both mutation tables use a transactional engine. */ public function supports_transactions(): bool { global $wpdb; /** @var \wpdb $wpdb */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( null !== $this->supported ) { return $this->supported; } if ( ! method_exists( $wpdb, 'get_row' ) ) { $this->supported = false; return $this->supported; } foreach ( array( Installer::memory_items_table(), Installer::memory_events_table() ) as $table ) { $row = $wpdb->get_row( $wpdb->prepare( 'SELECT TABLE_NAME AS Name, ENGINE AS Engine FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = %s LIMIT 1', $table ), ARRAY_A ); if ( ! is_array( $row ) || (string) ( $row['Name'] ?? '' ) !== $table || 'innodb' !== strtolower( (string) ( $row['Engine'] ?? '' ) ) ) { $this->supported = false; return $this->supported; } } $this->supported = true; return $this->supported; } }