PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmMigrate.php +30 -6 6.32.1 → trunk View file →
@@ -24,14 +24,20 @@
24 24 * @var string
25 25 */
26 26 public $entry_metas;
27 27
28 + /**
29 + * @var string
30 + */
31 + public $gated_tokens;
32 +
28 33 public function __construct() {
29 34 global $wpdb;
30 - $this->fields = $wpdb->prefix . 'frm_fields';
31 - $this->forms = $wpdb->prefix . 'frm_forms';
32 - $this->entries = $wpdb->prefix . 'frm_items';
33 - $this->entry_metas = $wpdb->prefix . 'frm_item_metas';
35 + $this->fields = $wpdb->prefix . 'frm_fields';
36 + $this->forms = $wpdb->prefix . 'frm_forms';
37 + $this->entries = $wpdb->prefix . 'frm_items';
38 + $this->entry_metas = $wpdb->prefix . 'frm_item_metas';
39 + $this->gated_tokens = $wpdb->prefix . 'frm_gated_tokens';
34 40 }
35 41
36 42 /**
37 43 * @return void
@@ -153,10 +159,10 @@
153 159
154 160 $message = array(
155 161 'key' => 'failed-to-create-tables',
156 162 'subject' => 'Something went wrong setting up the database',
157 - 'message' => 'For steps to continue, see our <a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">documentation</a>. If you need assistance, we recommend that you reach out to your hosting provider. Then <a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_add_tables=1' ) ) . '">click here</a> to try again.', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
158 - 'cta' => '<a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">Learn More</a>',
163 + 'message' => 'For steps to continue, see our <a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables" target="_blank" rel="noopener">documentation</a>. If you need assistance, we recommend that you reach out to your hosting provider. Then <a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_add_tables=1' ) ) . '">click here</a> to try again.', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
164 + 'cta' => '<a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables" target="_blank" rel="noopener">Learn More</a>', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
159 165 'type' => 'error',
160 166 );
161 167
162 168 $inbox = new FrmInbox();
@@ -249,8 +255,25 @@
249 255 KEY field_id (field_id),
250 256 KEY item_id (item_id)
251 257 )';
252 258
259 + /* Create/Upgrade Gated Tokens Table */
260 + $sql[] = 'CREATE TABLE ' . $this->gated_tokens . ' (
261 + id BIGINT UNSIGNED NOT NULL auto_increment,
262 + token_hash varchar(64) NOT NULL,
263 + action_id BIGINT UNSIGNED NOT NULL,
264 + entry_id BIGINT UNSIGNED NOT NULL,
265 + user_id BIGINT UNSIGNED default NULL,
266 + ip_address varchar(255) default NULL,
267 + created_at int UNSIGNED NOT NULL,
268 + expired_at int UNSIGNED default NULL,
269 + PRIMARY KEY (id),
270 + UNIQUE KEY token_hash (token_hash),
271 + KEY action_id (action_id),
272 + KEY user_id (user_id),
273 + KEY expired_at (expired_at)
274 + )';
275 +
253 276 foreach ( $sql as $q ) {
254 277 if ( function_exists( 'dbDelta' ) ) {
255 278 dbDelta( $q . $charset_collate . ';' );
256 279 } else {
@@ -408,8 +431,9 @@
408 431 $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
409 432 $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
410 433 $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
411 434 $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
435 + $wpdb->query( 'DROP TABLE IF EXISTS ' . $this->gated_tokens ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
412 436
413 437 delete_option( 'frm_options' );
414 438 delete_option( 'frm_db_version' );
415 439 delete_option( 'frm_install_running' );