Changeset 13903 for trunk/src/bp-core/bp-core-update.php
- Timestamp:
- 06/04/2024 02:30:49 AM (20 months ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-update.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-update.php
r13637 r13903 60 60 $action = false; 61 61 62 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {62 if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) { 63 63 $action = $_REQUEST['action']; 64 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {64 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' !== $_REQUEST['action2'] ) ) { 65 65 $action = $_REQUEST['action2']; 66 66 } 67 67 68 68 // Bail if not activating. 69 if ( empty( $action ) || ! in_array( $action, array( 'activate', 'activate-selected' )) ) {69 if ( empty( $action ) || ! in_array( $action, array( 'activate', 'activate-selected' ), true ) ) { 70 70 return false; 71 71 } 72 72 73 73 // The plugin(s) being activated. 74 if ( $action == 'activate' ) {74 if ( $action === 'activate' ) { 75 75 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 76 76 } else { … … 79 79 80 80 // Set basename if empty. 81 if ( empty( $basename ) && ! empty( $bp->basename ) ) {81 if ( empty( $basename ) && ! empty( $bp->basename ) ) { 82 82 $basename = $bp->basename; 83 83 } … … 89 89 90 90 // Is BuddyPress being activated? 91 return in_array( $basename, $plugins );91 return in_array( $basename, $plugins, true ); 92 92 } 93 93 … … 104 104 $action = false; 105 105 106 if ( ! empty( $_REQUEST['action'] ) && ( '-1' != $_REQUEST['action'] ) ) {106 if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) { 107 107 $action = $_REQUEST['action']; 108 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' != $_REQUEST['action2'] ) ) {108 } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' !== $_REQUEST['action2'] ) ) { 109 109 $action = $_REQUEST['action2']; 110 110 } 111 111 112 112 // Bail if not deactivating. 113 if ( empty( $action ) || ! in_array( $action, array( 'deactivate', 'deactivate-selected' )) ) {113 if ( empty( $action ) || ! in_array( $action, array( 'deactivate', 'deactivate-selected' ), true ) ) { 114 114 return false; 115 115 } 116 116 117 117 // The plugin(s) being deactivated. 118 if ( 'deactivate' == $action ) {118 if ( 'deactivate' === $action ) { 119 119 $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 120 120 } else { … … 123 123 124 124 // Set basename if empty. 125 if ( empty( $basename ) && ! empty( $bp->basename ) ) {125 if ( empty( $basename ) && ! empty( $bp->basename ) ) { 126 126 $basename = $bp->basename; 127 127 } … … 133 133 134 134 // Is bbPress being deactivated? 135 return in_array( $basename, $plugins );135 return in_array( $basename, $plugins, true ); 136 136 } 137 137 … … 184 184 * @param array $value Array of default components to activate. 185 185 */ 186 $default_components = apply_filters( 'bp_new_install_default_components', array( 187 'activity' => 1, 188 'members' => 1, 189 'settings' => 1, 190 'xprofile' => 1, 191 'notifications' => 1, 192 ) ); 193 194 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 195 require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php' ); 186 $default_components = apply_filters( 187 'bp_new_install_default_components', 188 array( 189 'activity' => 1, 190 'members' => 1, 191 'settings' => 1, 192 'xprofile' => 1, 193 'notifications' => 1, 194 ) 195 ); 196 197 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 198 require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php'; 196 199 $switched_to_root_blog = false; 197 200 … … 226 229 bp_delete_rewrite_rules(); 227 230 228 // Upgrades.231 // Upgrades. 229 232 } else { 230 233 … … 351 354 foreach ( $tables as $table_name => $indexes ) { 352 355 foreach ( $indexes as $index ) { 353 if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", bp_esc_like( $table_name ) ) ) ) {356 if ( $wpdb->query( $wpdb->prepare( 'SHOW TABLES LIKE %s', bp_esc_like( $table_name ) ) ) ) { 354 357 $wpdb->query( "ALTER TABLE {$table_name} DROP INDEX {$index}" ); 355 358 } … … 372 375 // Delete old database version options. 373 376 delete_site_option( 'bp-activity-db-version' ); 374 delete_site_option( 'bp-blogs-db-version' );375 delete_site_option( 'bp-friends-db-version' );376 delete_site_option( 'bp-groups-db-version' );377 delete_site_option( 'bp-blogs-db-version' ); 378 delete_site_option( 'bp-friends-db-version' ); 379 delete_site_option( 'bp-groups-db-version' ); 377 380 delete_site_option( 'bp-messages-db-version' ); 378 381 delete_site_option( 'bp-xprofile-db-version' ); … … 389 392 390 393 // Delete possible site options. 391 delete_site_option( 'bp-db-version' );392 delete_site_option( '_bp_db_version' );393 delete_site_option( 'bp-core-db-version' );394 delete_site_option( 'bp-db-version' ); 395 delete_site_option( '_bp_db_version' ); 396 delete_site_option( 'bp-core-db-version' ); 394 397 delete_site_option( '_bp-core-db-version' ); 395 398 396 399 // Delete possible blog options. 397 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' );398 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' );400 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' ); 401 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' ); 399 402 delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' ); 400 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' );403 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' ); 401 404 } 402 405 … … 417 420 418 421 // Get the active components. 419 $active_components = bp_get_option( $active_components_key );422 $active_components = bp_get_option( $active_components_key ); 420 423 421 424 // Add notifications. 422 if ( ! in_array( $notifications_component_id, $active_components ) ) {425 if ( ! in_array( $notifications_component_id, $active_components, true ) ) { 423 426 $active_components[ $notifications_component_id ] = 1; 424 427 } … … 629 632 'object_type' => 'field', 630 633 'meta_key' => 'allow_custom_visibility', 631 'meta_value' => 'disabled' 634 'meta_value' => 'disabled', 632 635 ), 633 636 array( … … 635 638 '%s', 636 639 '%s', 637 '%s' 640 '%s', 638 641 ) 639 642 ); … … 693 696 $signup_position = 0; 694 697 foreach ( $signup_fields as $signup_field_id ) { 695 $signup_position += 1;698 ++$signup_position; 696 699 697 700 $wpdb->insert( … … 964 967 array( 965 968 '%s', 966 '%s' 969 '%s', 967 970 ) 968 971 ); … … 975 978 */ 976 979 function bp_cleanup_friendship_activities() { 977 bp_activity_delete( array( 978 'component' => buddypress()->friends->id, 979 'type' => 'friendship_created', 980 'hide_sitewide' => true, 981 ) ); 980 bp_activity_delete( 981 array( 982 'component' => buddypress()->friends->id, 983 'type' => 'friendship_created', 984 'hide_sitewide' => true, 985 ) 986 ); 982 987 } 983 988 … … 1019 1024 1020 1025 // If the saved page title is the same as the legacy title, there's nothing to do. 1021 if ( $legacy_titles[ $component ] == $page->post_title ) {1026 if ( $legacy_titles[ $component ] === $page->post_title ) { 1022 1027 continue; 1023 1028 } 1024 1029 1025 1030 // Update the page with the legacy title. 1026 wp_update_post( array( 1027 'ID' => $page_id, 1028 'post_title' => $legacy_titles[ $component ], 1029 ) ); 1031 wp_update_post( 1032 array( 1033 'ID' => $page_id, 1034 'post_title' => $legacy_titles[ $component ], 1035 ) 1036 ); 1030 1037 } 1031 1038 } … … 1071 1078 1072 1079 // Suppress errors because users shouldn't see what happens next. 1073 $old_suppress = $wpdb->suppress_errors();1080 $old_suppress = $wpdb->suppress_errors(); 1074 1081 1075 1082 // Never use bp_core_get_table_prefix() for any global users tables. 1076 $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" );1083 $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" ); 1077 1084 1078 1085 // Table already exists, so maybe upgrade instead? … … 1087 1094 } 1088 1095 1089 // Table does not exist, and we are a single site, so install the multisite1090 // signups table using WordPress core's database schema.1096 // Table does not exist, and we are a single site, so install the multisite 1097 // signups table using WordPress core's database schema. 1091 1098 } elseif ( ! is_multisite() ) { 1092 1099 bp_core_install_signups();
Note: See TracChangeset
for help on using the changeset viewer.