Skip to content

Commit

Permalink
Show what queries need to be run if Recreate Index fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Sep 26, 2016
1 parent 2257115 commit df128c8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion admin/main-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,22 @@

<?php if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related'" ) || ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) || ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) { ?>
<div class="notice error">
<?php esc_html_e( 'One or more FULLTEXT indices are missing. Please hit the <a href="#crp_recreate">Recreate Index button</a> at the bottom of the page to fix this.', 'contextual-related-posts' ); ?>
<?php printf( esc_html__( 'One or more FULLTEXT indices are missing. Please hit the %1$s at the bottom of the page to fix this.', 'contextual-related-posts' ), '<a href="#crp_recreate">' . esc_html__( 'Recreate Index button', 'contextual-related-posts' ) . '</a>' ); ?>
</div>
<?php } ?>

<div class="inside">
<p><?php esc_html_e( 'If the Recreate Index button fails, please run the following queries in phpMyAdmin or Adminer', 'contextual-related-posts' ); ?></p>
<p>
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related;</code><br />
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related_title;</code><br />
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> DROP INDEX crp_related_content;</code><br />
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related (post_title, post_content);</code><br />
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related_title (post_title);</code><br />
<code>ALTER TABLE <?php esc_attr_e( $wpdb->posts ); ?> ADD FULLTEXT crp_related_content (post_content);</code><br />
</p>
</div>

<?php wp_nonce_field( 'crp-plugin-settings' ) ?>
</form>
</div><!-- /post-body-content -->
Expand Down

0 comments on commit df128c8

Please sign in to comment.