wp-cli activation broken
-
Since 6.0 update wp cli activation is broken.
rsssl_user_can_manage() returns false so activation function is exited right in the beginning. What is also bad is the fact that activation function return value is not checked, so we see a success message in wp cli ( ‘SSL activated’ ) in any way, no matter what really happened.
-
Hi @oolongm,
Thanks for reporting the issue. I have created a fix for this here:
https://github.com/Really-Simple-Plugins/really-simple-ssl/tree/wpcli
It also includes your suggestion for feedback on SSL activation failure.
Let me know if this resolves the issue for you.
Thanks for this super fast reply! I’ll try it soon, next time I’ll setup some new sites. But the code looks like it should solve the problem.
Hi @rogierlankhorst,
I just tested your code, unfortunately it doesn’t work yet.
It also includes your suggestion for feedback on SSL activation failure.
This part basically works, however you return the error instead of success state. You probably meant to write !$error here: https://github.com/Really-Simple-Plugins/really-simple-ssl/blob/master/class-admin.php#L387
With this line changed the cli action completes and outputs the success message, however in the wp backend the ssl activation state is still deactivated afterwards. I’m afraid you will actually have to run this code to see what’s going on – or what is not π
I also noticed another bug: The plugin localization doesn’t respect the user language, but only the wp core language. So for example if I have a french wp site, but my wp user has en_US as language, because my french is poor, then the backend is all english besides RSSSL UI what is still in french.
@oolongm thanks for checking, I see the problem, I overlooked the ‘rsssl_update_option()’ function, which limits access using the rsssl_user_can_manage() function. I’ve now moved the WP_CLI check to this function, which allows the activation to go through. This should now work as expected:
https://github.com/Really-Simple-Plugins/really-simple-ssl/tree/wp-cli-%3D-capability-check-extended
The language issue should already be resolved in the current main. The plugin switched to the core wpFetch method, which has such checks built int. I just checked this, and the use language changed for me.
I can confirm the language issue is gone in the latest version.
The cli activation however still doesn’t work. You really don’t have a system where you could test it?
PHP Fatal error: Uncaught Error: Call to undefined function rsssl_uses_htaccess() in /public_html/wp-content/plugins/really-simple-ssl/settings/config/disable-fields-filter.php:10
Stack trace:
#0 /public_html/wp-includes/class-wp-hook.php(308): rsssl_remove_fields(Array)
#1 /public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#2 /public_html/wp-content/plugins/really-simple-ssl/settings/config/config.php(1109): apply_filters(‘rsssl_fields’, Array)
#3 /public_html/wp-content/plugins/really-simple-ssl/settings/settings.php(536): rsssl_fields(false)
#4 /public_html/wp-content/plugins/really-simple-ssl/class-admin.php(356): rsssl_update_option(‘redirect’, ‘wp_redirect’)
#5 in /public_html/wp-content/plugins/really-simple-ssl/settings/config/disable-fields-filter.php on line 10-
This reply was modified 3 years, 5 months ago by
oolongm.
Ok, thanks for checking. Iβll set it up tomorrow.
-
This reply was modified 3 years, 5 months ago by
Rogier Lankhorst.
@oolongm You’re right, should have done this right away. I installed wp cli locally, and successfully ran an ssl_activation on the test server, so this should now be resolved for you as well. An additional file needed to be included for this to work.
https://github.com/Really-Simple-Plugins/really-simple-ssl/tree/wp-cli-capability-check-extended
Thanks for pointing the issue out to me!
One month and one major release later:
wp-cli.phar rsssl activate_ssl
Error: SSL activation failedJust this time without any debug/error messages.
-
This reply was modified 3 years, 4 months ago by
oolongm.
@oolongm I’m very sorry to hear this still doesn’t work. I did successfully test the activation with wp cli, but I think I have found the difference: we always test with the actual site open, which sets the ‘site_has_ssl’ option if a site has SSL.
For the full explanation of what I think has happened, please see my response here: https://ww.wp.xz.cn/support/topic/wp-cli-activation-broken-2/#post-16379288
I hope this resolves the issue with wp-cli, I can’t find any other issues at the moment.
This is added to the test queue again, and will get tested by a different tester as well, with the above in mind.
-
This reply was modified 3 years, 4 months ago by
Rogier Lankhorst.
Thank you @rogierlankhorst, issue seems to be gone now π
@oolongm thanks for your adjusted review π!
Your other request regarding the notices was a simple addition which I’ve added in the current master. I’ve added a generic option which allows you to set options in Really Simple SSL using wp cli.
To dismiss all notices, you can use:
rsssl update_option dismiss_all_notices trueBut you can use it to update any option in the plugin this way, which seems a nice addition anyway.
This will be included in the update next week.
I’ve changed the command pattern a bit, as this seems more intuitive, and also allows for multiple option updates in one line:
rsssl update_option --dismiss_all_notices=trueIβve changed the command pattern a bit, as this seems more intuitive, and also allows for multiple option updates in one line:
rsssl update_option --dismiss_all_notices=trueThank you so much for adding this, however it doesn’t seem to have any affect for me on the popup that comes after first login and the notices that show up. Is it supposed to let this all disappear?
This will be included in the update next week.
I just tested the latest release (6.1.1) and it seems like there is a regression for the ssl activation. It still says “Success: SSL activated successfully” in the console, however in the wp backend it says “ssl not activated” :/
Now the new thing is that if I run the activation command a second time, it seems to work. Also if after the first (failed) attempt, I uninstall the plugin with the option “Delete all data on plugin deletion” activated – and then I try the whole process again it seems to work on the first attempt.
Any ideas about this?
the dismiss notices setting does not dismiss the modal. That can be controlled with a regular wordpress option update:
wp option update rsssl_onboarding_dismissed trueI didn’t post the correct command here, please try:
rsssl update_option --dismiss_all_notices=1We’ve tested extensively on several setups, but I’ll check what your tested and see if we can find anything.
@oolongm after repeated testing, we noticed that this can unexpectedly happen. Running activation twice always seems to work, which can be used as a workaround until it’s fixed.
-
This reply was modified 3 years, 5 months ago by
The topic ‘wp-cli activation broken’ is closed to new replies.