WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#13773 closed defect (bug) (fixed)

Warning and wrong blog prefix in get_most_active_blogs() and get_blog_list()

Reported by: ocean90 Owned by:
Milestone: 3.0 Priority: high
Severity: normal Version: 3.0
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

  1. In get_blog_list() and get_most_active_blogs() you get a warning:
    Notice: Undefined index: time in \wp-includes\ms-blogs.php on line 548
    

The reason is, $blogstime? will be never set and/or saved. The best would be here to use the Transient API, see the patches.

  1. A regression: The main site doesn't have a wp_1_posts table anymore, it has wp_posts. Because of that get_blog_list() returns 0 posts for the main site. We should use $wpdb->get_blog_prefix($id) to avoid it.

Attachments (4)

get_most_active_blogs.patch (956 bytes) - added by ocean90 8 years ago.
get_blog_list.patch (1.4 KB) - added by ocean90 8 years ago.
deprecate.patch (3.9 KB) - added by ocean90 8 years ago.
deprecate these functions
for_frumph.patch (2.5 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (11)

#1 @ryan
8 years ago

That list could exceed the typical memcached object size limit. I'm not sure a transient will work here.

#2 @ryan
8 years ago

The only thing I see calling this is get_most_active_blogs(). I don't see anywhere that calls get_most_active_blogs(). How are you triggering this? The kindest thing we can do to those functions is kill them entirely. :-)

#3 @ryan
8 years ago

wpmu-admin.php used to call get_most_active_blogs() but no longer does.

#4 @ryan
8 years ago

I suggest stubbing these out and moving to ms-deprecated.php. Those queries are suicidal.

@ocean90
8 years ago

deprecate these functions

#5 @ryan
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15168]) Deprecate get_most_active_blogs() and get_blog_list(). Props ocean90. fixes #13773

#6 @ryan
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

These are actually used by some, so lets restore them but leave deprecated.

@ocean90
8 years ago

#7 @ryan
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [15170]) Resurrect get_blog_list() and get_most_active_blogs() but leave deprecated. Props ocean90. fixes #13773

Note: See TracTickets for help on using tickets.