2 ) ); require __DIR__ . '/db-performance-data.php'; list( $aieo_dbp_open, $aieo_dbp_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'db-performance-page', 'description' => __('Checks whether orders use WooCommerce\'s HPOS tables and whether this database\'s indexes and table collations are set up for speed.', 'ai-eshop-optimizer'), 'icon' => 'database', 'title' => __( 'HPOS, indexes and collations', 'ai-eshop-optimizer' ), 'col' => 1, ) ); echo $aieo_dbp_open; if ( class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) && function_exists( 'WC' ) ) { if ( Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) { echo \Rooster\Admin\Ui::notice( esc_html__( 'Great Job: High Performance Order Storage in Woocommerce is active in your installation!!!', 'ai-eshop-optimizer' ), 'success', array( 'inline' => true ) ); } else { echo \Rooster\Admin\Ui::notice( esc_html__( 'Tip: High Performance Order Storage (HPOS) is not active in your installation. It improves not only the orders export process but your eshop\'s overall performance.', 'ai-eshop-optimizer' ) . ' ' . sprintf( wp_kses_post( __( 'Here is how you can enable it with a couple of clicks!. It is also bound to multiply the speed of your transactions! :)', 'ai-eshop-optimizer' ) ), 'https://woocommerce.com/document/high-performance-order-storage/' ), 'info', array( 'inline' => true ) ); } } if ( aieo_is_index_wp_mysql_for_speed_active() ) { echo \Rooster\Admin\Ui::notice( esc_html__( 'Also, your DB tables are properly indexed as you have actived Index WP MySQL For Speed!', 'ai-eshop-optimizer' ), 'success', array( 'inline' => true ) ); } else { echo \Rooster\Admin\Ui::notice( sprintf( esc_html__( 'Please consider the highly recommended %s to speed up your DB queries. It is bound to boost your overall performance!', 'ai-eshop-optimizer' ), '' . esc_html__( 'Index WP MySQL For Speed', 'ai-eshop-optimizer' ) . '' ), 'info', array( 'inline' => true ) ); } echo \Rooster\Admin\Ui::notice( esc_html( $db_check['message'] ), 'mono', array( 'inline' => true ) ); ?> true ) ); ?>

true ) ); ?>

'aieo-optimize-job', 'state' => 'idle', 'run' => __( 'Optimize Database Indexes', 'ai-eshop-optimizer' ), 'run_attrs' => array( 'id' => 'aieo-optimize-db-button' ), 'detail' => '', ) ); echo $aieo_dbp_job; ?> __( 'You are running MariaDB', 'ai-eshop-optimizer' ) . ' ' . ( $db_check['version_number'] ?? 'Unknown' ) . '.', 'text' => __( 'For optimal performance, consider upgrading to MariaDB 11.4 or higher.', 'ai-eshop-optimizer' ), 'compact' => true, ) ); echo $aieo_dbp_old; ?> __( 'You are running MySQL. These optimizations are specifically designed for MariaDB 11.4+.', 'ai-eshop-optimizer' ), 'text' => __( 'Consider migrating to MariaDB for better performance features.', 'ai-eshop-optimizer' ), 'compact' => true, ) ); echo $aieo_dbp_mysql; ?> 'db-performance-database-collation-standardization', 'icon' => 'database', 'title' => __( 'Database Collation Standardization', 'ai-eshop-optimizer' ), 'description' => __( 'Brings every Rooster One table to the collation of the WordPress tables, so the queries that join them never fail with "Illegal mix of collations". Updates do this by themselves; run it after a database was moved, restored or converted by another tool.', 'ai-eshop-optimizer' ), 'col' => 2, ) ); echo $aieo_dbp_open; ?>

'aieo-collation-job', 'state' => 'idle', 'run' => __( 'Fix Database Collations', 'ai-eshop-optimizer' ), 'primary' => false, 'run_attrs' => array( 'id' => 'aieo-fix-collation-button' ), 'confirm' => 'aieo-collation-confirm', 'detail' => '', ) ); echo $aieo_dbp_job2; $aieo_dbp_ask = \Rooster\Admin\States::confirm( 'aieo-collation-confirm', 'apply', __( 'Standardize the collations?', 'ai-eshop-optimizer' ), '

' . esc_html__( 'Rooster One\'s tables in another collation are converted to the WordPress tables\' collation. The shop keeps working meanwhile; a large table may take a few minutes.', 'ai-eshop-optimizer' ) . '

