| @@ -41,9 +41,8 @@ | ||
| 41 | 41 | $old_db_version = get_option( 'frm_db_version' ); |
| 42 | 42 | |
| 43 | 43 | $this->create_tables(); |
| 44 | 44 | $this->migrate_data( $old_db_version ); |
| 45 | - $this->check_that_tables_exist(); | |
| 46 | 45 | |
| 47 | 46 | // SAVE DB VERSION. |
| 48 | 47 | update_option( 'frm_db_version', FrmAppHelper::plugin_version() . '-' . FrmAppHelper::$db_version ); |
| 49 | 48 | |
| @@ -48,16 +47,10 @@ | ||
| 48 | 47 | update_option( 'frm_db_version', FrmAppHelper::plugin_version() . '-' . FrmAppHelper::$db_version ); |
| 49 | 48 | |
| 50 | 49 | if ( ! $old_db_version ) { |
| 51 | 50 | $this->maybe_create_contact_form(); |
| 52 | - | |
| 53 | - if ( false === get_option( 'frm_first_activation' ) ) { | |
| 54 | - update_option( 'frm_first_activation', time(), false ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - $this->update_settings_for_new_install(); | |
| 58 | 51 | } |
| 59 | - }//end if | |
| 52 | + } | |
| 60 | 53 | |
| 61 | 54 | do_action( 'frm_after_install' ); |
| 62 | 55 | |
| 63 | 56 | $frm_vars['doing_upgrade'] = false; |
| @@ -70,54 +63,8 @@ | ||
| 70 | 63 | $frm_style->update( 'default' ); |
| 71 | 64 | } |
| 72 | 65 | } |
| 73 | 66 | |
| 74 | - /** | |
| 75 | - * Updates some settings for new installs. | |
| 76 | - * | |
| 77 | - * @since 6.23 | |
| 78 | - */ | |
| 79 | - private function update_settings_for_new_install() { | |
| 80 | - $settings = FrmAppHelper::get_settings(); | |
| 81 | - | |
| 82 | - $settings->denylist_check = 1; | |
| 83 | - $settings->store(); | |
| 84 | - } | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * If we fail to create the database tables, add an inbox notice. | |
| 88 | - * This informs the user that they need to correct the issue and try again. | |
| 89 | - * | |
| 90 | - * @since 6.19 | |
| 91 | - * | |
| 92 | - * @return void | |
| 93 | - */ | |
| 94 | - private function check_that_tables_exist() { | |
| 95 | - // Check the DB that the table $this->forms exists. | |
| 96 | - global $wpdb; | |
| 97 | - $exists = $wpdb->get_results( $wpdb->prepare( 'SHOW TABLES LIKE %s', $this->forms ) ); | |
| 98 | - | |
| 99 | - if ( $exists ) { | |
| 100 | - $inbox = new FrmInbox(); | |
| 101 | - $inbox->dismiss( 'failed-to-create-tables' ); | |
| 102 | - return; | |
| 103 | - } | |
| 104 | - | |
| 105 | - $message = array( | |
| 106 | - 'key' => 'failed-to-create-tables', | |
| 107 | - 'subject' => 'Something went wrong setting up the database', | |
| 108 | - '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.', | |
| 109 | - 'cta' => '<a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">Learn More</a>', | |
| 110 | - 'type' => 'error', | |
| 111 | - ); | |
| 112 | - | |
| 113 | - $inbox = new FrmInbox(); | |
| 114 | - $inbox->add_message( $message ); | |
| 115 | - } | |
| 116 | - | |
| 117 | - /** | |
| 118 | - * @return string | |
| 119 | - */ | |
| 120 | 67 | public function collation() { |
| 121 | 68 | global $wpdb; |
| 122 | 69 | if ( ! $wpdb->has_cap( 'collation' ) ) { |
| 123 | 70 | return ''; |
| @@ -218,10 +165,8 @@ | ||
| 218 | 165 | /** |
| 219 | 166 | * These indexes help optimize database queries for entries. |
| 220 | 167 | * |
| 221 | 168 | * @since 6.6 |
| 222 | - * @since 6.16.3 idx_form_id_is_draft was also added to frm_items. | |
| 223 | - * @since 6.17 idx_form_id_type was also added to frm_fields. | |
| 224 | 169 | * |
| 225 | 170 | * @return void |
| 226 | 171 | */ |
| 227 | 172 | private function add_composite_indexes_for_entries() { |
| @@ -239,22 +184,8 @@ | ||
| 239 | 184 | |
| 240 | 185 | if ( ! self::index_exists( $table_name, $index_name ) ) { |
| 241 | 186 | $wpdb->query( "CREATE INDEX idx_field_id_item_id ON `{$wpdb->prefix}frm_item_metas` (field_id, item_id)" ); |
| 242 | 187 | } |
| 243 | - | |
| 244 | - $table_name = "{$wpdb->prefix}frm_items"; | |
| 245 | - $index_name = 'idx_form_id_is_draft'; | |
| 246 | - | |
| 247 | - if ( ! self::index_exists( $table_name, $index_name ) ) { | |
| 248 | - $wpdb->query( "CREATE INDEX idx_form_id_is_draft ON `{$wpdb->prefix}frm_items` (form_id, is_draft)" ); | |
| 249 | - } | |
| 250 | - | |
| 251 | - $table_name = "{$wpdb->prefix}frm_fields"; | |
| 252 | - $index_name = 'idx_form_id_type'; | |
| 253 | - | |
| 254 | - if ( ! self::index_exists( $table_name, $index_name ) ) { | |
| 255 | - $wpdb->query( "CREATE INDEX idx_form_id_type ON `{$wpdb->prefix}frm_fields` (form_id, type(30))" ); | |
| 256 | - } | |
| 257 | 188 | } |
| 258 | 189 | |
| 259 | 190 | /** |
| 260 | 191 | * Check that an index exists in a database table before trying to add it (which results in an error). |
| @@ -324,9 +255,9 @@ | ||
| 324 | 255 | // bail if we don't know the previous version |
| 325 | 256 | return; |
| 326 | 257 | } |
| 327 | 258 | |
| 328 | - $migrations = array( 16, 11, 16, 17, 23, 25, 86, 90, 97, 98, 101, 104 ); | |
| 259 | + $migrations = array( 16, 11, 16, 17, 23, 25, 86, 90, 97, 98, 101 ); | |
| 329 | 260 | foreach ( $migrations as $migration ) { |
| 330 | 261 | if ( FrmAppHelper::$db_version >= $migration && $old_db_version < $migration ) { |
| 331 | 262 | $function_name = 'migrate_to_' . $migration; |
| 332 | 263 | $this->$function_name(); |
| @@ -392,26 +323,8 @@ | ||
| 392 | 323 | |
| 393 | 324 | do_action( 'frm_after_uninstall' ); |
| 394 | 325 | |
| 395 | 326 | return true; |
| 396 | - } | |
| 397 | - | |
| 398 | - /** | |
| 399 | - * In older versions of Lite, it's possible we've saved the wrong location ID. | |
| 400 | - * So force it to get valid values again. | |
| 401 | - * | |
| 402 | - * @since 6.25 | |
| 403 | - * | |
| 404 | - * @return void | |
| 405 | - */ | |
| 406 | - private function migrate_to_104() { | |
| 407 | - if ( FrmSquareLiteConnectHelper::get_merchant_id( 'test' ) ) { | |
| 408 | - FrmSquareLiteConnectHelper::get_location_id( true, 'test' ); | |
| 409 | - } | |
| 410 | - | |
| 411 | - if ( FrmSquareLiteConnectHelper::get_merchant_id( 'live' ) ) { | |
| 412 | - FrmSquareLiteConnectHelper::get_location_id( true, 'live' ); | |
| 413 | - } | |
| 414 | 327 | } |
| 415 | 328 | |
| 416 | 329 | /** |
| 417 | 330 | * Disables summary email for multisite (not the main site) if recipient setting isn't changed. |