Modified notice to also handle when REST API does not have verify tool.

This commit is contained in:
vedanshujain 2020-05-12 18:49:34 +05:30
parent f5afddd4c9
commit fafa44bde0
2 changed files with 18 additions and 4 deletions

View File

@ -19,14 +19,26 @@ defined( 'ABSPATH' ) || exit;
</p>
<p>
<?php
$verify_db_tool_available = array_key_exists( 'verify_db_tables', WC_Admin_Status::get_tools() );
$missing_tables = get_option( 'woocommerce-db-missing-tables' );
if ( $verify_db_tool_available ) {
echo wp_kses_post(
sprintf(
/* translators: %1%s: WooCommerce status page %2$s: Link to check again */
__( 'One or more tables required for WooCommerce to function are missing, some features may not work as expected. Please visit <a href="%1$s">WooCommerce status page</a> to see details, or <a href="%2$s"> check again.</a>', 'woocommerce' ),
admin_url( 'admin.php?page=wc-status#status-database' ),
/* translators: %1%s: Missing tables (seperated by ",") %2$s: Link to check again */
__( 'One or more tables required for WooCommerce to function are missing, some features may not work as expected. Missing tables: %1$s. <a href="%2$s">Check again.</a>', 'woocommerce' ),
esc_html( implode( ', ', $missing_tables ) ),
wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=verify_db_tables' ), 'debug_action' )
)
);
?>
} else {
echo wp_kses_post(
sprintf(
/* translators: %1%s: Missing tables (seperated by ",") */
__( 'One or more tables required for WooCommerce to function are missing, some features may not work as expected. Missing tables: %1$s.', 'woocommerce' ),
esc_html( implode( ', ', $missing_tables ) )
)
);
}
?>
</p>
</div>

View File

@ -326,11 +326,13 @@ class WC_Install {
if ( $modify_notice ) {
WC_Admin_Notices::add_notice( 'base_tables_missing' );
}
update_option( 'woocommerce-db-missing-tables', $missing_tables );
} else {
if ( $modify_notice ) {
WC_Admin_Notices::remove_notice( 'base_tables_missing' );
}
update_option( 'woocommerce-db-verified', WC()->version );
delete_option( 'woocommerce-db-missing-tables' );
}
return $missing_tables;
}