Plugin Directory

Changeset 3303554


Ignore:
Timestamp:
05/30/2025 11:57:13 AM (10 months ago)
Author:
arture
Message:

Version 4.1.6

Location:
storecontrl-wp-connection/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • storecontrl-wp-connection/trunk/includes/admin/class-storecontrl-wp-connection-admin.php

    r3275641 r3303554  
    1212        add_filter('cron_schedules', array( $this, 'storecontrl_connect_cron_schedules') );
    1313        add_action('admin_post_download_log', array($this, 'handle_log_download_request'));
     14
     15        add_action( 'init', array($this, 'sc_renew_crontrol_url_crons') );
     16    }
     17
     18    function sc_renew_crontrol_url_crons() {
     19        // Check of WP Crontrol's functie beschikbaar is
     20        if ( ! function_exists( 'wp_schedule_event' ) || ! function_exists( 'get_option' ) ) {
     21            return;
     22        }
     23
     24        // Alleen uitvoeren als WP Crontrol geactiveerd is
     25        if ( ! defined( 'WP_CRONTROL_VERSION' ) ) {
     26            return;
     27        }
     28
     29        $target_urls = [
     30            site_url().'/storecontrl-process-stockchanges',
     31            site_url().'/storecontrl-process-changes',
     32            site_url().'/storecontrl-process-products',
     33        ];
     34
     35        $cron_array = _get_cron_array();
     36        $existing = [];
     37
     38        // Zoek bestaande crontrol_url_cron_job entries
     39        foreach ( $cron_array as $timestamp => $crons ) {
     40            foreach ( $crons as $hook => $jobs ) {
     41                if ( $hook === 'crontrol_url_cron_job' ) {
     42                    foreach ( $jobs as $job ) {
     43                        if ( isset( $job['args'][0] ) ) {
     44                            $existing[] = $job['args'][0];
     45                        }
     46                    }
     47                }
     48            }
     49        }
     50
     51        // Voeg ontbrekende URL's toe (interval: every 5 minutes)
     52        foreach ( $target_urls as $url ) {
     53            if ( ! in_array( $url, $existing, true ) ) {
     54                wp_schedule_event( time(), 'storecontrl_connect', 'crontrol_url_cron_job', [ $url ] );
     55                error_log( '[CRON HERSTEL] Toegevoegd: ' . $url );
     56            }
     57        }
    1458    }
    1559
  • storecontrl-wp-connection/trunk/includes/cronjob/class-storecontrl-cronjob-functions.php

    r3275641 r3303554  
    898898            print_r($changes);
    899899            echo '</pre>';
    900 
    901             $api_calls = array();
    902             foreach ($changes as $change) {
    903                 $api_calls[] = $change['api_name'];
    904             }
    905900            if( isset($changes) && !empty($changes) ) {
    906901
  • storecontrl-wp-connection/trunk/readme.txt

    r3275641 r3303554  
    55Requires at least: 6.0.0
    66Tested up to: 6.7.2
    7 Stable tag: 4.1.5
     7Stable tag: 4.1.6
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    9393== Changelog ==
    9494
     95= 4.1.6 =
     96* Auto renew fallback for WP Crontrol
     97
    9598= 4.1.5 =
    9699* Queue check for empty batch files
  • storecontrl-wp-connection/trunk/storecontrl-wp-connection.php

    r3275641 r3303554  
    44Plugin URI:  http://www.arture.nl/storecontrl
    55Description: The Wordpress plugin for connecting Woocommerce with StoreContrl Cloud. With the synchronizing cronjobs your products will be automatically processed, images added, and the categories set. Every 5 minutes all stock changes are processed. We provide a up-to-date plugin, easy setup and always the best support.
    6 Version:     4.1.5
     6Version:     4.1.6
    77Requires Plugins: woocommerce
    88Author:      Arture
Note: See TracChangeset for help on using the changeset viewer.