Plugin Directory

Changeset 3487557


Ignore:
Timestamp:
03/21/2026 01:59:58 AM (11 days ago)
Author:
meliconnect
Message:

Update trunk to version 1.7.1

Location:
meliconnect/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • meliconnect/trunk/includes/Core/DatabaseManager.php

    r3485956 r3487557  
    311311        $current_version = get_option( 'meliconnect_db_version', '1.0' );
    312312
     313        if ( version_compare( $current_version, MELICONNECT_DATABASE_VERSION, '>=' ) ) {
     314            return;
     315        }
    313316
    314317        // Solo ejecutar si la versión del plugin es mayor que la versión guardada
    315         if ( version_compare( MELICONNECT_DATABASE_VERSION, $current_version, '>' ) ) {
    316 
    317 
    318 
    319             $db = new self();
    320 
    321              $tables = array(
    322                 'user_connection' => array(
    323                     'add' => array(
    324                         'plan_type'           => "enum('free','pro','power') NOT NULL DEFAULT 'free'",
    325                         'active_connections'  => 'int(11) NOT NULL DEFAULT 0',
    326                         'pending_connections' => 'int(11) NOT NULL DEFAULT 0',
    327                         'connected_listing_ids' => 'LONGTEXT DEFAULT NULL',
    328                     ),
    329                 ),
    330 
    331                 'notifications' => array(
    332                     'add' => array(
    333                         'to_version' => "varchar(50) DEFAULT NULL",
    334                         'type'       => "varchar(100) DEFAULT NULL",
    335                         'priority'   => "int(11) DEFAULT 0",
    336                         'meta'       => "LONGTEXT DEFAULT NULL",
    337                     ),
    338                     'update' => array(
    339                         'from_version' => "varchar(50) DEFAULT NULL",
    340                     ),
    341                 ),
    342 
    343                 'user_listings_to_import' => array(
    344                     'add' => array(
    345                         'meli_family_id' => "varchar(50) DEFAULT NULL",
    346                         'meli_family_name' => "varchar(200) DEFAULT NULL",
    347                         'meli_user_product_id' => "varchar(50) DEFAULT NULL",
    348                         'meli_seller_custom_field' => "varchar(50) DEFAULT NULL",
    349                         'meli_family_is_parent' => "tinyint(1) DEFAULT 0",
    350                         'meli_parent_listing_id' => "varchar(50) DEFAULT NULL",
    351                     ),
    352                 ),
    353             );
     318        $db = new self();
     319
     320            $tables = array(
     321                'user_connection'         => array(
     322                    'add' => array(
     323                        'plan_type'             => "enum('free','pro','power') NOT NULL DEFAULT 'free'",
     324                        'active_connections'    => 'int(11) NOT NULL DEFAULT 0',
     325                        'pending_connections'   => 'int(11) NOT NULL DEFAULT 0',
     326                        'connected_listing_ids' => 'LONGTEXT DEFAULT NULL',
     327                    ),
     328                ),
     329
     330                'notifications'           => array(
     331                    'add'    => array(
     332                        'to_version' => 'varchar(50) DEFAULT NULL',
     333                        'type'       => 'varchar(100) DEFAULT NULL',
     334                        'priority'   => 'int(11) DEFAULT 0',
     335                        'meta'       => 'LONGTEXT DEFAULT NULL',
     336                    ),
     337                    'update' => array(
     338                        'from_version' => 'varchar(50) DEFAULT NULL',
     339                    ),
     340                ),
     341
     342                'user_listings_to_import' => array(
     343                    'add' => array(
     344                        'meli_family_id'           => 'varchar(50) DEFAULT NULL',
     345                        'meli_family_name'         => 'varchar(200) DEFAULT NULL',
     346                        'meli_user_product_id'     => 'varchar(50) DEFAULT NULL',
     347                        'meli_seller_custom_field' => 'varchar(50) DEFAULT NULL',
     348                        'meli_family_is_parent'    => 'tinyint(1) DEFAULT 0',
     349                        'meli_parent_listing_id'   => 'varchar(50) DEFAULT NULL',
     350                    ),
     351                ),
     352            );
    354353
    355354            foreach ( $tables as $table_key => $changes ) {
     
    369368            }
    370369
    371            
    372         }
    373 
    374         // Actualizamos la versión guardada
     370        // Actualizamos la versión guardada
    375371        update_option( 'meliconnect_db_version', MELICONNECT_DATABASE_VERSION );
    376372    }
  • meliconnect/trunk/includes/Core/Initialize.php

    r3485956 r3487557  
    8484        self::createDefaultOptions();
    8585
    86         //update_option( 'meliconnect_db_version', MELICONNECT_DATABASE_VERSION );
    8786    }
    8887
     
    180179
    181180    public function initApp() {
    182         add_action( 'plugins_loaded', 'meliconnect_register_text_domain' );
     181       
     182        // Check de migraciones de DB
     183       
     184        add_action('admin_init', array($this, 'maybeUpdateDatabase'));
     185
    183186
    184187        do_action( 'meliconnect_init' );
     
    201204        $cron_manager->handleCronExecution();
    202205    }
     206
     207    public function maybeUpdateDatabase() {
     208
     209        if ( ! current_user_can('manage_options') ) {
     210            return;
     211        }
     212
     213        \Meliconnect\Meliconnect\Core\DatabaseManager::meliconnect_update_tables();
     214    }
    203215
    204216    private function loadHooks() {
  • meliconnect/trunk/includes/Core/Services/ProductEdit.php

    r3485956 r3487557  
    682682                    $current_values = array();
    683683
    684                     foreach ( $value['values'] as $possible_value ) {
    685 
    686                         $current_values[ $possible_value['id'] ] = $possible_value['name'];
    687                     }
     684                    if ( !empty( $value['values'] ) && is_array( $value['values'] ) ) {
     685                        foreach ( $value['values'] as $possible_value ) {
     686                            if ( isset( $possible_value['id'], $possible_value['name'] ) ) {
     687                                $current_values[ $possible_value['id'] ] = $possible_value['name'];
     688                            }
     689                        }
     690                    }
    688691
    689692                    $current_attr_name = strtolower( $value['name'] );
  • meliconnect/trunk/includes/Modules/Importer/Services/WooCommerceProductAdapter.php

    r3485956 r3487557  
    170170            if ( is_wp_error( $response ) ) {
    171171
    172                 Helper::logData("Attempt {$attempt}: WP Error: " . $response->get_error_message());
     172                Helper::logData("Attempt {$attempt}: WP Error: " . $response->get_error_message() . ". For product data: " . wp_json_encode($productData));
    173173
    174174                // retry
     
    187187            if ( $status_code !== 200 ) {
    188188
    189                 Helper::logData("Attempt {$attempt}: HTTP Error {$status_code}");
     189                Helper::logData("Attempt {$attempt}: HTTP Error {$status_code}. For product data: " . wp_json_encode($productData));
    190190                Helper::logData("Response body: " . $body);
    191191
     
    202202            if ( empty( $body ) ) {
    203203
    204                 Helper::logData("Attempt {$attempt}: Empty response body");
     204                Helper::logData("Attempt {$attempt}: Empty response body. For product data: " . wp_json_encode($productData));
    205205
    206206                if ( $attempt < $max_retries ) {
  • meliconnect/trunk/includes/Modules/Importer/UserListingsTable.php

    r3485956 r3487557  
    234234        $hasMatch      = ( $item['is_product_match_by_name'] == 1 || $item['is_product_match_by_sku'] == 1 || $item['is_product_match_manually'] == 1 ) && isset( $item['vinculated_product_id'] ) && ! empty( $item['vinculated_product_id'] );
    235235        $product_type  = esc_sql( $item['product_type'] ?? 'simple' );
    236         $meli_response = json_decode( $item['meli_response'], true );
     236
     237
     238        $meli_response = array();
     239
     240        if ( ! empty( $item['meli_response'] ) && is_string( $item['meli_response'] ) ) {
     241            $decoded = json_decode( $item['meli_response'], true );
     242
     243            if ( json_last_error() === JSON_ERROR_NONE && is_array( $decoded ) ) {
     244                $meli_response = $decoded;
     245            }
     246        }
     247
    237248
    238249        if ( $hasMatch ) {
     
    271282                        esc_attr( $item['meli_sku'] ),
    272283                        esc_attr( $item['meli_status'] ),
    273                         esc_attr( $meli_response['price'] ),
    274                         esc_attr( $meli_response['available_quantity'] )
     284                        esc_attr( $meli_response['price'] ?? '' ),
     285                        esc_attr( $meli_response['available_quantity'] ?? '' )
    275286                    ),
    276287                );
  • meliconnect/trunk/meliconnect.php

    r3485956 r3487557  
    44Plugin URI: https://mercadolibre.meliconnect.com/
    55Description: WooCommerce & Mercado Libre integration to import, export, and synchronize products between your WooCommerce store and Mercado Libre accounts.
    6 Version: 1.7.0
     6Version: 1.7.1
    77Author: meliconnect
    88Text Domain: meliconnect
     
    2626 * Define constantes del plugin
    2727 */
    28 define( 'MELICONNECT_VERSION', '1.7.0' );
    29 define( 'MELICONNECT_DATABASE_VERSION', '1.2.5' );
     28define( 'MELICONNECT_VERSION', '1.7.1' );
     29define( 'MELICONNECT_DATABASE_VERSION', '1.2.6' );
    3030define( 'MELICONNECT_TEXTDOMAIN', 'meliconnect' );
    3131define( 'MELICONNECT_PLUGIN_ROOT', plugin_dir_path( __FILE__ ) );
  • meliconnect/trunk/readme.txt

    r3485956 r3487557  
    66Requires PHP:    8.0
    77Tested up to: 6.9
    8 Stable tag: 1.7.0
     8Stable tag: 1.7.1
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • meliconnect/trunk/vendor/composer/installed.php

    r3485956 r3487557  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '175ab91c669b22f3642320f435dce20b630e4904',
     6        'reference' => '3a565876f642f8047f7e146b28a47e92e64b7c62',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '175ab91c669b22f3642320f435dce20b630e4904',
     16            'reference' => '3a565876f642f8047f7e146b28a47e92e64b7c62',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.