First pass -- VaultPress deactivation if Rewind is running.#8378
First pass -- VaultPress deactivation if Rewind is running.#8378dereksmart merged 6 commits intomasterfrom
Conversation
class.jetpack.php
Outdated
There was a problem hiding this comment.
any thoughts on an early-abort-over-nested pattern, even though we can't avoid some nesting here?
if ( false !== $rewind_enabled ) {
return $rewind_enabled;
}
jetpack_require_lib( … )
…
set_transient( … )
return $rewind_enabled;anyway no big deal just noticed this and how the "main code" was nested
There was a problem hiding this comment.
Eh, I'm not huge on it either way, this is just how I'd always structured transient checks in the past. I'm not emotionally invested either direction.
class.jetpack.php
Outdated
There was a problem hiding this comment.
this is the topic of the conversation 😄
I think that you are checking the right values here, but we have overlap in terms between the Rewind system and Jetpack itself, so this is the content of the review
this code is checking if a site has "anything to do with Rewind" including that it could have Rewind activated but it's missing the necessary plan.
this does not verify that Rewind is actively backing up and protecting a site, which is probably okay for the purposes we are wanting - know whether or not to prompt to deactivate VaultPress (because if it's missing the plan then VaultPress is probably also missing the plan and if it should be backing up but isn't it's likely due to some external problem)
There was a problem hiding this comment.
@dmsnell what do you think about setting a transient/option with the response from the /rewind endpoint that we're using for the UI?
There was a problem hiding this comment.
We could also have it return a different string 'available' or 'enabled' based on its status and test against those.
I don't care which, but we need to decide the conditions for it appearing.
There was a problem hiding this comment.
So, in EITHER case we don't want VaultPress active, because they should be using rewind. So the original code is GTG on that front
There was a problem hiding this comment.
Yeah, the /rewind endpoint we're getting in that link above includes a response that we're using to determine it. I think it's the way to go.
array(
'reason' => 'host_not_supported',
'state' => 'active', // Can also be 'available' or 'unavailable'
'downloads' => array(),
'last_updated' => 1513366050
);
There was a problem hiding this comment.
'state' => 'active', // Can also be 'available' or 'unavailable'
^^^ we will want to make sure we stick to the actively confusing definitions because our terms overlap with different meanings - p9rlnk-1r-p2
what do you think about setting a transient/option with the response
it's probably about time we look at latency and performance issues and address it appropriately. I doubt putting it in the API call is better than putting it in get_status() and trusted_get_status() but I don't know if you are talking about a transient on the Jetpack side
I may (probably will) need to revisit where in the `$features` array I'm checking to see if Rewind is enabled.
829399e to
16f64f3
Compare
…ining status of Rewind
| 'plugin' => $plugin_file, | ||
| ); | ||
| $deactivate_url = wp_nonce_url( add_query_arg( $query_args, admin_url( 'plugins.php' ) ), "deactivate-plugin_{$plugin_file}" ); | ||
| deactivate_plugins( $plugin_file ); |
There was a problem hiding this comment.
"Murder most foul…" -- Shakespeare, Hamlet, Act 1 Scene V
Restarting job now -- could have just been cranky? |
dereksmart
left a comment
There was a problem hiding this comment.
Made some changes, works well for me
|
Are we okay with it only being deactivated off of |
@georgestephanis I agree! |
* First pass -- VaultPress deactivation if Rewind is running. I may (probably will) need to revisit where in the `$features` array I'm checking to see if Rewind is enabled. * Add the file to the included list for 3rd-party * Retool to new method to check for Rewind availability. * Update is_rewind_enabled() method to read the correct data for determining status of Rewind * VaultPress Murder * faulty logic
| deactivate_plugins( $plugin_file ); | ||
| ?> | ||
| <div class="notice notice-success"> | ||
| <h2 style="margin-bottom: 0.25em;"><?php _e( 'Jetpack is now handling your backups.', 'jetpack' ); ?></h2> |
There was a problem hiding this comment.
The headline "Jetpack is now handling your backups" is not necessarily true if Rewind is available but inactive.
It sounds like (in the other thread) there is consensus that we want VaultPress disabled if Rewind is available, even if isn't active, so I don't want to tell users we're handling their backups if it's possible we're not. :)
There was a problem hiding this comment.
This message should only show if Rewind is actually configured, but we will confirm that in testing leading up to our wide launch.
I may (probably will) need to revisit where in the
$featuresarray I'm checking to see if Rewind is enabled.WIP.