"Delete all data when the plugin * is deleted" is on. Your static site and GitHub repository are never touched. */ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; } // Settings, the GitHub connection, media records and exported files are kept unless the user // turned on Tools > "Delete all data when the plugin is deleted". Reinstalling (or updating by // deleting and uploading again) then picks up where it left off. $cfsp_settings = get_option( 'cfsp_settings' ); if ( ! is_array( $cfsp_settings ) || empty( $cfsp_settings['delete_data'] ) ) { return; } $cfsp_options = array( 'cfsp_settings', 'cfsp_github_auth', 'cfsp_job', 'cfsp_pending', 'cfsp_last_deploy', 'cfsp_log', 'cfsp_lock', 'cfsp_worker_key', 'cfsp_history', 'cfsp_settings_last_export_signature', 'cfsp_media_job', 'cfsp_media_queue', 'cfsp_media_stats', 'cfsp_media_lock', 'cfsp_media_db', 'cfsp_media_paused', 'cfsp_moved', 'cfsp_dirs_migrated', 'cfsp_dir_key', 'cfsp_moved_skip', 'cfsp_moved_terms', 'cfsp_moved_term_paths', 'cfsp_llms_built', ); foreach ( $cfsp_options as $cfsp_option ) { delete_option( $cfsp_option ); } delete_post_meta_by_key( '_cfsp_file' ); delete_transient( 'cfsp_diagnostics' ); // The plugin's own media table (list of files uploaded to R2). global $wpdb; $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}cfsp_media" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Removing the plugin's own table on uninstall. // Files already uploaded to your R2 bucket are NOT deleted. // The export and work folders the plugin created in uploads. require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php'; $cfsp_fs = new WP_Filesystem_Direct( null ); $cfsp_uploads = wp_upload_dir( null, false ); foreach ( array( 'staticpush', 'cfsp-static', 'cfsp-work' ) as $cfsp_dir ) { $cfsp_path = trailingslashit( $cfsp_uploads['basedir'] ) . $cfsp_dir; if ( is_dir( $cfsp_path ) ) { $cfsp_fs->rmdir( $cfsp_path, true ); } } // The per-user "hide the support strip" choice. delete_metadata( 'user', 0, 'cfsp_hide_donate', '', true );