Ticket #1146: faster_tag_recount.patch
| File faster_tag_recount.patch, 18.9 KB (added by sambauers, 2 years ago) |
|---|
-
bb-admin/tools-recount.php
9 9 $messages = array(); 10 10 11 11 if ( !empty( $_POST['topic-posts'] ) ) { 12 $messages[] = bb_recount_topic_posts(); 12 $message = bb_recount_topic_posts(); 13 $messages[] = $message[1]; 13 14 } 14 15 15 16 if ( !empty( $_POST['topic-voices'] ) ) { 16 $messages[] = bb_recount_topic_voices(); 17 $message = bb_recount_topic_voices(); 18 $messages[] = $message[1]; 17 19 } 18 20 19 21 if ( !empty( $_POST['topic-deleted-posts'] ) ) { 20 $messages[] = bb_recount_topic_deleted_posts(); 22 $message = bb_recount_topic_deleted_posts(); 23 $messages[] = $message[1]; 21 24 } 22 25 23 26 if ( !empty( $_POST['forums'] ) ) { 24 $messages[] = bb_recount_forum_topics(); 25 $messages[] = bb_recount_forum_posts(); 27 $message = bb_recount_forum_topics(); 28 $messages[] = $message[1]; 29 $message = bb_recount_forum_posts(); 30 $messages[] = $message[1]; 26 31 } 27 32 28 33 if ( !empty( $_POST['topics-replied'] ) ) { 29 $messages[] = bb_recount_user_topics_replied(); 34 $message = bb_recount_user_topics_replied(); 35 $messages[] = $message[1]; 30 36 } 31 37 32 38 if ( !empty( $_POST['topic-tag-count'] ) ) { 33 $messages[] = bb_recount_topic_tags(); 39 $message = bb_recount_topic_tags(); 40 $messages[] = $message[1]; 34 41 } 35 42 36 43 if ( !empty( $_POST['tags-tag-count'] ) ) { 37 $messages[] = bb_recount_tag_topics(); 44 $message = bb_recount_tag_topics(); 45 $messages[] = $message[1]; 38 46 } 39 47 40 48 if ( !empty( $_POST['tags-delete-empty'] ) ) { 41 $messages[] = bb_recount_tag_delete_empty(); 49 $message = bb_recount_tag_delete_empty(); 50 $messages[] = $message[1]; 42 51 } 43 52 44 53 if ( !empty( $_POST['clean-favorites'] ) ) { 45 $messages[] = bb_recount_clean_favorites(); 54 $message = bb_recount_clean_favorites(); 55 $messages[] = $message[1]; 46 56 } 47 57 48 58 bb_recount_list(); 49 59 foreach ( (array) $recount_list as $item ) { 50 60 if ( isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2]) ) { 51 $messages[] = call_user_func( $item[2] ); 61 $message = call_user_func( $item[2] ); 62 if ( is_array( $message ) ) { 63 $messages[] = $message[1]; 64 } else { 65 $messages[] = $message; 66 } 52 67 } 53 68 } 54 69 -
bb-admin/includes/functions.bb-recount.php
9 9 10 10 $sql = "INSERT INTO `$bbdb->topics` (`topic_id`, `topic_posts`) (SELECT `topic_id`, COUNT(`post_status`) as `topic_posts` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `topic_id`) ON DUPLICATE KEY UPDATE `topic_posts` = VALUES(`topic_posts`);"; 11 11 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 12 return sprintf( $statement, $result);12 return array( 1, sprintf( $statement, $result ) ); 13 13 } 14 14 15 15 $result = __( 'Complete!' ); 16 return sprintf( $statement, $result);16 return array( 0, sprintf( $statement, $result ) ); 17 17 } 18 18 19 19 function bb_recount_topic_voices() … … 25 25 26 26 $sql_delete = "DELETE FROM `$bbdb->meta` WHERE `object_type` = 'bb_topic' AND `meta_key` = 'voices_count';"; 27 27 if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) { 28 return sprintf( $statement, $result);28 return array( 1, sprintf( $statement, $result ) ); 29 29 } 30 30 31 31 $sql = "INSERT INTO `$bbdb->meta` (`object_type`, `object_id`, `meta_key`, `meta_value`) (SELECT 'bb_topic', `topic_id`, 'voices_count', COUNT(DISTINCT `poster_id`) as `meta_value` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `topic_id`);"; 32 32 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 33 return sprintf( $statement, $result);33 return array( 2, sprintf( $statement, $result ) ); 34 34 } 35 35 36 36 $result = __( 'Complete!' ); 37 return sprintf( $statement, $result);37 return array( 0, sprintf( $statement, $result ) ); 38 38 } 39 39 40 40 function bb_recount_topic_deleted_posts() … … 46 46 47 47 $sql_delete = "DELETE FROM `$bbdb->meta` WHERE `object_type` = 'bb_topic' AND `meta_key` = 'deleted_posts';"; 48 48 if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) { 49 return sprintf( $statement, $result);49 return array( 1, sprintf( $statement, $result ) ); 50 50 } 51 51 52 52 $sql = "INSERT INTO `$bbdb->meta` (`object_type`, `object_id`, `meta_key`, `meta_value`) (SELECT 'bb_topic', `topic_id`, 'deleted_posts', COUNT(`post_status`) as `meta_value` FROM `$bbdb->posts` WHERE `post_status` != '0' GROUP BY `topic_id`);"; 53 53 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 54 return sprintf( $statement, $result);54 return array( 2, sprintf( $statement, $result ) ); 55 55 } 56 56 57 57 $result = __( 'Complete!' ); 58 return sprintf( $statement, $result);58 return array( 0, sprintf( $statement, $result ) ); 59 59 } 60 60 61 61 function bb_recount_forum_topics() … … 67 67 68 68 $sql = "INSERT INTO `$bbdb->forums` (`forum_id`, `topics`) (SELECT `forum_id`, COUNT(`topic_status`) as `topics` FROM `$bbdb->topics` WHERE `topic_status` = '0' GROUP BY `forum_id`) ON DUPLICATE KEY UPDATE `topics` = VALUES(`topics`);"; 69 69 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 70 return sprintf( $statement, $result);70 return array( 1, sprintf( $statement, $result ) ); 71 71 } 72 72 73 73 $result = __( 'Complete!' ); 74 return sprintf( $statement, $result);74 return array( 0, sprintf( $statement, $result ) ); 75 75 } 76 76 77 77 function bb_recount_forum_posts() … … 83 83 84 84 $sql = "INSERT INTO `$bbdb->forums` (`forum_id`, `posts`) (SELECT `forum_id`, COUNT(`post_status`) as `posts` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `forum_id`) ON DUPLICATE KEY UPDATE `posts` = VALUES(`posts`);"; 85 85 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 86 return sprintf( $statement, $result);86 return array( 1, sprintf( $statement, $result ) ); 87 87 } 88 88 89 89 $result = __( 'Complete!' ); 90 return sprintf( $statement, $result);90 return array( 0, sprintf( $statement, $result ) ); 91 91 } 92 92 93 93 function bb_recount_user_topics_replied() … … 101 101 $insert_rows = $bbdb->get_results( $sql_select ); 102 102 103 103 if ( is_wp_error( $insert_rows ) ) { 104 return sprintf( $statement, $result);104 return array( 1, sprintf( $statement, $result ) ); 105 105 } 106 106 107 107 $meta_key = $bbdb->prefix . 'topics_replied'; … … 112 112 } 113 113 114 114 if ( !count( $insert_values ) ) { 115 return sprintf( $statement, $result);115 return array( 2, sprintf( $statement, $result ) ); 116 116 } 117 117 118 118 $sql_delete = "DELETE FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';"; 119 119 if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) { 120 return sprintf( $statement, $result);120 return array( 3, sprintf( $statement, $result ) ); 121 121 } 122 122 123 123 $insert_values = array_chunk( $insert_values, 10000 ); … … 126 126 $sql_insert = "INSERT INTO `$bbdb->usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES $chunk;"; 127 127 128 128 if ( is_wp_error( $bbdb->query( $sql_insert ) ) ) { 129 return sprintf( $statement, $result);129 return array( 4, sprintf( $statement, $result ) ); 130 130 } 131 131 } 132 132 133 133 $result = __( 'Complete!' ); 134 return sprintf( $statement, $result);134 return array( 0, sprintf( $statement, $result ) ); 135 135 } 136 136 137 // T ODO - make fast - see #1146137 // This function bypasses the taxonomy API 138 138 function bb_recount_topic_tags() 139 139 { 140 global $bbdb , $wp_taxonomy_object;140 global $bbdb; 141 141 142 // Reset tag count to zero143 $ bbdb->query( "UPDATE $bbdb->topics SET tag_count = 0");142 $statement = __( 'Counting the number of topic tags in each topic… %s' ); 143 $result = __( 'Failed!' ); 144 144 145 // Delete empty tags 146 $delete = bb_recount_tag_delete_empty(); 147 if ( $delete[0] > 0 ) { 148 $result = __( 'Could not delete empty tags.' ); 149 return array( 1, sprintf( $statement, $result ) ); 150 } 151 145 152 // Get all tags 146 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag' ); 153 $sql_terms = "SELECT 154 `$bbdb->term_relationships`.`object_id`, 155 `$bbdb->term_taxonomy`.`term_id` 156 FROM `$bbdb->term_relationships` 157 JOIN `$bbdb->term_taxonomy` 158 ON `$bbdb->term_taxonomy`.`term_taxonomy_id` = `$bbdb->term_relationships`.`term_taxonomy_id` 159 WHERE 160 `$bbdb->term_taxonomy`.`taxonomy` = 'bb_topic_tag' 161 ORDER BY 162 `$bbdb->term_relationships`.`object_id`, 163 `$bbdb->term_taxonomy`.`term_id`;"; 147 164 148 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 149 $message = __('Counted topic tags'); 150 foreach ( $terms as $term ) { 151 $topic_ids = bb_get_tagged_topic_ids( $term->term_id ); 152 if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) { 153 $bbdb->query( 154 "UPDATE $bbdb->topics SET tag_count = tag_count + 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")" 155 ); 156 } 157 unset( $topic_ids ); 165 $terms = $bbdb->get_results( $sql_terms ); 166 if ( is_wp_error( $terms ) || !is_array( $terms ) ) { 167 return array( 2, sprintf( $statement, $result ) ); 168 } 169 if ( empty( $terms ) ) { 170 $result = __( 'No topic tags found.' ); 171 return array( 3, sprintf( $statement, $result ) ); 172 } 173 174 // Count the tags in each topic 175 $topics = array(); 176 foreach ( $terms as $term ) { 177 if ( !isset( $topics[$term->object_id] ) ) { 178 $topics[$term->object_id] = 1; 179 } else { 180 $topics[$term->object_id]++; 158 181 } 159 182 } 160 unset( $terms, $term ); 183 if ( empty( $topics ) ) { 184 return array( 4, sprintf( $statement, $result ) ); 185 } 161 186 162 return $message; 187 // Build the values to insert into the SQL statement 188 $values = array(); 189 foreach ($topics as $topic_id => $tag_count) { 190 $values[] = '(' . $topic_id . ', ' . $tag_count . ')'; 191 } 192 if ( empty( $values ) ) { 193 return array( 5, sprintf( $statement, $result ) ); 194 } 195 196 // Update the topics with the new tag counts 197 $values = array_chunk( $values, 10000 ); 198 foreach ($values as $chunk) { 199 $sql = "INSERT INTO `$bbdb->topics` (`topic_id`, `tag_count`) VALUES " . implode(", ", $chunk) . " ON DUPLICATE KEY UPDATE `tag_count` = VALUES(`tag_count`);"; 200 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 201 return array( 6, sprintf( $statement, $result ) ); 202 } 203 } 204 205 $result = __( 'Complete!' ); 206 return array( 0, sprintf( $statement, $result ) ); 163 207 } 164 208 165 // T ODO - make fast - see #1146209 // This function bypasses the taxonomy API 166 210 function bb_recount_tag_topics() 167 211 { 168 global $ wp_taxonomy_object;212 global $bbdb; 169 213 214 $statement = __( 'Counting the number of topics in each topic tag… %s' ); 215 $result = __( 'Failed!' ); 216 217 // Delete empty tags 218 $delete = bb_recount_tag_delete_empty(); 219 if ( $delete[0] > 0 ) { 220 $result = __( 'Could not delete empty tags.' ); 221 return array( 1, sprintf( $statement, $result ) ); 222 } 223 170 224 // Get all tags 171 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) ); 225 $sql_terms = "SELECT 226 `$bbdb->term_taxonomy`.`term_taxonomy_id`, 227 `$bbdb->term_relationships`.`object_id` 228 FROM `$bbdb->term_relationships` 229 JOIN `$bbdb->term_taxonomy` 230 ON `$bbdb->term_taxonomy`.`term_taxonomy_id` = `$bbdb->term_relationships`.`term_taxonomy_id` 231 WHERE 232 `$bbdb->term_taxonomy`.`taxonomy` = 'bb_topic_tag' 233 ORDER BY 234 `$bbdb->term_taxonomy`.`term_taxonomy_id`, 235 `$bbdb->term_relationships`.`object_id`;"; 172 236 173 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 174 $message = __('Counted tagged topics'); 175 $_terms = array(); 176 foreach ( $terms as $term ) { 177 $_terms[] = $term->term_id; 237 $terms = $bbdb->get_results( $sql_terms ); 238 if ( is_wp_error( $terms ) || !is_array( $terms ) ) { 239 return array( 2, sprintf( $statement, $result ) ); 240 } 241 if ( empty( $terms ) ) { 242 $result = __( 'No topic tags found.' ); 243 return array( 3, sprintf( $statement, $result ) ); 244 } 245 246 // Count the topics in each tag 247 $tags = array(); 248 foreach ( $terms as $term ) { 249 if ( !isset( $tags[$term->term_taxonomy_id] ) ) { 250 $tags[$term->term_taxonomy_id] = 1; 251 } else { 252 $tags[$term->term_taxonomy_id]++; 178 253 } 179 if ( count( $_terms ) ) { 180 $wp_taxonomy_object->update_term_count( $_terms, 'bb_topic_tag' ); 254 } 255 if ( empty( $tags ) ) { 256 return array( 4, sprintf( $statement, $result ) ); 257 } 258 259 // Build the values to insert into the SQL statement 260 $values = array(); 261 foreach ($tags as $term_taxonomy_id => $count) { 262 $values[] = '(' . $term_taxonomy_id . ', ' . $count . ')'; 263 } 264 if ( empty( $values ) ) { 265 return array( 5, sprintf( $statement, $result ) ); 266 } 267 268 // Update the terms with the new tag counts 269 $values = array_chunk( $values, 10000 ); 270 foreach ($values as $chunk) { 271 $sql = "INSERT INTO `$bbdb->term_taxonomy` (`term_taxonomy_id`, `count`) VALUES " . implode(", ", $chunk) . " ON DUPLICATE KEY UPDATE `count` = VALUES(`count`);"; 272 if ( is_wp_error( $bbdb->query( $sql ) ) ) { 273 return array( 6, sprintf( $statement, $result ) ); 181 274 } 182 275 } 183 unset( $term, $_terms );184 276 185 return $message; 277 if ($return_boolean) { 278 return true; 279 } 280 $result = __( 'Complete!' ); 281 return array( 0, sprintf( $statement, $result ) ); 186 282 } 187 283 188 // T ODO - make fast - see #1146284 // This function bypasses the taxonomy API 189 285 function bb_recount_tag_delete_empty() 190 286 { 191 global $ wp_taxonomy_object;287 global $bbdb; 192 288 193 // Get all tags 194 if ( !isset( $terms ) ) { 195 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) ); 289 $statement = __( 'Deleting topic tags with no topics… %s' ); 290 $result = __( 'Failed!' ); 291 292 static $run_once; 293 if ( isset( $run_once ) ) { 294 if ($run_once > 0) { 295 $exit = sprintf( __( 'failure (returned code %s)' ), $run_once ); 296 } else { 297 $exit = __( 'success' ); 298 } 299 $result = sprintf( __( 'Already run with %s.' ), $exit ); 300 return array( $run_once, sprintf( $statement, $result ) ); 196 301 } 197 302 198 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 199 $message = __('Deleted tags with no topics'); 200 foreach ( $terms as $term ) { 201 $topic_ids = bb_get_tagged_topic_ids( $term->term_id ); 202 if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) { 203 if ( false === $topic_ids || ( is_array( $topic_ids ) && !count( $topic_ids ) ) ) { 204 bb_destroy_tag( $term->term_taxonomy_id ); 205 } 303 // Get all topic ids 304 $sql_topics = "SELECT `topic_id` FROM $bbdb->topics ORDER BY `topic_id`;"; 305 $topics = $bbdb->get_results( $sql_topics ); 306 if ( is_wp_error( $topics ) ) { 307 $result = __('No topics found.'); 308 $run_once = 1; 309 return array( 1, sprintf( $statement, $result ) ); 310 } 311 $topic_ids = array(); 312 foreach ($topics as $topic) { 313 $topic_ids[] = $topic->topic_id; 314 } 315 316 // Get all topic tag term relationships without a valid topic id 317 $in_topic_ids = implode(', ', $topic_ids); 318 $sql_bad_term_relationships = "SELECT 319 `$bbdb->term_taxonomy`.`term_taxonomy_id`, 320 `$bbdb->term_taxonomy`.`term_id`, 321 `$bbdb->term_relationships`.`object_id` 322 FROM `$bbdb->term_relationships` 323 JOIN `$bbdb->term_taxonomy` 324 ON `$bbdb->term_taxonomy`.`term_taxonomy_id` = `$bbdb->term_relationships`.`term_taxonomy_id` 325 WHERE 326 `$bbdb->term_taxonomy`.`taxonomy` = 'bb_topic_tag' AND 327 `$bbdb->term_relationships`.`object_id` NOT IN ($in_topic_ids) 328 ORDER BY 329 `$bbdb->term_relationships`.`object_id`, 330 `$bbdb->term_taxonomy`.`term_id`, 331 `$bbdb->term_taxonomy`.`term_taxonomy_id`;"; 332 333 $bad_term_relationships = $bbdb->get_results( $sql_bad_term_relationships ); 334 if ( is_wp_error( $bad_term_relationships ) || !is_array( $bad_term_relationships ) ) { 335 $run_once = 2; 336 return array( 2, sprintf( $statement, $result ) ); 337 } 338 339 // Delete those bad term relationships 340 if ( !empty( $bad_term_relationships ) ) { 341 $values = array(); 342 foreach ( $bad_term_relationships as $bad_term_relationship ) { 343 $values[] = '(`object_id` = ' . $bad_term_relationship->object_id . ' AND `term_taxonomy_id` = ' . $bad_term_relationship->term_taxonomy_id . ')'; 344 } 345 if ( !empty( $values ) ) { 346 $values = join(' OR ', $values); 347 $sql_bad_term_relationships_delete = "DELETE 348 FROM `$bbdb->term_relationships` 349 WHERE $values;"; 350 if ( is_wp_error( $bbdb->query( $sql_bad_term_relationships_delete ) ) ) { 351 $run_once = 3; 352 return array( 3, sprintf( $statement, $result ) ); 206 353 } 207 unset( $topic_ids );208 354 } 209 355 } 210 unset( $terms, $term );211 356 212 return $message; 357 // Now get all term taxonomy ids with term relationships 358 $sql_term_relationships = "SELECT `term_taxonomy_id` FROM $bbdb->term_relationships ORDER BY `term_taxonomy_id`;"; 359 $term_taxonomy_ids = $bbdb->get_col($sql_term_relationships); 360 if ( is_wp_error( $term_taxonomy_ids ) ) { 361 $run_once = 4; 362 return array( 4, sprintf( $statement, $result ) ); 363 } 364 $term_taxonomy_ids = array_unique( $term_taxonomy_ids ); 365 366 // Delete topic tags that don't have any term relationships 367 if ( !empty( $term_taxonomy_ids ) ) { 368 $in_term_taxonomy_ids = implode(', ', $term_taxonomy_ids); 369 $sql_delete_term_relationships = "DELETE 370 FROM $bbdb->term_taxonomy 371 WHERE 372 `taxonomy` = 'bb_topic_tag' AND 373 `term_taxonomy_id` NOT IN ($in_term_taxonomy_ids);"; 374 if ( is_wp_error( $bbdb->query( $sql_delete_term_relationships ) ) ) { 375 $run_once = 5; 376 return array( 5, sprintf( $statement, $result ) ); 377 } 378 } 379 380 // Get all valid term ids 381 $sql_terms = "SELECT `term_id` FROM $bbdb->term_taxonomy ORDER BY `term_id`;"; 382 $term_ids = $bbdb->get_col($sql_terms); 383 if ( is_wp_error( $term_ids ) ) { 384 $run_once = 6; 385 return array( 6, sprintf( $statement, $result ) ); 386 } 387 $term_ids = array_unique( $term_ids ); 388 389 // Delete terms that don't have any associated term taxonomies 390 if ( !empty( $term_ids ) ) { 391 $in_term_ids = implode(', ', $term_ids); 392 $sql_delete_terms = "DELETE 393 FROM $bbdb->terms 394 WHERE 395 `term_id` NOT IN ($in_term_ids);"; 396 if ( is_wp_error( $bbdb->query( $sql_delete_terms ) ) ) { 397 $run_once = 7; 398 return array( 7, sprintf( $statement, $result ) ); 399 } 400 } 401 402 $result = __( 'Complete!' ); 403 $run_once = 0; 404 return array( 0, sprintf( $statement, $result ) ); 213 405 } 214 406 215 407 function bb_recount_clean_favorites() … … 223 415 224 416 $users = $bbdb->get_results( "SELECT `user_id`, `meta_value` AS `favorites` FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';" ); 225 417 if ( is_wp_error( $users ) ) { 226 return sprintf( $statement, $result);418 return array( 1, sprintf( $statement, $result ) ); 227 419 } 228 420 229 421 $topics = $bbdb->get_col( "SELECT `topic_id` FROM `$bbdb->topics` WHERE `topic_status` = '0';" ); 230 422 231 423 if ( is_wp_error( $topics ) ) { 232 return sprintf( $statement, $result);424 return array( 2, sprintf( $statement, $result ) ); 233 425 } 234 426 235 427 $values = array(); … … 246 438 } 247 439 248 440 if ( !count( $values ) ) { 249 return sprintf( $statement, $result ); 441 $result = __( 'Nothing to remove!' ); 442 return array( 0, sprintf( $statement, $result ) ); 250 443 } 251 444 252 445 $sql_delete = "DELETE FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';"; 253 446 if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) { 254 return sprintf( $statement, $result);447 return array( 4, sprintf( $statement, $result ) ); 255 448 } 256 449 257 450 $values = array_chunk( $values, 10000 ); … … 259 452 $chunk = "\n" . join( ",\n", $chunk ); 260 453 $sql_insert = "INSERT INTO `$bbdb->usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES $chunk;"; 261 454 if ( is_wp_error( $bbdb->query( $sql_insert ) ) ) { 262 return sprintf( $statement, $result);455 return array( 5, sprintf( $statement, $result ) ); 263 456 } 264 457 } 265 458 266 459 $result = __( 'Complete!' ); 267 return sprintf( $statement, $result);460 return array( 0, sprintf( $statement, $result ) ); 268 461 }