-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add --force
flag to wp plugin list
and wp theme list
#183
Comments
Thanks for the suggestion, @baizmandesign ! Both Maybe that's not working on your system for some reason? |
@danielbachhuber Thanks for your reply! After reading the code at the link you provided, it appears to call
Notably, there's no argument for an expiration (which would have been the third parameter). This would seem to indicate there is no expiration, but in practice, in my experience, the transient gets refreshed every so often (I'm uncertain how often). The way that I've even been able to observe this behavior is because I'm running my own WordPress plugin and theme update server. It's possible that my code has an error in it. The only way to reproduce this issue, and confirm this is indeed occurring, is to have your own update server. Or perhaps, if one had a plugin or theme on the WordPress repository, to 1) list your plugins (or themes), 2) update the asset on the WordPress repository, and 3) the list your plugins (or themes) again. If I'm right, WordPress won't immediately see the newly available version. At this point, I feel as if I'm claiming there's a problem and offering a solution, and you're saying there's no problem. We don't have a good way to reproduce the "issue" I've raised. How do we proceed? |
Oh, I see. I assumed Today I learned!
When writing tests, you can write a test value to the |
@danielbachhuber I like the idea of adding a When this is implemented, can I simply configure my
Will this work? |
@baizmandesign Yep, it should work as you describe. |
@danielbachhuber Good news: I've updated the relevant code in the extension-command repository. It was trivial. (View the WIP here.) Less good news: I'm uncertain how to proceed with the testing portion. (Yes, I read the relevant portion of the handbook.) When I run How do I test this new functionality against an empty database? Also, do I need to update the Behat files or write unit tests for PHPUnit or both? I'm a bit out of my depth here. Any guidance would be appreciated. Here are the Behat files that I think need to be updated:
(Note, the |
@baizmandesign Not necessarily, no. It just sets up an empty database. The tables are created and destroyed for each test.
You'll want to update the Behat files. If the written tutorial doesn't quite click, want to watch this hack day video? wp-cli/wp-cli#5858
|
@danielbachhuber Thanks for the link to the video. I watched it, and it was helpful. More helpful was reading the tests in some of the other What I was really unclear about, and did not articulate, was the contents of the database and the presence of plugins and themes in the test WordPress installation. (That's why I was initially confused about the creation of an empty database.) After writing some tests that intentionally failed, I was able to see the output of the My next question is about your earlier suggestion:
It turns out that one can't simply set the value of the update_plugins transient to any value. When I set it to "test_value" and run Here's the serialized array in the database:
How do I set a transient value to an array? I've been using |
@baizmandesign You can simply write the value directly to the database using a PHP script. Here's one such example: |
@danielbachhuber This is exactly what I needed. Thanks! |
@danielbachhuber I've attempted to create a test that writes a fake value to the database, and I've failed. At this point, I've spent several hours on this task and am ready to give up. Here is the problem. In my Behat test, every time I call You can view my WIP. The file with the relevant tests is My first approach entailed getting the plugin transient value for a specific plugin, manually setting it to a fake version number, and then saving the transient back to the database. That's what's happening in My second approach took inspiration from plugin.feature. I tried to create a must-use plugin in (At the moment, some of the tests are written to fail so that I can examine the output more closely. For example, running I don't like giving up, but without serious guidance, I'm done. |
@baizmandesign I appreciate your effort! Can you put your work into a pull request and then I'll see if I can figure it out? |
All set, @danielbachhuber! I'm sorry I wasn't able to complete creating the tests. If there's anything else I can do, please let me know. WP CLI is an incredibly valuable tool and very important to me! |
Hi! Here's a proposal to add a new option to
wp plugin list
andwp theme list
:--force
.Why am I proposing this option? Because when I list plugins or themes, WP CLI first checks the "_site_transient_update_{type}s" transient in the options database. (This transient seems to get updated on an occasional basis, but I'm uncertain of its refresh interval.) This often leads to misleading information when checking for available plugin and theme updates. The idea behind
--force
would delete the transient, forcing the system to fetch the latest version information before displaying it.Example usage:
The name
--force
may not be the most appropriate choice as it doesn't fully explain what the command is doing and why it's needed. Maybe--force-update
or--refresh
might work better?If this gets approved, I could take a crack at authoring it.
The text was updated successfully, but these errors were encountered: