Skip to content

Commit

Permalink
Merge pull request #1435 from xwp/fix/remove-uninstallation
Browse files Browse the repository at this point in the history
Remove plugin uninstallation flow
  • Loading branch information
kasparsd authored Apr 25, 2023
2 parents ea4a1fa + c6c0486 commit 61a5ab9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 285 deletions.
20 changes: 0 additions & 20 deletions classes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ public function __construct( $plugin ) {
)
);

/**
* Uninstall Streams and Deactivate plugin.
*
* @todo Confirm if variable assignment is necessary.
*/
$uninstall = $this->plugin->db->driver->purge_storage( $this->plugin );

// Auto purge setup.
add_action( 'wp_loaded', array( $this, 'purge_schedule_setup' ) );
add_action(
Expand Down Expand Up @@ -472,7 +465,6 @@ public function admin_enqueue_scripts( $hook ) {
'i18n' => array(
'confirm_purge' => esc_html__( 'Are you sure you want to delete all Stream activity records from the database? This cannot be undone.', 'stream' ),
'confirm_defaults' => esc_html__( 'Are you sure you want to reset all site settings to default? This cannot be undone.', 'stream' ),
'confirm_uninstall' => esc_html__( 'Are you sure you want to uninstall and deactivate Stream? This will delete all Stream tables from the database and cannot be undone.', 'stream' ),
),
'locale' => esc_js( $locale ),
'gmt_offset' => get_option( 'gmt_offset' ),
Expand Down Expand Up @@ -817,18 +809,6 @@ public function plugin_action_links( $links, $file ) {

$links[] = sprintf( '<a href="%s">%s</a>', esc_url( $admin_page_url ), esc_html__( 'Settings', 'default' ) );

if ( ! defined( 'DISALLOW_FILE_MODS' ) || false === DISALLOW_FILE_MODS ) {
$url = add_query_arg(
array(
'action' => 'wp_stream_uninstall',
'wp_stream_nonce' => wp_create_nonce( 'stream_nonce' ),
),
admin_url( 'admin-ajax.php' )
);

$links[] = sprintf( '<span id="wp_stream_uninstall" class="delete"><a href="%s">%s</a></span>', esc_url( $url ), esc_html__( 'Uninstall', 'stream' ) );
}

return $links;
}

Expand Down
7 changes: 1 addition & 6 deletions classes/class-db-driver-wpdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,8 @@ public function setup_storage( $plugin ) {
* Purge storage.
*
* @param \WP_Stream\Plugin $plugin Instance of the plugin.
* @return \WP_Stream\Uninstall
*/
public function purge_storage( $plugin ) {
$uninstall = new Uninstall( $plugin );
add_action( 'wp_ajax_wp_stream_uninstall', array( $uninstall, 'uninstall' ) );

return $uninstall;
// @TODO: Not doing anything here until the deactivation/uninstall flow has been rethought.
}

}
250 changes: 0 additions & 250 deletions classes/class-uninstall.php

This file was deleted.

4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
View the [plugin description on WordPress.org](https://wordpress.org/plugins/stream/) for the list of features and screenshots.


## Known Issues

- We have temporarily disabled the data removal feature through plugin uninstallation, starting with version 3.9.3. We identified a few edge cases that did not behave as expected and we decided that a temporary removal is preferable at this time for such an impactful and irreversible operation. Our team is actively working on refining this feature to ensure it performs optimally and securely. We plan to reintroduce it in a future update with enhanced safeguards.

## Contribute

All suggestions and contributions are welcome! View the [contributor documentation](contributing.md) for how to report issues and setup the local development environment.
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ With Stream’s powerful logging, you’ll have the valuable information you nee
* WP-CLI command for querying records


= Known Issues

* We have temporarily disabled the data removal feature through plugin uninstallation, starting with version 3.9.3. We identified a few edge cases that did not behave as expected and we decided that a temporary removal is preferable at this time for such an impactful and irreversible operation. Our team is actively working on refining this feature to ensure it performs optimally and securely. We plan to reintroduce it in a future update with enhanced safeguards.


= Contribute =

There are several ways you can get involved to help make Stream better:
Expand Down
1 change: 0 additions & 1 deletion tests/tests/test-class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ public function test_plugin_action_links() {

$this->assertContains( 'Disconnect', $action_links[0] );
$this->assertContains( 'Settings', $action_links[1] );
$this->assertContains( 'Uninstall', $action_links[2] );
}

public function test_render_list_table() {
Expand Down
8 changes: 0 additions & 8 deletions ui/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,6 @@ jQuery(
}
);

$( 'body' ).on(
'click', '#wp_stream_uninstall', function( e ) {
if ( ! window.confirm( wp_stream.i18n.confirm_uninstall ) ) {
e.preventDefault();
}
}
);

// Admin page tabs
var $tabs = $( '.wp_stream_screen .nav-tab-wrapper' ),
$panels = $( '.wp_stream_screen .nav-tab-content table.form-table' ),
Expand Down

0 comments on commit 61a5ab9

Please sign in to comment.