Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

61103 add default autoload core #6465

Open
wants to merge 17 commits into
base: trunk
Choose a base branch
from

Conversation

pbearne
Copy link

@pbearne pbearne commented Apr 30, 2024

paul bearne added 5 commits April 19, 2024 17:36
Updated values of 'autoload' option from 'yes' or 'no' to 'on' or 'off' respectively, across several PHP files. This change was implemented in the functions handling options and lock settings, enhancing clarity and consistency of the code.
The commit modifies the 'can_compress_scripts' options in the ajax-actions.php file. The update_site_option and update_option functions now have a third argument which controls whether the setting is on or off. This enhances flexibility and control over the script compression feature.
The commit adjusts the parameters for 'update_option' functions in 'featured-content.php' and 'ajax-actions.php'. It changes the 'autoload' parameter where necessary, updating the values for "featured-content" and "can_compress_scripts" options. It's done to ensure the correct use of the autoloading feature in WordPress functionality.
This commit adds a third argument to the update_option() function calls across a large number of scripts. This argument toggles whether the option should be loaded from cache (on) or not (off). The changes made help to better manage data caching in WordPress and potentially improve performance by avoiding unnecessary database queries.
This commit adds a third argument to the update_option() function calls across a large number of scripts. This argument toggles whether the option should be loaded from cache (on) or not (off). The changes made help to better manage data caching in WordPress and potentially improve performance by avoiding unnecessary database queries.
Copy link

github-actions bot commented Apr 30, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @paul.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props pbearne, mukesh27, adamsilverstein, swissspidy, joemcgill.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@joemcgill joemcgill self-requested a review April 30, 2024 18:57
@@ -231,15 +231,15 @@ function wp_ajax_wp_compression_test() {
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 );
} else {
update_option( 'can_compress_scripts', 0, 'yes' );
update_option( 'can_compress_scripts', 0, 'on' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update_option accepts 'yes' or 'no' or true/false. Why does this PR use 'on' and 'off'?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not exactly correct. "on" and "off" are the stored DB values, but the function should use boolean true/false values. For backwards compat, we still support "yes" and "no".

pbearne and others added 3 commits May 22, 2024 09:16
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Updated several calls to the update_option function throughout the codebase to use boolean values for autoload parameter instead of 'off'/'on' strings. This change improves the consistency and readability of the related database entries.
@pbearne
Copy link
Author

pbearne commented May 22, 2024

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

paul bearne and others added 8 commits May 24, 2024 14:25
Updated several calls to the update_option function throughout the codebase to use boolean values for autoload parameter instead of 'off'/'on' strings. This change improves the consistency and readability of the related database entries.
Updated the WordPress database version in `version.php` and performed changes in `upgrade.php` to reflect this. Introduced a new function `upgrade_670()` to execute changes made in WordPress version 6.7.0. Additionally, adjusted the indentation in numerous lines for code readability and consistency.
A new function named 'valid_transient' has been introduced to verify if a transient and its value are valid, also by checking if they have not expired. Sites with transient data can use the 'valid_site_transient' function to perform similar checks. Along with these functions, PHPUnit test cases have been added to ensure these functions perform as expected.
A new function, wp_prime_wp_admin_option_caches, has been created to prime specific network options for the current network into the cache using a single database query. Additionally, the action 'admin_init' has been added to autoload these admin options. This should lead to improved performance by reducing the number of database queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants