[wp-trac] [WordPress Trac] #17979: Avoid losing widgets when switching themes

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 27 20:45:48 UTC 2011


#17979: Avoid losing widgets when switching themes
-------------------------------------+------------------
 Reporter:  lancewillett             |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  high                     |   Milestone:  3.3
Component:  Widgets                  |     Version:  2.9
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------

Comment (by SergeyBiryukov):

 Replying to [comment:100 westi]:
 > Why don't we move this code to only run at db upgrade time if needed -
 that way old old installs that upgrade still get fixed by it doesn't have
 to run the rest of the time.

 [attachment:17979.14.diff] is an attempt to do this with a bit of cleanup
 as well:

 * Moves the old `sidebars_widgets` array upgrade code to `wp-
 admin/includes/upgrade.php`.
 * The upgrade code didn't change since 2.8.1, so I compare
 `$wp_current_db_version` to 11548.
 * Contains the refreshed patch from #18598 to prevent an infinite loop.
 * Removes two unneeded `wp_get_sidebars_widgets()` calls, as suggested by
 lancewillett.
 * Removes unused `$wp_registered_sidebars` variable from
 `wp_get_sidebars_widgets()`.
 * Combines a couple of `!empty( $sidebars_widgets )` checks in
 `retrieve_widgets()`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17979#comment:102>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list