Make WordPress Core

Opened 7 weeks ago

Last modified 3 weeks ago

#61103 assigned defect (bug)

update all update_option calling in core to set the autoload option

Reported by: pbearne's profile pbearne Owned by: pbearne's profile pbearne
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: performance Cc:

Description

Let's be set the autoload option so it is clear what is autoloadered
Let's not auto load option only needed in WP-admin or very often to reduce the number always loaded

Change History (13)

#1 @pbearne
7 weeks ago

  • Owner set to pbearne
  • Status changed from new to assigned

This ticket was mentioned in PR #6465 on WordPress/wordpress-develop by @pbearne.


7 weeks ago
#2

  • Keywords has-patch added

This ticket was mentioned in Slack in #core-performance by pbearne. View the logs.


7 weeks ago

#4 @joemcgill
6 weeks ago

  • Focuses performance added

Adding the performance keyword for visibility.

This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.


6 weeks ago

This ticket was mentioned in Slack in #core-performance by pbearne. View the logs.


4 weeks ago

#7 @swissspidy
4 weeks ago

Why is this needed? Aren't the autoload flags for all these options already set correctly by default anyway? Is there a concern that the flag somehow changes so we have to fix it again?

#8 @pbearne
4 weeks ago

I feel it good practice to set the default to make clear that choice was made

And I feel that some should not be autoload eg admin email and maybe widgets

@pbearne commented on PR #6465:


4 weeks ago
#9

I have replaced the on/off with booleans

As I have gone through these I have set any option that looks like it is wp-admin only to not autoload this should help the front-end load a little bit

#10 @pbearne
3 weeks ago

I thought it might help to list the options I propose, not to autoload, that are currently not unset in core.

update_option( 'auto_plugin_theme_update_emails', $past_failure_emails, false );
update_option( 'recently_activated', $recently_activated, false );
update_option( '_wp_suggested_policy_text_has_changed', $state, false );
update_option( $lock_option, time(), false );
update_option( 'dashboard_widget_options', $widget_options, false );
update_option( 'ftp_credentials', $stored_credentials, false );
update_option( 'recently_edited', $oldfiles, false );
update_option( 'adminhash', $new_admin_email, false );
update_option( 'nav_menu_options', $nav_menu_option, false );
update_option( 'active_plugins', $current, false );
update_option( 'uninstall_plugins', $uninstallable_plugins, false );
update_option( 'wp_force_deactivated_plugins', array(), false );
update_option( 'delete_blog_hash', $hash, false );
update_option( 'allowedthemes', $allowed_themes, false );
update_option( 'admin_email', $new_admin_detailsnewemail?, false );
update_option( 'recently_activated', $recent, false );
update_option( 'https_detection_errors', $support_errors->errors, false );
update_option( 'fresh_site', '0', false );
update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files", false );
update_option( 'admin_email', , false );
update_option( 'admin_email_lifespan', time() + $remind_interval, false );

src/wp-includes/class-wp-paused-extensions-storage.php
return update_option( $option_name, $paused_extensions, false );

src/wp-includes/class-wp-recovery-mode-key-service.php
return update_option( $this->option_name, $keys, false );

this is one that we may not want to set false
update_option( 'widget_' . $id_base, $widget, false );

Please review this list and comment if any of these need to be autoload (as needed by the front-end)
I hope we can get this change in, as this will free some memory.

#11 @swissspidy
3 weeks ago

I feel it good practice to set the default to make clear that choice was made

I thought it might help to list the options I propose, not to autoload, that are currently not unset in core.

Can we achieve this with a one time database migration instead of (or in addition to) changing all update_option calls.

#12 @pbearne
3 weeks ago

Not all of them can be done, as some are dynamic
But we could do most of them

I will work on the SQL/ update function to do this


#13 @pbearne
3 weeks ago

I have added an upgrade
I am not sure how to set the db version


Note: See TracTickets for help on using tickets.