PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.0
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.0
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
← All changes | includes/Core/Migration.php +2 -45 4.5.24.2.0 View file →
@@ -31,9 +31,8 @@
31 31 }
32 32 }
33 33
34 34 $this->search_migration();
35 - $this->fix_search_table_collation();
36 35
37 36 /**
38 37 * Settings Migration
39 38 */
@@ -63,15 +62,14 @@
63 62 $count = 0;
64 63 $not_found_count = $value;
65 64 }
66 65
67 - // Use BINARY comparison to avoid collation mismatch errors
68 - $keyword = $wpdb->get_var(
66 + $keyword = $wpdb->get_var(
69 67 $wpdb->prepare(
70 68 "
71 69 SELECT keyword
72 70 FROM {$wpdb->prefix}betterdocs_search_keyword
73 - WHERE BINARY keyword = %s",
71 + WHERE keyword = %s",
74 72 $key
75 73 )
76 74 );
77 75
@@ -107,47 +105,6 @@
107 105
108 106 $this->database->save( 'betterdocs_search_data_migration', '1.0' );
109 107 }
110 108 }
111 - }
112 -
113 - /**
114 - * Fix collation issues in search tables
115 - * Converts tables to proper UTF-8 charset and collation to prevent
116 - * "Illegal mix of collations" errors when searching with non-Latin characters
117 - *
118 - * @since 1.0.2
119 - * @return void
120 - */
121 - public function fix_search_table_collation() {
122 - global $wpdb;
123 -
124 - // Check if migration already ran
125 - if ( $this->database->get( 'betterdocs_search_collation_fixed', false ) ) {
126 - return;
127 - }
128 -
129 - // Get the WordPress default charset and collation
130 - $charset = $wpdb->charset ? $wpdb->charset : 'utf8mb4';
131 - $collate = $wpdb->collate ? $wpdb->collate : 'utf8mb4_unicode_520_ci';
132 -
133 - // Fix search_keyword table
134 - $search_keyword_table = $wpdb->prefix . 'betterdocs_search_keyword';
135 - if ( $wpdb->get_var( "SHOW TABLES LIKE '$search_keyword_table'" ) == $search_keyword_table ) {
136 - // Convert table charset and collation
137 - $wpdb->query( "ALTER TABLE {$search_keyword_table} CONVERT TO CHARACTER SET {$charset} COLLATE {$collate}" );
138 -
139 - // Explicitly set keyword column collation
140 - $wpdb->query( "ALTER TABLE {$search_keyword_table} MODIFY keyword TEXT CHARACTER SET {$charset} COLLATE {$collate} NOT NULL" );
141 - }
142 -
143 - // Fix search_log table
144 - $search_log_table = $wpdb->prefix . 'betterdocs_search_log';
145 - if ( $wpdb->get_var( "SHOW TABLES LIKE '$search_log_table'" ) == $search_log_table ) {
146 - // Convert table charset and collation
147 - $wpdb->query( "ALTER TABLE {$search_log_table} CONVERT TO CHARACTER SET {$charset} COLLATE {$collate}" );
148 - }
149 -
150 - // Mark migration as complete
151 - $this->database->save( 'betterdocs_search_collation_fixed', '1.0' );
152 109 }
153 110 }