' . esc_html( sprintf( _n( '%s table is in another collation now.', '%s tables are in another collation now.', $aieo_dbp_tables, 'ai-eshop-optimizer' ), number_format_i18n( $aieo_dbp_tables ) ) ) . '

', array( 'confirm' => __( 'Fix Database Collations', 'ai-eshop-optimizer' ) ) ); echo $aieo_dbp_ask; $aieo_dbp_best = AIEO_Analytics_Collation::best_collation(); if ( '' !== $aieo_dbp_best ) { $aieo_dbp_wp = (string) aieo_get_wp_collation(); if ( AIEO_Analytics_Collation::whole_database() || $aieo_dbp_wp === $aieo_dbp_best ) { $aieo_dbp_left = AIEO_Analytics_Collation::left_count(); if ( $aieo_dbp_left > 0 && AIEO_Analytics_Collation::whole_database() ) { $aieo_dbp_tone = 'info'; $aieo_dbp_state = esc_html( sprintf( _n( 'Converting in the background: %s table left.', 'Converting in the background: %s tables left.', $aieo_dbp_left, 'ai-eshop-optimizer' ), number_format_i18n( $aieo_dbp_left ) ) ); } else { $aieo_dbp_tone = 'success'; $aieo_dbp_state = esc_html( sprintf( __( 'This site\'s tables are in %s, the fastest collation this database offers.', 'ai-eshop-optimizer' ), $aieo_dbp_best ) ); } $aieo_dbp_line = ''; if ( ! defined( 'DB_COLLATE' ) || DB_COLLATE !== $aieo_dbp_best ) { $aieo_dbp_line = '

' . sprintf( esc_html__( 'So that new tables and the connection use it too, set this line in wp-config.php: %s', 'ai-eshop-optimizer' ), '' . esc_html( "define( 'DB_COLLATE', '" . $aieo_dbp_best . "' );" ) . '' ) . '

'; } echo \Rooster\Admin\Ui::notice( $aieo_dbp_state, $aieo_dbp_tone, array( 'inline' => true, 'title' => $aieo_dbp_best, 'detail' => $aieo_dbp_line ) ); } else { $aieo_dbp_whole = AIEO_Analytics_Collation::whole_database_preview(); echo \Rooster\Admin\Ui::notice( esc_html( sprintf( __( 'This database offers %1$s, its fastest collation, but WordPress\'s tables use %2$s, so Rooster One keeps its tables beside them. Tables already in %1$s are never converted down.', 'ai-eshop-optimizer' ), $aieo_dbp_best, $aieo_dbp_wp ) ), 'info', array( 'inline' => true, 'title' => $aieo_dbp_best ) ); echo \Rooster\Admin\States::job( array( 'id' => 'aieo-collation-whole-job', 'state' => 'idle', 'run' => sprintf( __( 'Bring the whole database to %s', 'ai-eshop-optimizer' ), $aieo_dbp_best ), 'primary' => false, 'run_attrs' => array( 'id' => 'aieo-collation-whole-run' ), 'confirm' => 'aieo-collation-whole-confirm', 'detail' => '', ) ); echo \Rooster\Admin\States::confirm( 'aieo-collation-whole-confirm', 'apply', sprintf( __( 'Bring the whole database to %s?', 'ai-eshop-optimizer' ), $aieo_dbp_best ), '

' . esc_html( sprintf( _n( '%1$s table of this site (%2$s MB), WordPress\'s, WooCommerce\'s, other plugins\' and Rooster One\'s, is converted to %3$s, one at a time, while the shop keeps working. Columns that are binary on purpose keep theirs; large tables go on in the background.', '%1$s tables of this site (%2$s MB), WordPress\'s, WooCommerce\'s, other plugins\' and Rooster One\'s, are converted to %3$s, one at a time, while the shop keeps working. Columns that are binary on purpose keep theirs; large tables go on in the background.', count( $aieo_dbp_whole ), 'ai-eshop-optimizer' ), number_format_i18n( count( $aieo_dbp_whole ) ), number_format_i18n( (int) round( array_sum( $aieo_dbp_whole ) / 1048576 ) ), $aieo_dbp_best ) ) . '

' . esc_html__( 'Back up the database first, pick a quiet hour, and keep this page open until it finishes: while tables are converted, a query that joins a converted table with one not yet converted can fail.', 'ai-eshop-optimizer' ) . '

', array( 'confirm' => __( 'Convert', 'ai-eshop-optimizer' ) ) ); } } ?>