WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#15361 closed defect (bug) (duplicate)

wp_start_object_cache() should be called within blog switching methods instead of wp_cache_init()

Reported by: prettyboymp Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Cache API Keywords:
Focuses: Cc:

Description

The switch_to_blog() and restore_current_blog() functions call wp_cache_init() directly, which causes the object cache instance to be recreated. These methods should instead be calling the wp_start_object_cache() method which correctly checks whether wp_cache_init() or wp_cache_reset() should be used.

Attachments (1)

16258.diff (682 bytes) - added by prettyboymp 9 years ago.

Download all attachments as: .zip

Change History (15)

@prettyboymp
9 years ago

#1 @scribu
9 years ago

Related: #14992

#2 @scribu
9 years ago

  • Component changed from General to Cache

#3 @prettyboymp
9 years ago

  • Cc mpretty@… added

#4 @nacin
9 years ago

  • Milestone changed from Awaiting Review to 3.1

#5 @scribu
9 years ago

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

(In [16359]) Use wp_start_object_cache() in switch_to_blog(). Props prettyboymp. Fixes #15361

#6 @scribu
9 years ago

  • Summary changed from w_start_object_cache() should be called within blog switching methods instead of wp_cache_init() to wp_start_object_cache() should be called within blog switching methods instead of wp_cache_init()

#7 @ryan
9 years ago

We don't really need to re-add global and non-persistent groups or do those file and function exists checks. Maybe switch_to_blog() should directly call wp_cache_reset() if it exists otherwise do wp_cache_init().

#8 @nacin
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#9 @Denis-de-Bernardy
9 years ago

Suggesting we revert the changeset, for this reason:

http://core.trac.wordpress.org/ticket/14992#comment:7

#10 @ryan
9 years ago

(In [16597]) Revert [16359]. Deal with it in 3.2. see #15361

#11 @ryan
9 years ago

  • Milestone changed from 3.1 to Future Release

#12 @simonwheatley
9 years ago

  • Cc simon@… added

#13 @willmot
9 years ago

  • Cc willmot added

#14 @nacin
7 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

I think this is mostly handled now by #21434.

Note: See TracTickets for help on using tickets.