Ticket #8141: 8141.patch
| File 8141.patch, 5.1 KB (added by , 6 years ago) |
|---|
-
src/bp-core/admin/bp-core-admin-tools.php
src/bp-core/admin/bp-core-admin-tools.php | 77 ++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/src/bp-core/admin/bp-core-admin-tools.php b/src/bp-core/admin/bp-core-admin-tools.php index 0ad810e0d..47eb04785 100644
a b function bp_admin_repair_list() { 147 147 'bp_admin_reinstall_emails', 148 148 ); 149 149 150 // Invitations 151 // - maybe create the database table 152 $repair_list[110] = array( 153 'bp-invitations-table', 154 __( 'Create the database table for Invitations.', 'buddypress' ), 155 'bp_admin_invitations_table', 156 ); 157 150 158 ksort( $repair_list ); 151 159 152 160 /** … … function bp_admin_repair_list() { 159 167 return (array) apply_filters( 'bp_repair_list', $repair_list ); 160 168 } 161 169 170 171 /** 172 * Create the invitations database table if it does not exist. 173 * 174 * @since 6.0.0 175 * 176 * @return array 177 */ 178 function bp_admin_invitations_table() { 179 global $wpdb; 180 181 $statement = __( 'Creating the Invitations database table if it does not exist… %s', 'buddypress' ); 182 $result = __( 'Failed!', 'buddypress' ); 183 184 $charset_collate = $GLOBALS['wpdb']->get_charset_collate(); 185 $bp_prefix = bp_core_get_table_prefix(); 186 $table_name = $bp_prefix . 'bp_invitations'; 187 188 $sql = "CREATE TABLE $table_name ( 189 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, 190 user_id bigint(20) NOT NULL, 191 inviter_id bigint(20) NOT NULL, 192 invitee_email varchar(100) DEFAULT NULL, 193 class varchar(120) NOT NULL, 194 item_id bigint(20) NOT NULL, 195 secondary_item_id bigint(20) DEFAULT NULL, 196 type varchar(12) NOT NULL DEFAULT 'invite', 197 content longtext DEFAULT '', 198 date_modified datetime NOT NULL, 199 invite_sent tinyint(1) NOT NULL DEFAULT '0', 200 accepted tinyint(1) NOT NULL DEFAULT '0', 201 KEY user_id (user_id), 202 KEY inviter_id (inviter_id), 203 KEY invitee_email (invitee_email), 204 KEY class (class), 205 KEY item_id (item_id), 206 KEY secondary_item_id (secondary_item_id), 207 KEY type (type), 208 KEY invite_sent (invite_sent), 209 KEY accepted (accepted) 210 ) {$charset_collate};"; 211 212 213 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 214 215 $db_result = maybe_create_table( $table_name, $sql ); 216 217 if ( ! $db_result ) { 218 return array( 2, sprintf( $statement, $result ) ); 219 } else { 220 return array( 0, sprintf( $statement, __( 'Finished!', 'buddypress' ) ) ); 221 } 222 223 } 224 162 225 /** 163 226 * Recalculate friend counts for each user. 164 227 * … … function bp_admin_repair_friend_count() { 173 236 return; 174 237 } 175 238 176 /* translators: %s: the result of the action performed by the repair tool */177 239 $statement = __( 'Counting the number of friends for each user… %s', 'buddypress' ); 178 240 $result = __( 'Failed!', 'buddypress' ); 179 241 … … function bp_admin_repair_group_count() { 232 294 return; 233 295 } 234 296 235 /* translators: %s: the result of the action performed by the repair tool */236 297 $statement = __( 'Counting the number of groups for each user… %s', 'buddypress' ); 237 298 $result = __( 'Failed!', 'buddypress' ); 238 299 … … function bp_admin_repair_group_count() { 275 336 */ 276 337 function bp_admin_repair_blog_records() { 277 338 278 / * translators: %s: the result of the action performed by the repair tool */339 // Description of this tool, displayed to the user. 279 340 $statement = __( 'Repopulating Blogs records… %s', 'buddypress' ); 280 341 281 342 // Default to failure text. … … function bp_admin_repair_blog_records() { 304 365 * @since 2.0.0 305 366 */ 306 367 function bp_admin_repair_count_members() { 307 /* translators: %s: the result of the action performed by the repair tool */308 368 $statement = __( 'Counting the number of active members on the site… %s', 'buddypress' ); 309 369 delete_transient( 'bp_active_member_count' ); 310 370 bp_core_get_active_member_count(); … … function bp_admin_repair_count_members() { 319 379 * @since 2.0.0 320 380 */ 321 381 function bp_admin_repair_last_activity() { 322 /* translators: %s: the result of the action performed by the repair tool */323 382 $statement = __( 'Determining last activity dates for each user… %s', 'buddypress' ); 324 383 bp_last_activity_migrate(); 325 384 return array( 0, sprintf( $statement, __( 'Complete!', 'buddypress' ) ) ); … … function bp_core_admin_available_tools_intro() { 411 470 <h2><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h2> 412 471 <p> 413 472 <?php esc_html_e( 'BuddyPress keeps track of various relationships between users, groups, and activity items. Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?> 414 <?php 415 printf( 416 /* translators: %s: the link to the BuddyPress repair tools */ 417 esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ), 418 '<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Tools', 'buddypress' ) . '</a>' 419 ); 420 ?> 473 <?php printf( esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ), '<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Tools', 'buddypress' ) . '</a>' ); ?> 421 474 </p> 422 475 </div> 423 476 <?php