CTX Feed – WooCommerce Product Feed Manager Plugin - Version 3.7.11

Version Description

(2020-09-02) = * Added: Individual scheduled events added for each feed.

Download this release

Release Info

Developer wahid0003
Plugin Icon 128x128 CTX Feed – WooCommerce Product Feed Manager Plugin
Version 3.7.11
Comparing to
See all releases

Code changes from version 3.7.10 to 3.7.11

Files changed (4) hide show
  1. README.txt +4 -1
  2. includes/cron-helper.php +29 -6
  3. includes/helper.php +4 -0
  4. woo-feed.php +18 -5
README.txt CHANGED
@@ -5,7 +5,7 @@ Tags:product feed,woocommerce product feed,google shopping feed,google shopping,
5
  Requires at least: 3.6
6
  Tested Up To: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 3.7.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -308,6 +308,9 @@ Using pro version:
308
 
309
  == Changelog ==
310
 
 
 
 
311
  = 3.7.10 (2020-09-01) =
312
  * Added: Parent Category Id attribute added.
313
 
5
  Requires at least: 3.6
6
  Tested Up To: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 3.7.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
308
 
309
  == Changelog ==
310
 
311
+ = 3.7.11 (2020-09-02) =
312
+ * Added: Individual scheduled events added for each feed.
313
+
314
  = 3.7.10 (2020-09-01) =
315
  * Added: Parent Category Id attribute added.
316
 
includes/cron-helper.php CHANGED
@@ -37,9 +37,9 @@ if ( ! function_exists( 'woo_feed_cron_update_feed' ) ) {
37
  if ( woo_feed_is_debugging_enabled() ) {
38
  $processed++;
39
  woo_feed_delete_log( $feedInfo['feedrules']['filename'] );
40
- woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], sprintf( 'Getting Data for %s feed.', $option ) );
41
  woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], 'Generating Feed VIA CRON JOB...' );
42
- woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], sprintf( 'Getting Data for %s feed.', $option ) );
43
  woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], 'Current Limit is ---.' );
44
  woo_feed_log( $feedInfo['feedrules']['filename'], 'Feed Config::' . PHP_EOL . print_r( $feedInfo['feedrules'], true ), 'info' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
45
  }
@@ -69,9 +69,20 @@ if ( ! function_exists( 'woo_feed_cron_update_single_feed' ) ) {
69
  * @return void
70
  */
71
  function woo_feed_cron_update_single_feed( $feedName ) {
 
72
  global $wpdb;
73
- $feedName = 'wf_feed_' . $feedName[0];
74
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->options WHERE option_name = %s", $feedName ), 'ARRAY_A' ); // phpcs:ignore
 
 
 
 
 
 
 
 
 
 
75
  if ( ! empty( $result ) ) {
76
  foreach ( $result as $key => $value ) {
77
  $feedInfo = maybe_unserialize( get_option( $value['option_name'] ) );
@@ -85,8 +96,20 @@ if ( ! function_exists( 'woo_feed_cron_update_single_feed' ) ) {
85
 
86
  add_action( 'woo_feed_update_single_feed', 'woo_feed_cron_update_single_feed' );
87
  }
 
88
  add_action( 'woo_feed_after_update_config', function( $data, $feed_slug ) {
89
- // Schedule Cron.
90
- wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update_single_feed', [ $feed_slug ] );
 
 
 
 
 
 
 
 
 
 
 
91
  }, 10, 3 );
92
  // End of file cron-helper.php.
37
  if ( woo_feed_is_debugging_enabled() ) {
38
  $processed++;
39
  woo_feed_delete_log( $feedInfo['feedrules']['filename'] );
40
+ woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], sprintf( 'Getting Data for %s feed.', $option['option_name'] ) );
41
  woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], 'Generating Feed VIA CRON JOB...' );
42
+ woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], sprintf( 'Getting Data for %s feed.', $option['option_name'] ) );
43
  woo_feed_log_feed_process( $feedInfo['feedrules']['filename'], 'Current Limit is ---.' );
44
  woo_feed_log( $feedInfo['feedrules']['filename'], 'Feed Config::' . PHP_EOL . print_r( $feedInfo['feedrules'], true ), 'info' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
45
  }
69
  * @return void
70
  */
71
  function woo_feed_cron_update_single_feed( $feedName ) {
72
+
73
  global $wpdb;
74
+ $feedName1 = str_replace('wf_config','',$feedName[0]);
75
+ $feedName2 = 'wf_feed_' . $feedName1;
76
+
77
+ // Delete old duplicate cron.
78
+ $old_cron_clean=get_option('woo_feed_old_cron_clean_'.$feedName[0]);
79
+ if('cleaned'!==$old_cron_clean){
80
+ wp_clear_scheduled_hook( 'woo_feed_update_single_feed',[$feedName[0]]);
81
+ update_option('woo_feed_old_cron_clean_'.$feedName[0],'cleaned');
82
+ wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update_single_feed', [ $feedName[0] ] );
83
+ }
84
+
85
+ $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->options WHERE option_name = %s", $feedName2 ), 'ARRAY_A' ); // phpcs:ignore
86
  if ( ! empty( $result ) ) {
87
  foreach ( $result as $key => $value ) {
88
  $feedInfo = maybe_unserialize( get_option( $value['option_name'] ) );
96
 
97
  add_action( 'woo_feed_update_single_feed', 'woo_feed_cron_update_single_feed' );
98
  }
99
+
100
  add_action( 'woo_feed_after_update_config', function( $data, $feed_slug ) {
101
+ // Schedule Cron.
102
+ if(!wp_next_scheduled('woo_feed_update_single_feed',[ $feed_slug ])){
103
+ wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update_single_feed', [ $feed_slug ] );
104
+ }
105
+
106
+ }, 10, 3 );
107
+
108
+ add_action( 'woo_feed_after_insert_config', function( $data, $feed_slug ) {
109
+ // Schedule Cron.
110
+ if(!wp_next_scheduled('woo_feed_update_single_feed',[ $feed_slug ])){
111
+ wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update_single_feed', [ $feed_slug ] );
112
+ }
113
+
114
  }, 10, 3 );
115
  // End of file cron-helper.php.
includes/helper.php CHANGED
@@ -1405,6 +1405,10 @@ if ( ! function_exists( 'woo_feed_delete_feed' ) ) {
1405
  delete_option( 'wf_config' . $feed_name );
1406
  $deleted = true;
1407
  }
 
 
 
 
1408
 
1409
  return $deleted;
1410
  }
1405
  delete_option( 'wf_config' . $feed_name );
1406
  $deleted = true;
1407
  }
