| @@ -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 | /** |