Changeset 4559 for trunk/bp-core/admin/bp-core-update.php
- Timestamp:
- 06/24/2011 06:57:51 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/admin/bp-core-update.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-update.php
r4556 r4559 18 18 19 19 // Ensure that we have access to some utility functions 20 include( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' );20 require_once( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' ); 21 21 22 22 // Get current DB version … … 260 260 } 261 261 262 function step_ms_update() { 262 function step_ms_update() { 263 263 if ( !current_user_can( 'activate_plugins' ) ) 264 264 return false; 265 265 266 $active_components = get_site_option( 'bp-active-components' );266 $active_components = bp_get_option( 'bp-active-components' ); 267 267 268 268 if ( defined( 'BP_BLOGS_SLUG' ) ) … … 272 272 273 273 // Call up old bp-pages to see if a page has been previously linked to Blogs 274 $page_blog_id = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? get_current_blog_id() : BP_ROOT_BLOG; 275 $existing_pages_data = get_blog_option( $page_blog_id, 'bp-pages' ); 276 $existing_pages = $existing_pages_data[$page_blog_id]; 274 $existing_pages = bp_get_option( 'bp-pages' ); 277 275 278 276 if ( !empty( $existing_pages['blogs'] ) ) … … 370 368 371 369 $existing_pages = bp_core_update_get_page_meta(); 370 371 // Provide empty indexes to avoid PHP errors with wp_dropdown_pages() 372 $indexes = array( 'members', 'activity', 'groups', 'forums', 'blogs', 'register', 'activate' ); 373 foreach ( $indexes as $index ) { 374 if ( !isset( $existing_pages[$index] ) ) 375 $existing_pages[$index] = ''; 376 } 377 378 if ( !empty( $existing_pages['blogs'] ) ) 379 $existing_blog_page = '&selected=' . $existing_pages['blogs']; 380 else 381 $existing_blog_page = ''; 372 382 373 383 // Get active components 374 $active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );384 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 375 385 376 386 // Check for defined slugs … … 739 749 // Update the active components option early if we're updating 740 750 if ( 'update' == $this->setup_type ) 741 update_site_option( 'bp-active-components', $bp->active_components );751 bp_update_option( 'bp-active-components', $bp->active_components ); 742 752 743 753 return true; … … 772 782 773 783 // Move bp-pages data from the blog options table to site options 774 $page_blog_id = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? get_current_blog_id() : BP_ROOT_BLOG; 775 $existing_pages_data = get_blog_option( $page_blog_id, 'bp-pages' ); 776 $existing_pages = $existing_pages_data[$page_blog_id]; 777 778 $bp_pages = $this->setup_pages( (array)$_POST['bp_pages'] ); 779 $bp_pages = array_merge( (array)$existing_pages, (array)$bp_pages ); 780 781 $existing_pages_data[$page_blog_id] = $bp_pages; 782 783 update_site_option( 'bp-pages', $existing_pages_data ); 784 $existing_pages = bp_get_option( 'bp-pages' ); 785 786 $bp_pages = $this->setup_pages( (array)$_POST['bp_pages'] ); 787 $bp_pages = array_merge( (array)$existing_pages, (array)$bp_pages ); 788 789 bp_update_option( 'bp-pages', $existing_pages ); 784 790 785 791 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) ) … … 789 795 } 790 796 791 update_site_option( 'bp-active-components', $active_components );797 bp_update_option( 'bp-active-components', $active_components ); 792 798 793 799 return true; … … 808 814 $active_components[$key] = 1; 809 815 810 update_site_option( 'bp-active-components', $active_components );816 bp_update_option( 'bp-active-components', $active_components ); 811 817 812 818 wp_cache_flush(); … … 836 842 837 843 $blog_pages = $this->setup_pages( (array)$_POST['bp_pages'] ); 838 $page_blog_id = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? get_current_blog_id() : BP_ROOT_BLOG; 839 $bp_pages = array( $page_blog_id => $blog_pages ); 840 841 update_site_option( 'bp-pages', $bp_pages ); 844 bp_update_option( 'bp-pages', $blog_pages ); 842 845 843 846 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != BP_ROOT_BLOG ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) ) … … 1008 1011 1009 1012 // Update the DB version in the database 1013 // Stored in sitemeta. Do not use bp_update_option() 1010 1014 update_site_option( 'bp-db-version', $this->new_version ); 1011 1015 delete_site_option( 'bp-core-db-version' ); … … 1076 1080 1077 1081 if ( empty( $active_components ) ) 1078 $active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );1082 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 1079 1083 1080 1084 require_once( dirname( __FILE__ ) . '/bp-core-schema.php' ); … … 1132 1136 if ( !(int)$bp->site_options['bp-blogs-first-install'] && is_multisite() ) { 1133 1137 bp_blogs_record_existing_blogs(); 1134 add_site_option( 'bp-blogs-first-install', 1 );1138 bp_update_option( 'bp-blogs-first-install', 1 ); 1135 1139 } 1136 1140 … … 1249 1253 1250 1254 /** 1251 * Fetches BP pages from the meta table , depending on setup1255 * Fetches BP pages from the meta table 1252 1256 * 1253 1257 * @package BuddyPress Core … … 1256 1260 * @return array $page_ids 1257 1261 */ 1258 function bp_core_update_get_page_meta() { 1259 $page_ids = get_site_option( 'bp-pages' ); 1260 1261 $is_enable_multiblog = is_multisite() && defined( 'BP_ENABLE_MULTIBLOG' ) && BP_ENABLE_MULTIBLOG ? true : false; 1262 1263 $page_blog_id = $is_enable_multiblog ? get_current_blog_id() : BP_ROOT_BLOG; 1264 1265 $blog_page_ids = !empty( $page_ids[$page_blog_id] ) ? $page_ids[$page_blog_id] : false; 1266 1267 return apply_filters( 'bp_core_update_get_page_meta', $blog_page_ids ); 1262 function bp_core_update_get_page_meta() { 1263 require_once( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' ); 1264 1265 if ( !$page_ids = bp_get_option( 'bp-pages' ) ) 1266 $page_ids = array(); 1267 1268 return apply_filters( 'bp_core_update_get_page_meta', $page_ids ); 1268 1269 } 1269 1270
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)