PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.10.0.1
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.10.0.1
1.10.1 1.10.0.5 trunk 1.1.4 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.6.1 1.1.7 1.1.7.1 1.1.7.2 1.1.8 1.1.8.1 1.1.8.2 1.1.8.3 1.1.8.4 1.10.0.1 1.10.0.2 1.10.0.3 1.10.0.4 1.2.0 1.2.0.1 1.2.1 1.2.2 1.2.2.1 1.2.2.2 1.2.3 1.2.3.1 1.2.3.2 1.2.4 1.2.4.1 1.2.5 1.2.5.1 1.2.6 1.2.7 1.2.8 1.2.8.1 1.2.9 1.3.0 1.3.1 1.3.1.1 1.3.1.2 1.3.2 1.3.3 1.3.5 1.3.6 1.3.6.1 1.3.6.2 1.3.7.2 1.3.7.3 1.3.7.4 1.3.8 1.3.9.1 1.4.0.1 1.4.1.1 1.4.2 1.4.2.1 1.4.2.2 1.4.3 1.4.4 1.4.4.1 1.4.5 1.4.5.1 1.4.5.2 1.4.5.3 1.4.6 1.4.7.1 1.4.7.2 1.4.8.1 1.4.9 1.5.0.1 1.5.0.3 1.5.0.4 1.5.1 1.5.1.1 1.5.1.3 1.5.2.1 1.5.2.2 1.5.2.3 1.5.3 1.5.3.1 1.5.4.1 1.5.4.2 1.5.5 1.5.5.1 1.5.6 1.5.6.2 1.5.7 1.5.8.2 1.5.9.1 1.5.9.4 1.5.9.5 1.6.0.1 1.6.0.2 1.6.1 1.6.2.2 1.6.2.3 1.6.3.1 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.7 1.6.7.1 1.6.7.2 1.6.7.3 1.6.8 1.6.8.1 1.6.9 1.7.0 1.7.1.1 1.7.1.2 1.7.2 1.7.2.1 1.7.3 1.7.4 1.7.4.1 1.7.4.2 1.7.5.1 1.7.5.2 1.7.5.3 1.7.5.5 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.7.9.1 1.8.0.1 1.8.0.2 1.8.1.1 1.8.1.2 1.8.1.3 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.3.1 1.8.4 1.8.4.1 1.8.5.2 1.8.5.3 1.8.5.4 1.8.6.2 1.8.6.3 1.8.6.4 1.8.7.2 1.8.8.2 1.8.8.3 1.8.9.1 1.8.9.2 1.8.9.4 1.8.9.5 1.8.9.6 1.9.0.1 1.9.0.2 1.9.0.3 1.9.0.4 1.9.1.1 1.9.1.2 1.9.1.3 1.9.1.4 1.9.1.5 1.9.1.6 1.9.2.1 1.9.2.2 1.9.2.3 1.9.3.1 1.9.3.2 1.9.4.1 1.9.4.2 1.9.5 1.9.5.1 1.9.5.2 1.9.6 1.9.6.1 1.9.6.2 1.9.7.1 1.9.7.2 1.9.7.3 1.9.8.1 1.9.8.2 1.9.8.4 1.9.8.7 1.9.9.2 1.9.9.3 1.9.9.4
wpforms-lite / uninstall.php
wpforms-lite Last commit date
assets 2 months ago includes 2 months ago lite 2 months ago src 2 months ago templates 2 months ago vendor 2 months ago vendor_prefixed 2 months ago changelog.txt 2 months ago readme.txt 2 months ago uninstall.php 11 months ago wpforms.php 2 months ago
uninstall.php
180 lines
1 <?php
2 /**
3 * Uninstall WPForms.
4 *
5 * Remove:
6 * - Entries table
7 * - Entry Meta table
8 * - Entry fields table
9 * - Form Preview page
10 * - wpforms_log post type posts and post_meta
11 * - wpforms post type posts and post_meta
12 * - WPForms settings/options
13 * - WPForms user meta
14 * - WPForms term meta
15 * - WPForms Uploads
16 *
17 * @since 1.4.5
18 *
19 * @var WP_Filesystem_Base $wp_filesystem
20 */
21
22 // Exit if accessed directly.
23 use WPForms\Db\Payments\Meta as PaymentsMeta;
24 use WPForms\Db\Payments\Payment;
25 use WPForms\Logger\Repository;
26 use WPForms\Tasks\Meta as TasksMeta;
27 use WPForms\Tasks\Tasks;
28
29 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30 exit;
31 }
32
33 // Load plugin file.
34 require_once 'wpforms.php';
35
36 // Disable Action Schedule Queue Runner.
37 if ( class_exists( 'ActionScheduler_QueueRunner' ) ) {
38 ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
39 }
40
41 // Confirm user has decided to remove all data, otherwise stop.
42 $settings = get_option( 'wpforms_settings', [] );
43
44 if (
45 empty( $settings['uninstall-data'] ) ||
46 is_plugin_active( 'wpforms/wpforms.php' ) ||
47 is_plugin_active( 'wpforms-lite/wpforms.php' )
48 ) {
49 return;
50 }
51
52 global $wpdb;
53
54 // phpcs:disable WordPress.DB.DirectDatabaseQuery
55
56 // Delete entries table.
57 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_entries' );
58
59 // Delete entry meta table.
60 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_entry_meta' );
61
62 // Delete entry fields table.
63 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_entry_fields' );
64
65 // Delete payments table.
66 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
67 $wpdb->query( 'DROP TABLE IF EXISTS ' . Payment::get_table_name() );
68
69 // Delete payment meta table.
70 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
71 $wpdb->query( 'DROP TABLE IF EXISTS ' . PaymentsMeta::get_table_name() );
72
73 // Delete tasks meta table.
74 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
75 $wpdb->query( 'DROP TABLE IF EXISTS ' . TasksMeta::get_table_name() );
76
77 // Delete logger table.
78 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
79 $wpdb->query( 'DROP TABLE IF EXISTS ' . Repository::get_table_name() );
80
81 // Delete file restrictions table.
82 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
83 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_file_restrictions' );
84
85 // Delete protected files table.
86 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
87 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_protected_files' );
88
89 /**
90 * Delete tables that might be created by "Add-ons".
91 *
92 * 1. Form Locker.
93 * 2. User Journey.
94 * 3. Coupons.
95 * 4. Entry Automation.
96 */
97 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_form_locker_email_verification' );
98 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_user_journey' );
99 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_coupons' );
100 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_coupons_forms' );
101 $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'wpforms_entry_automation_tasks' );
102
103 // Delete Preview page.
104 $preview_page = get_option( 'wpforms_preview_page', false );
105
106 if ( ! empty( $preview_page ) ) {
107 wp_delete_post( $preview_page, true );
108 }
109
110 // Delete wpforms, wpforms-template and wpforms_log post type posts/post_meta.
111 $wpforms_posts = get_posts(
112 [
113 'post_type' => [ 'wpforms_log', 'wpforms', 'wpforms-template' ],
114 'post_status' => [ 'any', 'trash', 'auto-draft' ],
115 'numberposts' => -1,
116 'fields' => 'ids',
117 ]
118 );
119
120 if ( $wpforms_posts ) {
121 foreach ( $wpforms_posts as $wpforms_post ) {
122 wp_delete_post( $wpforms_post, true );
123 }
124 }
125
126 // Delete all the plugin settings.
127 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'wpforms\_%'" );
128
129 // Delete widget settings.
130 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'widget\_wpforms%'" );
131
132 // Delete options from the previous version of the Notifications functionality.
133 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_amn\_wpforms\_%'" );
134
135 // Delete plugin user meta.
136 $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'wpforms\_%'" );
137
138 // Delete plugin term meta.
139 $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key LIKE 'wpforms\_%'" );
140
141 // Remove any transients we've left behind.
142 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_transient\_wpforms\_%'" );
143 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_site\_transient\_wpforms\_%'" );
144 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_transient\_timeout\_wpforms\_%'" );
145 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_site\_transient\_timeout\_wpforms\_%'" );
146 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '\_wpforms\_transient\_%'" );
147
148 global $wp_filesystem;
149
150 // Remove uploaded files.
151 $uploads_directory = wp_upload_dir();
152
153 if ( empty( $uploads_directory['error'] ) ) {
154 $wp_filesystem->rmdir( $uploads_directory['basedir'] . '/wpforms/', true );
155 }
156
157 // Remove translation files.
158 $languages_directory = defined( 'WP_LANG_DIR' ) ? trailingslashit( WP_LANG_DIR ) : trailingslashit( WP_CONTENT_DIR ) . 'languages/';
159 $translations = glob( wp_normalize_path( $languages_directory . 'plugins/wpforms-*' ) );
160
161 if ( ! empty( $translations ) ) {
162 foreach ( $translations as $file ) {
163 $wp_filesystem->delete( $file );
164 }
165 }
166
167 // Remove plugin cron jobs.
168 wp_clear_scheduled_hook( 'wpforms_email_summaries_cron' );
169
170 // Check if the event is scheduled before attempting to clear it.
171 // This event is only registered for the Lite edition of the plugin.
172 if ( wp_next_scheduled( 'wpforms_weekly_entries_count_cron' ) ) {
173 wp_clear_scheduled_hook( 'wpforms_weekly_entries_count_cron' );
174 }
175
176 // Un-schedule all plugin ActionScheduler actions.
177 // Don't use wpforms() because 'tasks' in core are registered on `init` hook,
178 // which is not executed on uninstallation.
179 ( new Tasks() )->cancel_all();
180