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

Add option to keep AMP data upon uninstalling of plugin #6632

Merged
merged 7 commits into from
Oct 6, 2021

Conversation

dhaval-parekh
Copy link
Collaborator

@dhaval-parekh dhaval-parekh commented Oct 3, 2021

Summary

Fixes #6486

image


image


image

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@dhaval-parekh dhaval-parekh self-assigned this Oct 4, 2021
@dhaval-parekh dhaval-parekh requested review from delawski and pierlon and removed request for delawski October 4, 2021 14:36
@dhaval-parekh dhaval-parekh marked this pull request as ready for review October 4, 2021 14:37
@dhaval-parekh dhaval-parekh requested a review from delawski October 4, 2021 14:37
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2021

Plugin builds for c28a210 are ready 🛎️!

@codecov
Copy link

codecov bot commented Oct 4, 2021

Codecov Report

Merging #6632 (c28a210) into develop (012eeb1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #6632      +/-   ##
=============================================
+ Coverage      76.60%   76.62%   +0.01%     
- Complexity      6311     6312       +1     
=============================================
  Files            248      248              
  Lines          19788    19799      +11     
=============================================
+ Hits           15159    15170      +11     
  Misses          4629     4629              
Flag Coverage Δ
javascript 79.06% <ø> (ø)
php 76.51% <100.00%> (+0.01%) ⬆️
unit 76.51% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
amp.php 0.00% <ø> (ø)
includes/amp-helper-functions.php 84.64% <100.00%> (+0.12%) ⬆️
includes/options/class-amp-options-manager.php 91.79% <100.00%> (+0.08%) ⬆️
includes/uninstall-functions.php 95.83% <100.00%> (+0.24%) ⬆️
src/OptionsRESTController.php 59.34% <100.00%> (ø)

delete_posts();
delete_terms();
delete_transients();
$keep_amp_data = \AMP_Options_Manager::get_option( Option::KEEP_AMP_DATA );
Copy link
Member

Choose a reason for hiding this comment

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

Humm, did you test this on an actual site? The AMP_Options_Manager class is not loaded at uninstallation so this causes a fatal error:

image

(Perhaps the plugin's autoloader should get initialized during uninstallation.)

@westonruter westonruter added this to the v2.2 milestone Oct 5, 2021
Copy link
Collaborator

@delawski delawski left a comment

Choose a reason for hiding this comment

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

Frontend-wise the code looks good to me.

@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: AMP
* Description: An easier path to great Page Experience for everyone. Powered by AMP.
* Description: An easier path to great Page Experience for everyone. Powered by AMP. <em class="amp-deletion-notice"><strong>Uninstall Note:</strong> To control whether all data from this plugin is deleted at uninstallation, first activate the plugin, go to the Other section on the Settings screen, and set the “Delete plugin data at uninstall” toggle.</em>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if the install note should be on a separate line for better visibility 🤔

Suggested change
* Description: An easier path to great Page Experience for everyone. Powered by AMP. <em class="amp-deletion-notice"><strong>Uninstall Note:</strong> To control whether all data from this plugin is deleted at uninstallation, first activate the plugin, go to the Other section on the Settings screen, and set the “Delete plugin data at uninstall” toggle.</em>
* Description: An easier path to great Page Experience for everyone. Powered by AMP. <br><em class="amp-deletion-notice"><strong>Uninstall Note:</strong> To control whether all data from this plugin is deleted at uninstallation, first activate the plugin, go to the Other section on the Settings screen, and set the “Delete plugin data at uninstall” toggle.</em>
Before After
image image

Copy link
Member

Choose a reason for hiding this comment

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

Ideally, yes. Unfortunately, the br tag is not allowed. Only abbr, acronym, code, em, strong, and a are allowed: https://github.com/WordPress/wordpress-develop/blob/ed9f437fc098ba2c9ba18eda0fa341ecd0476ca9/src/wp-admin/includes/plugin.php#L173-L186

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, unfortunate indeed.

Co-authored-by: Pierre Gordon <[email protected]>
@westonruter westonruter enabled auto-merge October 6, 2021 21:36
@westonruter westonruter merged commit ed154fd into develop Oct 6, 2021
@westonruter westonruter deleted the enhancement/6486-ui-for-data-removal branch October 6, 2021 22:20
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding UI setting for data removal upon uninstall
4 participants