PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
← All changes | includes/admin/tools/repair.php +66 -84 trunk2.6.17 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * bbPress Admin Repair Page.
4 + * bbPress Admin Repair Page
5 5 *
6 6 * @package bbPress
7 7 * @subpackage Administration
8 8 */
@@ -32,14 +32,15 @@
32 32 }
33 33 }
34 34
35 35 /**
36 - * Admin repair page.
36 + * Admin repair page
37 37 *
38 38 * @since 2.0.0 bbPress (r2613) Converted from bbPress 1.2
39 39 * @since 2.6.0 bbPress (r5885) Upgraded to list-table UI
40 40 *
41 41 * @todo Use a real list table
42 + *
42 43 */
43 44 function bbp_admin_repair_page() {
44 45
45 46 // Get the registered repair tools
@@ -104,9 +105,8 @@
104 105 <input id="cb-select-all-1" type="checkbox">
105 106 </td>
106 107 <th scope="col" id="description" class="manage-column column-primary column-description sortable <?php echo ( 'priority' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
107 108 <a href="<?php
108 -
109 109 echo esc_url(
110 110 bbp_get_admin_repair_tool_page_url(
111 111 array(
112 112 'orderby' => 'priority',
@@ -114,13 +114,9 @@
114 114 )
115 115 )
116 116 );
117 117
118 - ?>">
119 - <span>
120 - <?php esc_html_e( 'Description', 'bbpress' ); ?>
121 - </span>
122 - <span class="sorting-indicator"></span>
118 + ?>"><span><?php esc_html_e( 'Description', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
123 119 </a>
124 120 </th>
125 121 <th scope="col" id="components" class="manage-column column-components">
126 122 <span><?php esc_html_e( 'Components', 'bbpress' ); ?></span>
@@ -126,9 +122,8 @@
126 122 <span><?php esc_html_e( 'Components', 'bbpress' ); ?></span>
127 123 </th>
128 124 <th scope="col" id="overhead" class="manage-column column-overhead sortable <?php echo ( 'overhead' === $orderby ) ? esc_attr( $order ) : 'asc'; ?>">
129 125 <a href="<?php
130 -
131 126 echo esc_url(
132 127 bbp_get_admin_repair_tool_page_url(
133 128 array(
134 129 'orderby' => 'overhead',
@@ -136,13 +131,9 @@
136 131 )
137 132 )
138 133 );
139 134
140 - ?>">
141 - <span>
142 - <?php esc_html_e( 'Overhead', 'bbpress' ); ?>
143 - </span>
144 - <span class="sorting-indicator"></span>
135 + ?>"><span><?php esc_html_e( 'Overhead', 'bbpress' ); ?></span><span class="sorting-indicator"></span>
145 136 </a>
146 137 </th>
147 138 </tr>
148 139 </thead>
@@ -157,36 +148,28 @@
157 148 <th scope="row" class="check-column">
158 149 <label class="screen-reader-text" for="<?php echo esc_attr( str_replace( '_', '-', $item['id'] ) ); ?>"></label>
159 150 <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $item['id'] ); ?>" id="<?php echo esc_attr( str_replace( '_', '-', $item['id'] ) ); ?>">
160 151 </th>
161 - <td class="bbp-tool-title column-primary column-description"
162 - data-colname="<?php esc_html_e( 'Description', 'bbpress' ); ?>">
163 - <strong><?php echo esc_html( $item['title'] ); ?></strong>
152 + <td class="bbp-tool-title column-primary column-description" data-colname="<?php esc_html_e( 'Description', 'bbpress' ); ?>">
153 + <strong><?php echo esc_html( $item['title'] ); ?></strong><?php
164 154
165 - <?php if ( ! empty( $item['description'] ) ) : ?>
166 - <p class="description"><?php echo esc_html( $item['description'] ); ?></p>
167 - <?php endif; ?>
155 + // Optional description
156 + if ( ! empty( $item['description'] ) ) :
157 + echo '<p class="description">' . esc_html( $item['description'] ) . '</p>';
158 + endif;
168 159
169 - <div class="row-actions hide-if-no-js">
160 + ?><div class="row-actions hide-if-no-js">
170 161 <span class="run">
171 - <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>"
172 - id="<?php echo esc_attr( $item['id'] ); ?>"
173 - aria-label="<?php
174 - printf(
162 + <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>" aria-label="<?php printf(
175 163 /* translators: %s: Repair tool title */
176 - esc_html__( 'Run %s', 'bbpress' ),
177 - $item['title']
178 - );
179 - ?>">
180 - <?php esc_html_e( 'Run', 'bbpress' ); ?>
181 - </a>
164 + esc_html__( 'Run %s', 'bbpress' ),
165 + $item['title']
166 + );
167 + ?>" id="<?php echo esc_attr( $item['id'] ); ?>" ><?php esc_html_e( 'Run', 'bbpress' ); ?></a>
182 168 </span>
183 169 </div>
184 -
185 170 <button type="button" class="toggle-row">
186 - <span class="screen-reader-text">
187 - <?php esc_html_e( 'Show more details', 'bbpress' ); ?>
188 - </span>
171 + <span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'bbpress' ); ?></span>
189 172 </button>
190 173 </td>
191 174 <td class="column-components desc" data-colname="<?php esc_html_e( 'Components', 'bbpress' ); ?>">
192 175 <div class="bbp-tool-overhead">
@@ -247,13 +230,13 @@
247 230 <?php
248 231 }
249 232
250 233 /**
251 - * Recount topic replies.
234 + * Recount topic replies
252 235 *
253 236 * @since 2.0.0 bbPress (r2613)
254 237 *
255 - * @return array An array of the status code and the message.
238 + * @return array An array of the status code and the message
256 239 */
257 240 function bbp_admin_repair_topic_reply_count() {
258 241
259 242 // Define variables
@@ -299,13 +282,13 @@
299 282 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
300 283 }
301 284
302 285 /**
303 - * Recount topic voices.
286 + * Recount topic voices
304 287 *
305 288 * @since 2.0.0 bbPress (r2613)
306 289 *
307 - * @return array An array of the status code and the message.
290 + * @return array An array of the status code and the message
308 291 */
309 292 function bbp_admin_repair_topic_voice_count() {
310 293
311 294 // Define variables
@@ -373,13 +356,13 @@
373 356 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
374 357 }
375 358
376 359 /**
377 - * Recount non-public replies per topic (pending/spammed/trashed).
360 + * Recount non-public replies per topic (pending/spammed/trashed)
378 361 *
379 362 * @since 2.0.0 bbPress (r2747)
380 363 *
381 - * @return array An array of the status code and the message.
364 + * @return array An array of the status code and the message
382 365 */
383 366 function bbp_admin_repair_topic_hidden_reply_count() {
384 367
385 368 // Define variables
@@ -423,13 +406,13 @@
423 406 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
424 407 }
425 408
426 409 /**
427 - * Recount forum topics.
410 + * Recount forum topics
428 411 *
429 412 * @since 2.0.0 bbPress (r2613)
430 413 *
431 - * @return array An array of the status code and the message.
414 + * @return array An array of the status code and the message
432 415 */
433 416 function bbp_admin_repair_forum_topic_count() {
434 417
435 418 // Define variables
@@ -469,13 +452,13 @@
469 452 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
470 453 }
471 454
472 455 /**
473 - * Recount topic in each topic-tag.
456 + * Recount topic in each topic-tag
474 457 *
475 458 * @since 2.6.0 bbPress (r6256)
476 459 *
477 - * @return array An array of the status code and the message.
460 + * @return array An array of the status code and the message
478 461 */
479 462 function bbp_admin_repair_topic_tag_count() {
480 463
481 464 // Define variables
@@ -521,13 +504,13 @@
521 504 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
522 505 }
523 506
524 507 /**
525 - * Recount forum replies.
508 + * Recount forum replies
526 509 *
527 510 * @since 2.0.0 bbPress (r2613)
528 511 *
529 - * @return array An array of the status code and the message.
512 + * @return array An array of the status code and the message
530 513 */
531 514 function bbp_admin_repair_forum_reply_count() {
532 515
533 516 // Define variables
@@ -570,14 +553,14 @@
570 553 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
571 554 }
572 555
573 556 /**
574 - * Recount non-public forum replies.
557 + * Recount non-public forum replies
575 558 *
576 559 * @since 2.6.0 bbPress (r6922)
577 560 * @since 2.6.0 bbPress (r6932) Rename to match the topic reply recount function
578 561 *
579 - * @return array An array of the status code and the message.
562 + * @return array An array of the status code and the message
580 563 */
581 564 function bbp_admin_repair_forum_hidden_reply_count() {
582 565
583 566 // Define variables
@@ -620,13 +603,13 @@
620 603 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
621 604 }
622 605
623 606 /**
624 - * Recount topics by the users.
607 + * Recount topics by the users
625 608 *
626 609 * @since 2.1.0 bbPress (r3889)
627 610 *
628 - * @return array An array of the status code and the message.
611 + * @return array An array of the status code and the message
629 612 */
630 613 function bbp_admin_repair_user_topic_count() {
631 614
632 615 // Define variables
@@ -687,13 +670,13 @@
687 670 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
688 671 }
689 672
690 673 /**
691 - * Recount topic replied by the users.
674 + * Recount topic replied by the users
692 675 *
693 676 * @since 2.0.0 bbPress (r2613)
694 677 *
695 - * @return array An array of the status code and the message.
678 + * @return array An array of the status code and the message
696 679 */
697 680 function bbp_admin_repair_user_reply_count() {
698 681
699 682 // Define variables
@@ -754,13 +737,13 @@
754 737 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
755 738 }
756 739
757 740 /**
758 - * Repair user favorites.
741 + * Repair user favorites
759 742 *
760 743 * @since 2.0.0 bbPress (r2613)
761 744 *
762 - * @return array An array of the status code and the message.
745 + * @return array An array of the status code and the message
763 746 */
764 747 function bbp_admin_repair_user_favorites() {
765 748
766 749 // Define variables
@@ -825,13 +808,13 @@
825 808 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
826 809 }
827 810
828 811 /**
829 - * Clean the user topic subscriptions.
812 + * Clean the user topic subscriptions
830 813 *
831 814 * @since 2.0.0 bbPress (r2668)
832 815 *
833 - * @return array An array of the status code and the message.
816 + * @return array An array of the status code and the message
834 817 */
835 818 function bbp_admin_repair_user_topic_subscriptions() {
836 819
837 820 // Define variables
@@ -895,13 +878,13 @@
895 878 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
896 879 }
897 880
898 881 /**
899 - * Clean the user forum subscriptions.
882 + * Clean the user forum subscriptions
900 883 *
901 884 * @since 2.5.0 bbPress (r5155)
902 885 *
903 - * @return array An array of the status code and the message.
886 + * @return array An array of the status code and the message
904 887 */
905 888 function bbp_admin_repair_user_forum_subscriptions() {
906 889
907 890 // Define variables
@@ -966,9 +949,9 @@
966 949 }
967 950
968 951 /**
969 952 * This repair tool will map each user of the current site to their respective
970 - * forums role. By default, Admins will be Keymasters, and every other role
953 + * forums role. By default, Admins will be Key Masters, and every other role
971 954 * will be the default role defined in Settings > Forums (Participant).
972 955 *
973 956 * @since 2.2.0 bbPress (r4340)
974 957 */
@@ -1087,13 +1070,13 @@
1087 1070 return array( 0, sprintf( $statement, $result ) );
1088 1071 }
1089 1072
1090 1073 /**
1091 - * Repair the last post in every topic and forum.
1074 + * Repair the last post in every topic and forum
1092 1075 *
1093 1076 * @since 2.0.0 bbPress (r3040)
1094 1077 *
1095 - * @return array An array of the status code and the message.
1078 + * @return array An array of the status code and the message
1096 1079 */
1097 1080 function bbp_admin_repair_freshness() {
1098 1081
1099 1082 // Define variables
@@ -1241,13 +1224,13 @@
1241 1224 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
1242 1225 }
1243 1226
1244 1227 /**
1245 - * Repair the relationship of sticky topics to the actual parent forum.
1228 + * Repair the relationship of sticky topics to the actual parent forum
1246 1229 *
1247 1230 * @since 2.3.0 bbPress (r4695)
1248 1231 *
1249 - * @return array An array of the status code and the message.
1232 + * @return array An array of the status code and the message
1250 1233 */
1251 1234 function bbp_admin_repair_sticky() {
1252 1235
1253 1236 // Define variables
@@ -1302,9 +1285,9 @@
1302 1285 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
1303 1286 }
1304 1287
1305 1288 /**
1306 - * Repair closed topics.
1289 + * Repair closed topics
1307 1290 *
1308 1291 * Closed topics that are missing the post-meta "_bbp_status" key value "publish"
1309 1292 * result in unexpected behavior, primarily this would have only occurred if you
1310 1293 * had imported forums from another forum package previous to bbPress v2.6,
@@ -1356,13 +1339,13 @@
1356 1339 return array( 0, sprintf( $statement, $result ) );
1357 1340 }
1358 1341
1359 1342 /**
1360 - * Repair the private and hidden forums.
1343 + * Repair the private and hidden forums
1361 1344 *
1362 1345 * @since 2.2.0 bbPress (r4104)
1363 1346 *
1364 - * @return array An array of the status code and the message.
1347 + * @return array An array of the status code and the message
1365 1348 */
1366 1349 function bbp_admin_repair_forum_visibility() {
1367 1350 /* translators: %s: Status of the repair process */
1368 1351 $statement = esc_html__( 'Recalculating forum visibility&hellip; %s', 'bbpress' );
@@ -1377,13 +1360,13 @@
1377 1360 }
1378 1361 }
1379 1362
1380 1363 /**
1381 - * Repair the parent forum meta for each topic and reply.
1364 + * Repair the parent forum meta for each topic and reply
1382 1365 *
1383 1366 * @since 2.1.0 bbPress (r3876)
1384 1367 *
1385 - * @return array An array of the status code and the message.
1368 + * @return array An array of the status code and the message
1386 1369 */
1387 1370 function bbp_admin_repair_forum_meta() {
1388 1371
1389 1372 // Define variables
@@ -1452,13 +1435,13 @@
1452 1435 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
1453 1436 }
1454 1437
1455 1438 /**
1456 - * Repair the topic for each post.
1439 + * Repair the topic for each post
1457 1440 *
1458 1441 * @since 2.1.0 bbPress (r3876)
1459 1442 *
1460 - * @return array An array of the status code and the message.
1443 + * @return array An array of the status code and the message
1461 1444 */
1462 1445 function bbp_admin_repair_topic_meta() {
1463 1446
1464 1447 // Define variables
@@ -1512,13 +1495,13 @@
1512 1495 return array( 0, sprintf( $statement, esc_html__( 'Complete!', 'bbpress' ) ) );
1513 1496 }
1514 1497
1515 1498 /**
1516 - * Recalculate reply menu order.
1499 + * Recalculate reply menu order
1517 1500 *
1518 1501 * @since 2.5.4 bbPress (r5367)
1519 1502 *
1520 - * @return array An array of the status code and the message.
1503 + * @return array An array of the status code and the message
1521 1504 */
1522 1505 function bbp_admin_repair_reply_menu_order() {
1523 1506
1524 1507 // Define variables
@@ -1535,19 +1518,18 @@
1535 1518 // Post type
1536 1519 $rpt = bbp_get_reply_post_type();
1537 1520
1538 1521 // Get an array of reply id's to update the menu oder for each reply
1539 - $replies = $bbp_db->get_results(
1540 - "SELECT `a`.`ID` FROM `{$bbp_db->posts}` AS `a`
1541 - INNER JOIN (
1542 - SELECT `menu_order`, `post_parent`
1543 - FROM `{$bbp_db->posts}`
1544 - GROUP BY `menu_order`, `post_parent`
1545 - HAVING COUNT( * ) >1
1546 - )`b`
1547 - ON `a`.`menu_order` = `b`.`menu_order`
1548 - AND `a`.`post_parent` = `b`.`post_parent`
1549 - WHERE `post_type` = '{$rpt}'",
1522 + $replies = $bbp_db->get_results( "SELECT `a`.`ID` FROM `{$bbp_db->posts}` AS `a`
1523 + INNER JOIN (
1524 + SELECT `menu_order`, `post_parent`
1525 + FROM `{$bbp_db->posts}`
1526 + GROUP BY `menu_order`, `post_parent`
1527 + HAVING COUNT( * ) >1
1528 + )`b`
1529 + ON `a`.`menu_order` = `b`.`menu_order`
1530 + AND `a`.`post_parent` = `b`.`post_parent`
1531 + WHERE `post_type` = '{$rpt}'",
1550 1532 OBJECT_K
1551 1533 );
1552 1534
1553 1535 // Bail if no replies returned