WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#5457 closed defect (bug) (fixed)

deleting a nested page from Manage => Pages causes query inconsistency

Reported by: hailin Owned by: hailin
Milestone: 2.5 Priority: high
Severity: major Version: 2.5
Component: General Keywords:
Focuses: Cc:
PR Number:

Description (last modified by westi)

Given the following pages:

ID  Title        post_parent
4   sunpage     0 
5   -moonpage   4
6   --starpage  5
7  rainpage     0 

if we remove moonpage, and do page refresh, starpage is not displayed.
The root cause is that, after removing moonpage, the internal db state and cache may be out of sync. ie, querying phpmyadmin reveals the starpage has post_parent=4; yet
print_r(pages) within page_rows() reveals starpage has post_parent=5.

This can cause all sorts of perplexing problems if not fixed.

Attachments (2)

5457_clean_cache.diff (1.1 KB) - added by hailin 12 years ago.
patch
5457_clean_cache_2.diff (666 bytes) - added by hailin 12 years ago.
additional patch to clean the cache of the orphaned pages

Download all attachments as: .zip

Change History (9)

#1 @westi
12 years ago

  • Description modified (diff)

#2 @lloydbudd
12 years ago

  • Milestone changed from 2.5 to 2.4
  • Version set to 2.4

#3 @ryan
12 years ago

In wp_delete_post() where we update children of the deleted page to point to the parent, we need to get the IDs of all affected pages and do a clean_page_cache() for each.

@hailin
12 years ago

patch

#4 @hailin
12 years ago

  • Owner changed from anonymous to hailin
  • Status changed from new to assigned

Fixed and tested on both wporg and wpcom.

The problem can actually be quite purplexing to users, as sometimes child page is displayed correctly; Yet after refreshing the page, it is displayed incorrectly. Then refresh again, it is correct/incorrect again....

#5 @ryan
12 years ago

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

(In [6382]) clean page cache when reparenting pages after deletion. Props hailin. fixes #5457

#6 @hailin
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

@hailin
12 years ago

additional patch to clean the cache of the orphaned pages

#7 @ryan
12 years ago

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

(In [6403]) Clean cache for orphaned pages. Props hailin. fixes #5457

Note: See TracTickets for help on using tickets.