Plugin Directory

Changeset 2907319


Ignore:
Timestamp:
05/03/2023 07:28:48 AM (3 years ago)
Author:
thrivedesk
Message:

Update to version 1.0.13 from GitHub

Location:
thrivedesk
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • thrivedesk/tags/1.0.13/database/Scripts/MigrationScript.php

    r2907273 r2907319  
    88
    99    public function __construct() {
    10         register_activation_hook( THRIVEDESK_FILE, array( $this, 'run' ));
     10        register_activation_hook( THRIVEDESK_FILE, [ $this, 'run' ] );
     11        add_action( 'upgrader_process_complete', 'wp_td_update_completed', 10, 2 );
    1112    }
    1213
    1314    public static function instance(): MigrationScript {
    14         if ( !isset(self::$instance) ) {
     15        if ( ! isset( self::$instance ) ) {
    1516            self::$instance = new self();
    1617        }
     
    1920    }
    2021
     22    public function wp_td_update_completed( $upgrader_object, $options ) {
     23        if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
     24            foreach ( $options['plugins'] as $plugin ) {
     25                if ( $plugin == plugin_basename( THRIVEDESK_FILE ) ) {
     26                    $this->run();
     27                    break;
     28                }
     29            }
     30        }
     31    }
     32
    2133    public function run() {
    2234        $this->runMigrationScript();
    2335    }
    2436
    25     private function runMigrationScript(  ) {
     37    private function runMigrationScript() {
    2638        $this->migratePostSyncOption();
    2739    }
    2840
    29     private function migratePostSyncOption( ) {
     41    private function migratePostSyncOption() {
    3042        $old_post_sync_option = get_option( 'thrivedesk_post_type_sync_option' );
    3143
     
    3446        }
    3547
    36 
    3748        $td_helpdesk_settings = get_td_helpdesk_options();
    3849
    39         if(!array_key_exists('td_helpdesk_post_sync', $td_helpdesk_settings)
    40            || !$td_helpdesk_settings['td_helpdesk_post_sync']) {
     50        if ( ! array_key_exists( 'td_helpdesk_post_sync', $td_helpdesk_settings ) ||
     51             ! $td_helpdesk_settings['td_helpdesk_post_sync'] ) {
    4152            $td_helpdesk_settings['td_helpdesk_post_sync'] = $old_post_sync_option;
    4253            update_option( 'td_helpdesk_settings', $td_helpdesk_settings );
  • thrivedesk/tags/1.0.13/readme.txt

    r2907273 r2907319  
    44Requires at least: 4.9
    55Tested up to: 6.2
    6 Stable Tag: 1.0.12
     6Stable Tag: 1.0.13
    77Requires PHP: 5.5
    88License: GNU General Public License v2.0 or later
     
    224224
    225225== Changelog ==
     226= 1.0.13 =
     227- Update: Migration Script
     228
    226229= 1.0.12 =
    227230- Fix: Legacy post types support for WPPostSync integration
  • thrivedesk/tags/1.0.13/thrivedesk.php

    r2907273 r2907319  
    66 * Plugin URI:          https://www.thrivedesk.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
    77 * Tags:                live chat, helpdesk, free live chat, knowledge base, thrivedesk
    8  * Version:             1.0.12
     8 * Version:             1.0.13
    99 * Author:              ThriveDesk
    1010 * Author URI:          https://profiles.wordpress.org/thrivedesk/
     
    5050     * @var string
    5151     */
    52     public $version = '1.0.12';
     52    public $version = '1.0.13';
    5353
    5454    /**
  • thrivedesk/trunk/database/Scripts/MigrationScript.php

    r2907273 r2907319  
    88
    99    public function __construct() {
    10         register_activation_hook( THRIVEDESK_FILE, array( $this, 'run' ));
     10        register_activation_hook( THRIVEDESK_FILE, [ $this, 'run' ] );
     11        add_action( 'upgrader_process_complete', 'wp_td_update_completed', 10, 2 );
    1112    }
    1213
    1314    public static function instance(): MigrationScript {
    14         if ( !isset(self::$instance) ) {
     15        if ( ! isset( self::$instance ) ) {
    1516            self::$instance = new self();
    1617        }
     
    1920    }
    2021
     22    public function wp_td_update_completed( $upgrader_object, $options ) {
     23        if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
     24            foreach ( $options['plugins'] as $plugin ) {
     25                if ( $plugin == plugin_basename( THRIVEDESK_FILE ) ) {
     26                    $this->run();
     27                    break;
     28                }
     29            }
     30        }
     31    }
     32
    2133    public function run() {
    2234        $this->runMigrationScript();
    2335    }
    2436
    25     private function runMigrationScript(  ) {
     37    private function runMigrationScript() {
    2638        $this->migratePostSyncOption();
    2739    }
    2840
    29     private function migratePostSyncOption( ) {
     41    private function migratePostSyncOption() {
    3042        $old_post_sync_option = get_option( 'thrivedesk_post_type_sync_option' );
    3143
     
    3446        }
    3547
    36 
    3748        $td_helpdesk_settings = get_td_helpdesk_options();
    3849
    39         if(!array_key_exists('td_helpdesk_post_sync', $td_helpdesk_settings)
    40            || !$td_helpdesk_settings['td_helpdesk_post_sync']) {
     50        if ( ! array_key_exists( 'td_helpdesk_post_sync', $td_helpdesk_settings ) ||
     51             ! $td_helpdesk_settings['td_helpdesk_post_sync'] ) {
    4152            $td_helpdesk_settings['td_helpdesk_post_sync'] = $old_post_sync_option;
    4253            update_option( 'td_helpdesk_settings', $td_helpdesk_settings );
  • thrivedesk/trunk/readme.txt

    r2907273 r2907319  
    44Requires at least: 4.9
    55Tested up to: 6.2
    6 Stable Tag: 1.0.12
     6Stable Tag: 1.0.13
    77Requires PHP: 5.5
    88License: GNU General Public License v2.0 or later
     
    224224
    225225== Changelog ==
     226= 1.0.13 =
     227- Update: Migration Script
     228
    226229= 1.0.12 =
    227230- Fix: Legacy post types support for WPPostSync integration
  • thrivedesk/trunk/thrivedesk.php

    r2907273 r2907319  
    66 * Plugin URI:          https://www.thrivedesk.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
    77 * Tags:                live chat, helpdesk, free live chat, knowledge base, thrivedesk
    8  * Version:             1.0.12
     8 * Version:             1.0.13
    99 * Author:              ThriveDesk
    1010 * Author URI:          https://profiles.wordpress.org/thrivedesk/
     
    5050     * @var string
    5151     */
    52     public $version = '1.0.12';
     52    public $version = '1.0.13';
    5353
    5454    /**
Note: See TracChangeset for help on using the changeset viewer.