f ( Helper::is_module_active( '404-monitor' ) ) {
$tools['delete_log'] = [
'title' => __( 'Clear 404 Log', 'rank-math' ),
'description' => __( 'Is the 404 error log getting out of hand? Use this option to clear ALL 404 logs generated by your website in the Rank Math 404 Monitor.', 'rank-math' ),
'confirm_text' => __( 'Are you sure you want to delete the 404 log? This action is irreversible.', 'rank-math' ),
'button_text' => __( 'Clear 404 Log', 'rank-math' ),
];
}
$tools['recreate_tables'] = [
'title' => __( 'Re-create Missing Database Tables', 'rank-math' ),
'description' => __( 'Check if required tables exist and create them if not.', 'rank-math' ),
'button_text' => __( 'Re-create Tables', 'rank-math' ),
];
if ( Helper::is_module_active( 'analytics' ) ) {
$tools['analytics_fix_collations'] = [
'title' => __( 'Fix Analytics table collations', 'rank-math' ),
'description' => __( 'In some cases, the Analytics database tables or columns don\'t match with each other, which can cause database errors. This tool can fix that issue.', 'rank-math' ),
'button_text' => __( 'Fix Collations', 'rank-math' ),
];
}
$block_posts = Yoast_Blocks::get()->find_posts();
if ( is_array( $block_posts ) && ! empty( $block_posts['count'] ) ) {
$tools['yoast_blocks'] = [
'title' => __( 'Yoast Block Converter', 'rank-math' ),
'description' => __( 'Convert FAQ, HowTo, & Table of Contents Blocks created using Yoast. Use this option to easily move your previous blocks into Rank Math.', 'rank-math' ),
'confirm_text' => __( 'Are you sure you want to convert Yoast blocks into Rank Math blocks? This action is irreversible.', 'rank-math' ),
'button_text' => __( 'Convert Blocks', 'rank-math' ),
];
}
$aio_block_posts = AIOSEO_Blocks::get()->find_posts();
if ( is_array( $aio_block_posts ) && ! empty( $aio_block_posts['count'] ) ) {
$tools['aioseo_blocks'] = [
'title' => __( 'AIOSEO Block Converter', 'rank-math' ),
'description' => __( 'Convert TOC block created using AIOSEO. Use this option to easily move your previous blocks into Rank Math.', 'rank-math' ),
'confirm_text' => __( 'Are you sure you want to convert AIOSEO blocks into Rank Math blocks? This action is irreversible.', 'rank-math' ),
'button_text' => __( 'Convert Blocks', 'rank-math' ),
];
}
if ( Helper::is_module_active( 'link-counter' ) ) {
$tools['delete_links'] = [
'title' => __( 'Delete Internal Links Data', 'rank-math' ),
'description' => __( 'In some instances, the internal links data might show an inflated number or no number at all. Deleting the internal links data might fix the issue.', 'rank-math' ),
'confirm_text' => __( 'Are you sure you want to delete Internal Links Data? This action is irreversible.', 'rank-math' ),
'button_text' => __( 'Delete Internal Links', 'rank-math' ),
];
}
if ( Helper::is_module_active( 'redirections' ) ) {
$tools['delete_redirections'] = [
'title' => __( 'Delete Redirections Rules', 'rank-math' ),
'description' => __( 'Getting a redirection loop or need a fresh start? Delete all the redirections using this tool. Note: This process is irreversible and will delete ALL your redirection rules.', 'rank-math' ),
'confirm_text' => __( 'Are you sure you want to delete all the Redirection Rules? This action is irreversible.', 'rank-math' ),
'button_text' => __( 'Delete Redirections', 'rank-math' ),
];
}
if ( ! empty( Update_Score::get()->find() ) ) {
$tools['update_seo_score'] = [
'title' => __( 'Update SEO Scores', 'rank-math' ),
'description' => __( 'This tool will calculate the SEO score for the posts/pages that have a Focus Keyword set. Note: This process may take some time and the browser tab must be kept open while it is running.', 'rank-math' ),
'button_text' => __( 'Recalculate Scores', 'rank-math' ),
];
}
if ( Helper::is_module_active( 'analytics' ) && Helper::has_cap( 'analytics' ) ) {
Arr::insert(
$tools,
[
'analytics_clear_caches' => [
'title' => __( 'Purge Analytics Cache', 'rank-math' ),
'description' => __( 'Clear analytics cache to re-calculate all the stats again.', 'rank-math' ),
'button_text' => __( 'Clear Cache', 'rank-math' ),
],
],
3
);
$description = __( 'Missing some posts/pages in the Analytics data? Clear the index and build a new one for more accurate stats.', 'rank-math' );
$sitepress = Sitepress::get()->is_active() ? Sitepress::get()->get_var() : false;
if ( Sitepress::get()->is_per_domain() && ! empty( $sitepress->get_setting( 'auto_adjust_ids', null ) ) ) {
$description .= '
' . sprintf(
/* translators: 1: settings URL, 2: settings text */
__( 'To properly rebuild Analytics posts in secondary languages, please disable the %1$s when using a different domain per language.', 'rank-math' ),
'' . __( 'Make themes work multilingual option in WPML settings', 'rank-math' ) . ''
) . '';
}
Arr::insert(
$tools,
[
'analytics_reindex_posts' => [
'title' => __( 'Rebuild Index for Analytics', 'rank-math' ),
'description' => $description,
'button_text' => __( 'Rebuild Index', 'rank-math' ),
],
],
3
);
}
/**
* Filters the list of tools available on the Database Tools page.
*
* @param array $tools The tools.
*/
$tools = apply_filters( 'rank_math/database/tools', $tools );
return $tools;
}
}