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

autoload-options-size check should include autoloaded transients #150

Open
2 tasks done
lkraav opened this issue Mar 20, 2020 · 2 comments
Open
2 tasks done

autoload-options-size check should include autoloaded transients #150

lkraav opened this issue Mar 20, 2020 · 2 comments

Comments

@lkraav
Copy link

lkraav commented Mar 20, 2020

Bug Report

Describe the current, buggy behavior

wp doctor check autoload-options-size - 650 kB

SELECT 'Autoload kiB' as name, ROUND(SUM(LENGTH(option_value)) / 1024) as value FROM wp_options WHERE autoload='yes' - 2.4 MB

Difference is in counting _transient_* options.

https://codex.wordpress.org/Function_Reference/set_transient#Notes points out "NB: transients that never expire are autoloaded, whereas transients with an expiration time are not autoloaded. Consider this when adding transients that may not be needed on every page, and thus do not need to be autoloaded, impacting page performance."

Describe what you would expect as the correct outcome

wp doctor check autoload-options-size should count unexpirable transients.

Let us know what environment you are running this on

convers@pill2 ~/www/institute]# wp cli info
OS:     Linux 2.6.32-754.17.1.el6.x86_64 #1 SMP Tue Jul 2 12:42:48 UTC 2019 x86_64
Shell:  /bin/bash
PHP binary:     /opt/cpanel/ea-php73/root/usr/bin/php
PHP version:    7.3.15
php.ini used:   /opt/cpanel/ea-php73/root/etc/php.ini
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/convers/public_html/institute
WP-CLI packages dir:    /home/convers/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0

Reading https://github.com/wp-cli/doctor-command/pull/15/files by @danielbachhuber I'm now thinking this may be an issue for wp option command instead. Your thoughts?

@swissspidy
Copy link
Member

wp option list ignores transients by default, but they can be included with the --transients argument. It doesn't have an option to include both options and transients though, so the easiest way to solve this is by running two commands here in wp doctor check autoload-options-size:

  • wp option list --autoload=on
  • wp option list --transients --autoload=one

Then simply add the numbers together.

@danielbachhuber
Copy link
Member

Transients are conceptually separate from options, even though they're stored in the same location, so I think this would be better implemented as a new transients-size check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants