Plugin Directory

Changeset 3192494


Ignore:
Timestamp:
11/19/2024 04:32:08 PM (17 months ago)
Author:
shelfplanner
Message:

2.5.1

  • Plugin update fix
Location:
shelf-planner/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • shelf-planner/trunk/block.json

    r3192378 r3192494  
    33    "apiVersion": 3,
    44    "name": "extension/shelf-planner",
    5     "version": "2.5.0",
     5    "version": "2.5.1",
    66    "title": "Stock Management for WooCommerce",
    77    "category": "widgets",
  • shelf-planner/trunk/includes/shelf_planner_connector.php

    r3192378 r3192494  
    158158            // return true; // TEST
    159159            // return false; // TEST
    160             return $this->has_server_key();
     160            $installed_version = $this->get_installed_plugin_version();
     161            $current_version = $this->config->get_version();
     162            return ($installed_version === $current_version) && $this->has_server_key();
    161163        }
    162164
     
    813815        }
    814816
     817        public function get_installed_plugin_version()
     818        {
     819            return get_option($this->config->get_domain() . '_installed_plugin_version', '');
     820        }
     821
     822        public function set_installed_plugin_version($version)
     823        {
     824            update_option($this->config->get_domain() . '_installed_plugin_version', $version);
     825        }
     826
    815827        public function get_server_key()
    816828        {
     
    923935            }
    924936
    925             $this->delete_server_key();
    926             $this->delete_license_key();
     937            // $this->delete_server_key();
     938            // $this->delete_license_key();
    927939            update_option($this->config->get_domain() . '_enable_logs', 'checked');
    928940
     
    975987                // Setup connector
    976988                $this->set_server_key($serverData->serverKey);
    977                 update_option($this->config->get_domain() . '_installed_plugin_version', $this->config->get_version());
     989                $this->set_installed_plugin_version($this->config->get_version());
     990
    978991                update_option($this->config->get_domain(), [
    979992                    'is_debug' => $this->is_debug(),
  • shelf-planner/trunk/readme.txt

    r3192378 r3192494  
    44Tested up to: 6.6
    55Requires PHP: 5.3
    6 Stable tag: 2.5.0
     6Stable tag: 2.5.1
    77Tags: Inventory Management,ABC Analysis,Demand Forecasting,Replenishment,Purchasing
    88License: GPLv2 or later
     
    9696== Changelog ==
    9797
     98= 2.5.1 =
     99- Plugin update fix
     100
    98101= 2.5.0 =
    99102- Plugin rewrite
  • shelf-planner/trunk/shelf-planner.php

    r3192378 r3192494  
    1010 * Description:         AI-driven Stock Management, Demand Forecasting, Replenishment and Order Management for WooCommerce, all in one powerful tool.
    1111 *
    12  * Version:             2.5.0
     12 * Version:             2.5.1
    1313 * Author:              Shelf Planner
    1414 * Author URI:          https://www.shelfplanner.com
     
    2626
    2727if (!defined('SPC_WP__VERSION')) {
    28     define('SPC_WP__VERSION', '2.5.0');
     28    define('SPC_WP__VERSION', '2.5.1');
    2929}
    3030
     
    5959    $config = shelf_planner_config::instance();
    6060    $sp_connector = shelf_planner_connector::instance($config);
    61     $sp_connector->setup();
     61    $sp_connector->activate();
    6262}
    6363
     
    105105    $sp_connector->deactivate();
    106106}
     107
     108function shelf_planner_update_hook($upgrader_object, $options) {
     109    // Check if the plugin was updated
     110    if ($options['action'] == 'update' && $options['type'] == 'plugin') {
     111        // Get the list of updated plugins
     112        $updated_plugins = $options['plugins'];
     113
     114        // Check if our plugin is in the list of updated plugins
     115        if (in_array(plugin_basename(__FILE__), $updated_plugins)) {
     116            // Perform actions after the plugin is updated
     117            shelf_planner_activate();
     118        }
     119    }
     120}
     121
     122add_action('upgrader_process_complete', 'shelf_planner_update_hook', 10, 2);
    107123
    108124if (!class_exists('shelf_planner')):
Note: See TracChangeset for help on using the changeset viewer.