354 global $wpdb, $table_prefix; |
354 global $wpdb, $table_prefix; |
355 if ( !empty( $wpdb->error ) ) |
355 if ( !empty( $wpdb->error ) ) |
356 dead_db(); |
356 dead_db(); |
357 |
357 |
358 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', |
358 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', |
359 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', |
359 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', |
360 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', |
360 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', |
361 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', |
361 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', |
362 // multisite: |
362 // multisite: |
363 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', |
363 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', |
364 ); |
364 ); |
379 * |
379 * |
380 * @access private |
380 * @access private |
381 * @since 3.0.0 |
381 * @since 3.0.0 |
382 */ |
382 */ |
383 function wp_start_object_cache() { |
383 function wp_start_object_cache() { |
384 global $_wp_using_ext_object_cache; |
384 global $_wp_using_ext_object_cache, $blog_id; |
385 |
385 |
386 $first_init = false; |
386 $first_init = false; |
387 if ( ! function_exists( 'wp_cache_init' ) ) { |
387 if ( ! function_exists( 'wp_cache_init' ) ) { |
388 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { |
388 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { |
389 require_once ( WP_CONTENT_DIR . '/object-cache.php' ); |
389 require_once ( WP_CONTENT_DIR . '/object-cache.php' ); |
401 } |
401 } |
402 |
402 |
403 // If cache supports reset, reset instead of init if already initialized. |
403 // If cache supports reset, reset instead of init if already initialized. |
404 // Reset signals to the cache that global IDs have changed and it may need to update keys |
404 // Reset signals to the cache that global IDs have changed and it may need to update keys |
405 // and cleanup caches. |
405 // and cleanup caches. |
406 if ( !$first_init && function_exists('wp_cache_reset') ) |
406 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) |
407 wp_cache_reset(); |
407 wp_cache_switch_to_blog( $blog_id ); |
408 else |
408 else |
409 wp_cache_init(); |
409 wp_cache_init(); |
410 |
410 |
411 if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
411 if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
412 wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); |
412 wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) ); |
413 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); |
413 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); |
414 } |
414 } |
415 } |
415 } |
416 |
416 |
417 /** |
417 /** |
597 * @since 3.1.0 |
600 * @since 3.1.0 |
598 * |
601 * |
599 * @return bool True if inside WordPress network administration pages. |
602 * @return bool True if inside WordPress network administration pages. |
600 */ |
603 */ |
601 function is_blog_admin() { |
604 function is_blog_admin() { |
602 if ( defined( 'WP_BLOG_ADMIN' ) ) |
605 if ( isset( $GLOBALS['current_screen'] ) ) |
|
606 return $GLOBALS['current_screen']->in_admin( 'site' ); |
|
607 elseif ( defined( 'WP_BLOG_ADMIN' ) ) |
603 return WP_BLOG_ADMIN; |
608 return WP_BLOG_ADMIN; |
|
609 |
604 return false; |
610 return false; |
605 } |
611 } |
606 |
612 |
607 /** |
613 /** |
608 * Whether the current request is for a network admin screen /wp-admin/network/ |
614 * Whether the current request is for a network admin screen /wp-admin/network/ |
613 * @since 3.1.0 |
619 * @since 3.1.0 |
614 * |
620 * |
615 * @return bool True if inside WordPress network administration pages. |
621 * @return bool True if inside WordPress network administration pages. |
616 */ |
622 */ |
617 function is_network_admin() { |
623 function is_network_admin() { |
618 if ( defined( 'WP_NETWORK_ADMIN' ) ) |
624 if ( isset( $GLOBALS['current_screen'] ) ) |
|
625 return $GLOBALS['current_screen']->in_admin( 'network' ); |
|
626 elseif ( defined( 'WP_NETWORK_ADMIN' ) ) |
619 return WP_NETWORK_ADMIN; |
627 return WP_NETWORK_ADMIN; |
|
628 |
620 return false; |
629 return false; |
621 } |
630 } |
622 |
631 |
623 /** |
632 /** |
624 * Whether the current request is for a user admin screen /wp-admin/user/ |
633 * Whether the current request is for a user admin screen /wp-admin/user/ |
629 * @since 3.1.0 |
638 * @since 3.1.0 |
630 * |
639 * |
631 * @return bool True if inside WordPress user administration pages. |
640 * @return bool True if inside WordPress user administration pages. |
632 */ |
641 */ |
633 function is_user_admin() { |
642 function is_user_admin() { |
634 if ( defined( 'WP_USER_ADMIN' ) ) |
643 if ( isset( $GLOBALS['current_screen'] ) ) |
|
644 return $GLOBALS['current_screen']->in_admin( 'user' ); |
|
645 elseif ( defined( 'WP_USER_ADMIN' ) ) |
635 return WP_USER_ADMIN; |
646 return WP_USER_ADMIN; |
|
647 |
636 return false; |
648 return false; |
637 } |
649 } |
638 |
650 |
639 /** |
651 /** |
640 * Whether Multisite support is enabled |
652 * Whether Multisite support is enabled |