Changeset 7860 for trunk/bp-core/bp-core-update.php
- Timestamp:
- 02/12/2014 09:27:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-update.php
r7798 r7860 230 230 if ( $raw_db_version < 7731 ) { 231 231 bp_update_to_1_9_2(); 232 } 233 234 // 2.0 235 if ( $raw_db_version < 7859 ) { 236 bp_update_to_2_0(); 232 237 } 233 238 } … … 329 334 330 335 /** 336 * 2.0 update routine. 337 * 338 * - Ensure that the activity tables are installed, for last_activity storage. 339 * - Migrate last_activity data from usermeta to activity table 340 */ 341 function bp_update_to_2_0() { 342 global $wpdb; 343 344 // Install activity tables 345 bp_core_install_activity_streams(); 346 347 $bp = buddypress(); 348 349 // Migrate data 350 // The "NOT IN" clause prevents duplicates 351 $sql = "INSERT INTO {$bp->members->table_name_last_activity} (`user_id`, `component`, `type`, `date_recorded` ) ( 352 SELECT user_id, '{$bp->members->id}' as component, 'last_activity' as type, meta_value AS date_recorded 353 FROM {$wpdb->usermeta} 354 WHERE 355 meta_key = 'last_activity' 356 AND 357 user_id NOT IN ( 358 SELECT user_id 359 FROM {$bp->members->table_name_last_activity} 360 WHERE component = '{$bp->members->id}' AND type = 'last_activity' 361 ) 362 );"; 363 364 $wpdb->query( $sql ); 365 } 366 367 /** 331 368 * Redirect user to BP's What's New page on first page load after activation. 332 369 *
Note: See TracChangeset
for help on using the changeset viewer.