Plugin Directory

Changeset 3059614


Ignore:
Timestamp:
03/27/2024 09:22:42 AM (22 months ago)
Author:
xtoool
Message:

fix bug

Location:
xtoool-ads-box/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • xtoool-ads-box/trunk/readme.txt

    r3059560 r3059614  
    66Requires at least: 5.3
    77Tested up to: 6.4.3
    8 Stable tag: 1.0.2
     8Stable tag: 1.0.3
    99Requires PHP: 5.4
    1010License: GPLv3
  • xtoool-ads-box/trunk/xtoool-ads-box.php

    r3059560 r3059614  
    44Plugin URI: https://www.xtoool.com/wordpress/
    55Description: Xtoool Ads Box helps you create High-converting product bars to engage customers and grow sales.
    6 Version: 1.0.2
     6Version: 1.0.3
    77Author: xtoool.com
    88Author URI: https://www.xtoool.com
     
    3535define('XTPLB_URL', plugins_url('', __FILE__));
    3636define('XTPLB_BASE', plugin_basename(XTPLB_PATH));
    37 
    38 
     37define('ADSBX_PLUGIN_NAME', basename(XTPLB_DIR) . '/xtoool-ads-box.php');
    3938
    4039class plbProductListForBlog{
    4140    private static $instance = null;
    4241    public $db;
    43     const XTPLB_VERSION = '1.0.2';
     42    const XTPLB_VERSION = '1.0.3';
    4443    public $AdsbxAdmin_obj = null;
    4544
     
    5958
    6059        register_activation_hook(XTPLB_PATH, [$this, 'activate']);
     60        add_action( 'upgrader_process_complete', [$this, 'my_upgrate_function'], 10, 2);
     61
    6162        $this->_initScript();
    6263
     
    6566        $this->AdsbxAdmin_obj = new AdsbxAdmin($this);
    6667        new Shortcode($this);
     68    }
     69
     70    public function my_upgrate_function( $upgrader_object, $options ) {
     71
     72        if ($options['action'] !== 'update' || $options['type'] !== 'plugin') {
     73            return;
     74        }
     75
     76        if (! in_array(ADSBX_PLUGIN_NAME, $options['plugins'] ?? [])) {
     77            return;
     78        }
     79
     80        if(self::XTPLB_VERSION == '1.0.3'){
     81            $this->_update_1_0_3();
     82        }
     83
     84    }
     85
     86    private function _update_1_0_3(){
     87        global $wpdb;
     88        $sql4 = 'CREATE TABLE if not exists `' . $wpdb->prefix . 'products_banner_blog` (
     89            `id` int(11) NOT NULL AUTO_INCREMENT,
     90  `name` varchar(255) NOT NULL default "",
     91  `image_url` varchar(255) NOT NULL default "",
     92  `regular_price` varchar(25) NOT NULL default "",
     93  `price` varchar(25) NOT NULL default "",
     94  `title` varchar(255) NOT NULL default "",
     95  `desc` text default null,
     96  `shop_btn_text` varchar(255) NOT NULL default "",
     97  `shop_btn_link` varchar(1000) NOT NULL default "",
     98  `sub_btn_text` varchar(255) NOT NULL default "",
     99  `sub_btn_link` varchar(1000) NOT NULL default "",
     100  `added_by` int(11) not null default 0,
     101  `added_date` datetime default null,
     102  `updated_by` int(11) not null default 0,
     103  `updated_date` datetime default null,
     104 
     105  PRIMARY KEY (`id`)
     106) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;';
     107        $wpdb->query($sql4);
    67108    }
    68109
Note: See TracChangeset for help on using the changeset viewer.