1408
+
1409
+ // Delete cron schedule.
1410
+ $feed_cron_param='wf_config' . $feed_name;
1411
+ wp_clear_scheduled_hook( 'woo_feed_update_single_feed',[$feed_cron_param]);
1412
 
1413
  return $deleted;
1414
  }
woo-feed.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
  *
14
- * Version: 3.7.10
15
  * Author: WebAppick
16
  * Author URI: https://webappick.com/
17
  * License: GPL v2
@@ -39,7 +39,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
39
  * @var string
40
  * @since 3.1.6
41
  */
42
- define( 'WOO_FEED_FREE_VERSION', '3.7.10' );
43
  }
44
 
45
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
@@ -598,6 +598,7 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
598
  * Manage Feeds
599
  */
600
  function woo_feed_manage_feed() {
 
601
  // @TODO use admin_post_ action for form handling.
602
  // Manage action for category mapping.
603
  if ( isset( $_GET['action'] ) && 'edit-feed' == $_GET['action'] ) {
@@ -678,7 +679,7 @@ if ( ! function_exists( 'woo_feed_manage_feed' ) ) {
678
  if ( update_option( 'wf_schedule', sanitize_text_field( $_POST['wf_schedule'] ), false ) ) {
679
  wp_clear_scheduled_hook( 'woo_feed_update' );
680
  add_filter( 'cron_schedules', 'Woo_Feed_installer::cron_schedules' ); // phpcs:ignore
681
- wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update' );
682
  $update = 1; // success.
683
  } else {
684
  $update = 2; // db fail.
@@ -793,9 +794,21 @@ if ( ! function_exists( 'woo_feed_update_feed_status' ) ) {
793
  wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
794
  wp_die();
795
  }
796
- if ( ! empty( $_POST['feedName'] ) ) {
797
- $feedInfo = maybe_unserialize( get_option( sanitize_text_field( $_POST['feedName'] ) ) );
 
 
798
  $feedInfo['status'] = isset( $_POST['status'] ) && 1 == $_POST['status'] ? 1 : 0;
 
 
 
 
 
 
 
 
 
 
799
  update_option( sanitize_text_field( $_POST['feedName'] ), serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
800
  wp_send_json_success( array( 'status' => true ) );
801
  } else {
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
  *
14
+ * Version: 3.7.11
15
  * Author: WebAppick
16
  * Author URI: https://webappick.com/
17
  * License: GPL v2
39
  * @var string
40
  * @since 3.1.6
41
  */
42
+ define( 'WOO_FEED_FREE_VERSION', '3.7.11' );
43
  }
44
 
45
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
598
  * Manage Feeds
599
  */
600
  function woo_feed_manage_feed() {
601
+
602
  // @TODO use admin_post_ action for form handling.
603
  // Manage action for category mapping.
604
  if ( isset( $_GET['action'] ) && 'edit-feed' == $_GET['action'] ) {
679
  if ( update_option( 'wf_schedule', sanitize_text_field( $_POST['wf_schedule'] ), false ) ) {
680
  wp_clear_scheduled_hook( 'woo_feed_update' );
681
  add_filter( 'cron_schedules', 'Woo_Feed_installer::cron_schedules' ); // phpcs:ignore
682
+ //wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update' );
683
  $update = 1; // success.
684
  } else {
685
  $update = 2; // db fail.
794
  wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
795
  wp_die();
796
  }
797
+
798
+ $feedName=sanitize_text_field( $_POST['feedName'] );
799
+ if ( ! empty( $feedName ) ) {
800
+ $feedInfo = maybe_unserialize( get_option( $feedName ) );
801
  $feedInfo['status'] = isset( $_POST['status'] ) && 1 == $_POST['status'] ? 1 : 0;
802
+
803
+ $feed_slug=str_replace('wf_feed_','wf_config',$feedName);
804
+ if(1===$feedInfo['status']){
805
+ if(!wp_next_scheduled('woo_feed_update_single_feed',[ $feed_slug ])){
806
+ wp_schedule_event( time(), 'woo_feed_corn', 'woo_feed_update_single_feed', [ $feed_slug ] );
807
+ }
808
+ }else{
809
+ wp_clear_scheduled_hook( 'woo_feed_update_single_feed',[ $feed_slug ]);
810
+ }
811
+
812
  update_option( sanitize_text_field( $_POST['feedName'] ), serialize( $feedInfo ), false ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
813
  wp_send_json_success( array( 'status' => true ) );
814
  } else {