Opened 11 years ago
Closed 10 years ago
#26604 closed enhancement (fixed)
remove dead code (and unused options?) from dashboard.php after 3.8
Reported by: | kitchin | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Administration | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
The option 'dashboard_widget_options' is unused by core now. Would be nice to delete its unused core keys: 'dashboard_recent_comments', 'dashboard_incoming_links', 'dashboard_primary', 'dashboard_secondary'. Why? Because it's super annoying to do a MySQL search when migrating a site and find your old url in the options table. :)
The option 'dashboard_widget_options' is still needed for plugins that put RSS feeds on the Dashboard though, see below.
Here's a quick survey of the functions in wp-admin/includes/dashboard.php. Maybe there's more dead or deprecatable code I missed:
function wp_dashboard_setup:
- These lines are dead code:
21 $update = false; 22 $widget_options = get_option( 'dashboard_widget_options' ); 23 if ( !$widget_options || !is_array($widget_options) ) 24 $widget_options = array();
86 if ( $update ) 87 update_option( 'dashboard_widget_options', $widget_options );
function wp_add_dashboard_widget:
function _wp_dashboard_control_callback:
function wp_dashboard:
function wp_dashboard_right_now:
function wp_network_dashboard_right_now:
function wp_dashboard_quick_press:
function wp_dashboard_recent_drafts:
function _wp_dashboard_recent_comments_row:
function wp_dashboard_site_activity:
function wp_dashboard_recent_posts:
function wp_dashboard_recent_comments:
function wp_dashboard_rss_output:
- Unused in core. Plugins may use it to display RSS feeds.
function wp_dashboard_cached_rss_widget:
function wp_dashboard_trigger_widget_control:
- Maybe unused in core? Plugins need it to work for a widgets with a form for 'number'. The core widgets all post to post.php. Nothing has a 'widget_id' $_POST field.
function wp_dashboard_rss_control:
- Unused in core. Plugins may use it to mod display of RSS feeds. Does update_option('dashboard_widget_options',) for two fields: 'number' from $_POST, and 'title' from fetch_feed().
- Note this is the only place in core that can update 'dashboard_widget_options'.
function wp_dashboard_primary:
function wp_dashboard_primary_output:
function wp_dashboard_plugins_output:
function wp_dashboard_quota:
function wp_dashboard_browser_nag:
function dashboard_browser_nag_class:
function wp_check_browser_version:
function wp_dashboard_empty:
- A no-op function {}. Unused in core. It's so js/ajax plugins have a string compatible with call_user_func() ?
function wp_welcome_panel:
I can make a patch for the dead code removal. Not sure about the option key deprecation, maybe it's been done before?
These dashboard_incoming_links bugs can be closed now, so I'll comment on them: #21225, #20379.
Correction:
function wp_dashboard_trigger_widget_control: