Plugin Directory

Changeset 2933566


Ignore:
Timestamp:
07/03/2023 08:45:55 PM (3 years ago)
Author:
wojciechborowicz
Message:

1.1.1

Fix: Several DB and import tool fixes
New: Database removal on deactivation need to be set in the settings, as opposed to auto-removal

Location:
flow-fields/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • flow-fields/trunk/flow-fields.php

    r2930614 r2933566  
    44Plugin URI: https://flow.borowicz.me
    55Description: Manage fields and custom post types
    6 Version: 1.1.0
     6Version: 1.1.1
    77Author: Wojciech Borowicz
    88Author URI: https://borowicz.me
     
    1111
    1212function flow_fields_check_db_version() {
    13     if ( get_option( 'flow_fields_db_version' ) != '1.1.0' ) {
     13    if ( get_option( 'flow_fields_db_version' ) != '1.1.1' ) {
    1414        create_flow_field_tables();
    1515   }
     
    2222    $table_name = $wpdb->prefix . 'flow_boxes';
    2323   
    24     update_option( 'flow_fields_db_version', '1.1.0' ); 
    2524   
     25
     26    update_option( 'flow_fields_db_version', '1.1.1' ); 
     27
     28
    2629    $charset_collate = $wpdb->get_charset_collate();
    27     $sql = "CREATE TABLE $table_name (
     30    $sql = "CREATE TABLE IF NOT EXISTS $table_name (
    2831        id INT NOT NULL AUTO_INCREMENT,
    2932        title VARCHAR(255) NOT NULL,
     
    3942
    4043    $table_name = $wpdb->prefix . 'flow_fields';
    41     $sql = "CREATE TABLE $table_name (
     44    $sql = "CREATE TABLE IF NOT EXISTS $table_name (
    4245        id INT NOT NULL AUTO_INCREMENT,
    4346        box_id INT NOT NULL,
     
    5962        internal VARCHAR(255) NOT NULL,
    6063        parent_field INT NULL,
    61         conditional JSON NULL,
    62         options_number JSON NULL,
     64        conditional TEXT NULL,
     65        options_number TEXT NULL,
    6366        PRIMARY KEY (id),
    6467        FOREIGN KEY (box_id) REFERENCES {$wpdb->prefix}flow_boxes(id)
     
    6871
    6972    $table_name = $wpdb->prefix . 'flow_custom_post_types';
    70     $sql = "CREATE TABLE $table_name (
     73    $sql = "CREATE TABLE IF NOT EXISTS $table_name (
    7174        id INT NOT NULL AUTO_INCREMENT,
    7275        post_type VARCHAR(255) NOT NULL,
     
    123126
    124127    dbDelta($sql);
     128
    125129}
    126130register_activation_hook( __FILE__, 'create_flow_field_tables' );
     
    130134
    131135function drop_flow_field_tables() {
     136   
     137    $option = get_option('flow_remove_on_deactivation');
     138    // proceed with this function only if the checkbox is selected
     139    if ( $option != '1' ) {
     140        return;
     141    }
    132142    global $wpdb;
     143    $table_name = $wpdb->prefix . 'flow_fields';
     144    $sql = "DROP TABLE IF EXISTS $table_name;";
     145    $wpdb->query( $sql );
    133146    $table_name = $wpdb->prefix . 'flow_boxes';
    134147    $sql = "DROP TABLE IF EXISTS $table_name;";
    135148    $wpdb->query( $sql );
    136     $table_name = $wpdb->prefix . 'flow_fields';
     149   
     150    $table_name = $wpdb->prefix . 'flow_custom_post_types';
     151    $sql = "DROP TABLE IF EXISTS $table_name;";
     152    $wpdb->query( $sql );
     153
     154   
     155    $table_name = $wpdb->prefix . 'flow_taxonomies';
    137156    $sql = "DROP TABLE IF EXISTS $table_name;";
    138157    $wpdb->query( $sql );
  • flow-fields/trunk/includes/templates/admin_assets.php

    r2930614 r2933566  
    22
    33function flow_fields_admin_enqueue_scripts( $hook_suffix ) {
    4     $plugin_version = '1.1.0';
     4    $plugin_version = '1.1.1';
    55    wp_enqueue_script( 'flow-fields-js', plugins_url( '../../assets/flow-fields.js', __FILE__ ), array( 'jquery' ), $plugin_version, true );
    66    wp_enqueue_script( 'flow-relationship-fields-js', plugins_url( '../../assets/flow-relationship-fields.js', __FILE__ ), array( 'jquery', 'select2' ), $plugin_version, true );
  • flow-fields/trunk/includes/templates/create_admin_pages.php

    r2930614 r2933566  
    119119    register_setting('flow_fields_options', 'flow_fields_hide_helpers');
    120120    register_setting('flow_fields_options', 'flow_fields_hide_plugin');
     121    register_setting('flow_fields_options', 'flow_remove_on_deactivation');
    121122    add_settings_section(
    122123        'flow_fields_general_section',
     
    133134    );
    134135    add_settings_field(
     136        'flow_remove_on_deactivation',
     137        'Remove Data on Deactivation',
     138        'flow_remove_on_deactivation_callback',
     139        'flow_field_boxes',
     140        'flow_fields_general_section'
     141    );
     142    add_settings_field(
    135143        'flow_fields_hide_helpers',
    136144        'Hide Helpers',
     
    147155    );
    148156}
     157
     158function flow_remove_on_deactivation_callback() {
     159    $option = get_option('flow_remove_on_deactivation');
     160    ?>
     161    <label>
     162        <input type="checkbox" name="flow_remove_on_deactivation" value="1" <?php checked(1, $option); ?> />
     163        Check this option to remove all Flow Fields data on deactivation
     164    </label>
     165    <?php
     166}
     167
    149168
    150169// Render the callback for the general settings section
  • flow-fields/trunk/readme.txt

    r2930614 r2933566  
    44Requires at least: 5.0
    55Tested up to: 6.2.2
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.1
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9696    New : Taxonomies management initial release
    9797
     98= 1.1.1 =
     99    Fix: Several DB and import tool fixes
     100    New: Database removal on deactivation need to be set in the settings, as opposed to auto-removal
    98101
    99102== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.