SNS Count Cache - Version 0.9.1

Version Description

  • Fixed: Follower count is not retrieved and cached at intervals according to your configuration.

=

Download this release

Release Info

Developer marubon
Plugin Icon SNS Count Cache
Version 0.9.1
Comparing to
See all releases

Code changes from version 0.9.0 to 0.9.1

includes/class-common-job-reset-engine.php CHANGED
@@ -120,7 +120,7 @@ class Common_Job_Reset_Engine extends Engine {
120
  public function prime_reset() {
121
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
- $next_exec_time = time() + $this->check_interval;
124
 
125
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
126
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
120
  public function prime_reset() {
121
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
124
 
125
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
126
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-follow-base-cache-engine.php CHANGED
@@ -123,7 +123,7 @@ class Follow_Base_Cache_Engine extends Follow_Cache_Engine {
123
  public function prime_cache() {
124
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
 
126
- $next_exec_time = time() + $this->check_interval;
127
 
128
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
129
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
123
  public function prime_cache() {
124
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
 
126
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
127
 
128
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
129
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-follow-lazy-cache-engine.php CHANGED
@@ -112,7 +112,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
112
  public function prime_cache() {
113
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
 
115
- $next_exec_time = time() + $this->check_latency;
116
 
117
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
118
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
112
  public function prime_cache() {
113
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
 
115
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
116
 
117
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
118
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-follow-restore-cache-engine.php CHANGED
@@ -104,7 +104,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
104
  public function prime_cache() {
105
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
 
107
- $next_exec_time = time() + $this->check_latency;
108
 
109
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
110
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
104
  public function prime_cache() {
105
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
 
107
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
108
 
109
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
110
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-follow-second-cache-engine.php CHANGED
@@ -121,7 +121,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
121
  public function prime_cache() {
122
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
- $next_exec_time = time() + $this->check_interval;
125
 
126
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
127
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
121
  public function prime_cache() {
122
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
125
 
126
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
127
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-share-base-cache-engine.php CHANGED
@@ -131,7 +131,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
131
  public function prime_cache() {
132
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
- $next_exec_time = time() + $this->check_interval;
135
  $posts_total = $this->get_posts_total();
136
 
137
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
131
  public function prime_cache() {
132
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
135
  $posts_total = $this->get_posts_total();
136
 
137
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
includes/class-share-lazy-cache-engine.php CHANGED
@@ -131,7 +131,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
131
  public function prime_cache( $post_ID ) {
132
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
- $next_exec_time = time() + $this->check_latency;
135
 
136
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
137
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
131
  public function prime_cache( $post_ID ) {
132
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
135
 
136
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
137
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-share-rescue-cache-engine.php CHANGED
@@ -127,7 +127,7 @@ class Share_Rescue_Cache_Engine extends Share_Cache_Engine {
127
  public function prime_cache() {
128
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
- $next_exec_time = time() + $this->check_interval;
131
  $posts_total = $this->get_posts_total();
132
 
133
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
127
  public function prime_cache() {
128
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
131
  $posts_total = $this->get_posts_total();
132
 
133
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
includes/class-share-restore-cache-engine.php CHANGED
@@ -127,7 +127,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
127
  public function prime_cache( $post_ID ) {
128
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
- $next_exec_time = time() + $this->check_latency;
131
 
132
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
133
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
127
  public function prime_cache( $post_ID ) {
128
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
131
 
132
  Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
133
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-share-rush-cache-engine.php CHANGED
@@ -137,7 +137,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
137
  public function prime_cache() {
138
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
 
140
- $next_exec_time = time() + $this->check_interval;
141
  $posts_total = $this->get_posts_total();
142
 
143
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
137
  public function prime_cache() {
138
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
 
140
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
141
  $posts_total = $this->get_posts_total();
142
 
143
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
includes/class-share-second-cache-engine.php CHANGED
@@ -134,7 +134,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
134
  public function prime_cache() {
135
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
136
 
137
- $next_exec_time = time() + $this->check_interval;
138
 
139
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
140
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
134
  public function prime_cache() {
135
  Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
136
 
137
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
138
 
139
  Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
140
  Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
includes/class-wp-cron-util.php CHANGED
@@ -47,18 +47,20 @@ class WP_Cron_Util {
47
  public static function clear_expired_scheduled_hook( $hook, $elapsed_time ) {
48
  $crons = _get_cron_array();
49
 
50
- if ( empty( $crons ) ) return;
 
 
51
 
52
- $current_time = time();
53
 
54
  foreach( $crons as $timestamp => $cron ) {
55
  if ( isset( $cron[$hook] ) ) {
56
- $duration = $timestamp - $current_time;
57
 
58
  if ( $duration > $elapsed_time ) {
59
  foreach ( $cron[$hook] as $signature => $data ) {
60
  wp_unschedule_event( $timestamp, $hook, $data['args'] );
61
- }
62
  }
63
  }
64
  }
@@ -268,7 +270,7 @@ class WP_Cron_Util {
268
  }
269
 
270
  //calc next timestamp
271
- $current_timestamp = current_time( 'timestamp' );
272
  foreach ( $cron[ 'year' ] as $year ) {
273
  foreach ( $cron[ 'mon' ] as $mon ) {
274
  foreach ( $cron[ 'mday' ] as $mday ) {
47
  public static function clear_expired_scheduled_hook( $hook, $elapsed_time ) {
48
  $crons = _get_cron_array();
49
 
50
+ if ( empty( $crons ) ) {
51
+ return;
52
+ }
53
 
54
+ $current_time = (int) current_time( 'timestamp', 1 );
55
 
56
  foreach( $crons as $timestamp => $cron ) {
57
  if ( isset( $cron[$hook] ) ) {
58
+ $duration = $current_time - $timestamp;
59
 
60
  if ( $duration > $elapsed_time ) {
61
  foreach ( $cron[$hook] as $signature => $data ) {
62
  wp_unschedule_event( $timestamp, $hook, $data['args'] );
63
+ }
64
  }
65
  }
66
  }
270
  }
271
 
272
  //calc next timestamp
273
+ $current_timestamp = (int) current_time( 'timestamp', 1 );
274
  foreach ( $cron[ 'year' ] as $year ) {
275
  foreach ( $cron[ 'mon' ] as $mon ) {
276
  foreach ( $cron[ 'mday' ] as $mday ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
  Tested up to: 4.5.2
7
- Stable tag: 0.9.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -151,6 +151,9 @@ There are no questions.
151
  * Added: function to retrieve follower count of Push7.
152
  * Added: Information related to the above new functions is added to the help page.
153
 
 
 
 
154
  == Upgrade Notice ==
155
  The following functions are deprecated.
156
 
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
  Tested up to: 4.5.2
7
+ Stable tag: 0.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
151
  * Added: function to retrieve follower count of Push7.
152
  * Added: Information related to the above new functions is added to the help page.
153
 
154
+ = 0.9.1 =
155
+ * Fixed: Follower count is not retrieved and cached at intervals according to your configuration.
156
+
157
  == Upgrade Notice ==
158
  The following functions are deprecated.
159
 
sns-count-cache.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: SNS Count Cache
4
  Description: SNS Count Cache gets share count for Twitter and Facebook, Google Plus, Pocket, Hatena Bookmark and caches these count in the background. This plugin may help you to shorten page loading time because the share count can be retrieved not through network but through the cache using given functions.
5
- Version: 0.9.0
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
  Author URI: http://marubon.info/
@@ -619,7 +619,7 @@ final class SNS_Count_Cache implements Order {
619
  /**
620
  * Plugin version, used for cache-busting of style and script file references.
621
  */
622
- private $version = '0.9.0';
623
 
624
  /**
625
  * Instances of crawler
2
  /*
3
  Plugin Name: SNS Count Cache
4
  Description: SNS Count Cache gets share count for Twitter and Facebook, Google Plus, Pocket, Hatena Bookmark and caches these count in the background. This plugin may help you to shorten page loading time because the share count can be retrieved not through network but through the cache using given functions.
5
+ Version: 0.9.1
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
  Author URI: http://marubon.info/
619
  /**
620
  * Plugin version, used for cache-busting of style and script file references.
621
  */
622
+ private $version = '0.9.1';
623
 
624
  /**
625
  * Instances of crawler