PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
← All changes | src/Campaigns/Migrations/CacheCampaignsData.php +7 -2 4.16.6 → 4.18.0 View file →
@@ -52,8 +52,9 @@
52 52
53 53 /**
54 54 * @inheritDoc
55 55 *
56 + * @since 4.18.0 Merge donors into the donors list and subscriptions into the subscriptions option; always compute live stats, the cache holds live stats only.
56 57 * @since 4.12.0 add early return if no campaigns found
57 58 * @since 4.8.0
58 59 *
59 60 * @throws DatabaseMigrationException
@@ -59,8 +60,10 @@
59 60 * @throws DatabaseMigrationException
60 61 */
61 62 public function runBatch($firstId, $lastId)
62 63 {
64 + add_filter('give_is_test_mode', '__return_false', PHP_INT_MAX);
65 +
63 66 try {
64 67 $query = $this->query();
65 68
66 69 // Migration Runner will pass null for lastId in the last step
@@ -92,9 +95,9 @@
92 95 $campaignsData['donationsCount'] ?? [],
93 96 $donations->collectDonations()
94 97 ),
95 98 'donorsCount' => array_merge(
96 - $campaignsData['donationsCount'] ?? [],
99 + $campaignsData['donorsCount'] ?? [],
97 100 $donations->collectDonors()
98 101 ),
99 102 ]);
100 103
@@ -99,9 +102,9 @@
99 102 ]);
100 103
101 104 // Set subscriptions data
102 105 if (defined('GIVE_RECURRING_VERSION')) {
103 - $subscriptionsData = get_option('give_campaigns_data', []);
106 + $subscriptionsData = get_option('give_campaigns_subscriptions_data', []);
104 107 $subscriptions = CampaignsDataQuery::subscriptions($campaignIds);
105 108
106 109 update_option('give_campaigns_subscriptions_data', [
107 110 'amounts' => array_merge(
@@ -119,8 +122,10 @@
119 122 ]);
120 123 }
121 124 } catch (DatabaseQueryException $exception) {
122 125 throw new DatabaseMigrationException("An error occurred while caching campaign data", 0, $exception);
126 + } finally {
127 + remove_filter('give_is_test_mode', '__return_false', PHP_INT_MAX);
123 128 }
124 129 }
125 130
126 131 /**