PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.11.0
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.11.0
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / class / Common / FeedCacheUpdater.php
reviews-feed / class / Common Last commit date
Admin 1 week ago Builder 1 week ago Customizer 1 week ago Exceptions 1 week ago Helpers 1 week ago Integrations 1 week ago Migrations 1 week ago ReviewAlerts 1 week ago Services 1 week ago Settings 1 week ago Support 1 week ago Traits 1 week ago UsageTracking 1 week ago Utils 1 week ago AuthorizationStatusCheck.php 1 week ago BusinessDataCache.php 1 week ago Clear_Cache.php 1 week ago Container.php 1 week ago DisplayElements.php 1 week ago Email_Notification.php 1 week ago Error_Reporter.php 1 week ago Feed.php 1 week ago FeedCache.php 1 week ago FeedCacheUpdater.php 1 week ago FeedDisplay.php 1 week ago Feed_Locator.php 1 week ago Parser.php 1 week ago PostAggregator.php 1 week ago RemoteRequest.php 1 week ago SBR_Education.php 1 week ago SBR_Schema_Service.php 1 week ago SBR_Settings.php 1 week ago ServiceContainer.php 1 week ago SinglePostCache.php 1 week ago TemplateRenderer.php 1 week ago Tooltip_Wizard.php 1 week ago Util.php 1 week ago
FeedCacheUpdater.php
63 lines
1 <?php
2
3 /**
4 * Class FeedCacheUpdater
5 *
6 * @since 1.0
7 */
8
9 namespace SmashBalloon\Reviews\Common;
10
11 class FeedCacheUpdater {
12 /**
13 * @var array
14 */
15 private $batch;
16
17 public function __construct($batch)
18 {
19 $this->batch = $batch;
20 }
21
22 public function do_updates()
23 {
24 $refreshed_feed_ids = array();
25
26 foreach ($this->batch as $single_feed) {
27 $feed_id = ! empty($single_feed['feed_id']) ? (int) $single_feed['feed_id'] : 0;
28 if ($feed_id <= 0) {
29 continue;
30 }
31
32 // Hydrate the feed settings from wp_sbr_feeds the same way the
33 // shortcode render path does — without this, the Feed constructor
34 // gets a near-empty settings array (just `['feed' => N]`) and
35 // update_posts_cache()/update_header_cache() short-circuit on the
36 // `empty($settings['sources'])` guard, leaving the cron a silent
37 // no-op for the cached upstream fetch it is supposed to drive.
38 $settings = SBR_Settings::get_settings_by_feed_id($feed_id, false, false);
39 $feed_cache = new FeedCache((string) $feed_id, 0);
40
41 $feed = Util::sbr_is_pro()
42 ? new \SmashBalloon\Reviews\Pro\Feed($settings, $feed_id, $feed_cache)
43 : new \SmashBalloon\Reviews\Common\Feed($settings, $feed_id, $feed_cache);
44
45 $feed->init();
46 if (! empty($feed->get_errors())) {
47 continue;
48 }
49
50 $feed->get_set_cache();
51 $refreshed_feed_ids[] = $feed_id;
52 }
53
54 // Notify listeners that the upstream-cache rows have been repopulated.
55 // SBR_Feed_Saver_Manager subscribes here to re-flush 3rd-party page
56 // caches (WP Rocket / LiteSpeed / W3TC etc) so any empty-feed HTML
57 // they baked during the cron warm-up window is evicted.
58 if (! empty($refreshed_feed_ids)) {
59 do_action('sbr_after_cron_refresh', $refreshed_feed_ids);
60 }
61 }
62 }
63