| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\Campaigns\Migrations; |
| 4 |
|
| 5 |
use Give\Framework\Migrations\Contracts\Migration; |
| 6 |
|
| 7 |
/** |
| 8 |
* Drops the campaign stats cache so it is rebuilt from scratch. Before this migration the |
| 9 |
* subscriptions cache was written under one option name and read under another, and the |
| 10 |
* rebuild migration merged donation rows into it, so what is stored cannot be trusted. |
| 11 |
* The repository repopulates the cache on demand. |
| 12 |
* |
| 13 |
* @since 4.18.0 |
| 14 |
*/ |
| 15 |
class FlushCampaignsDataCache extends Migration |
| 16 |
{ |
| 17 |
/** |
| 18 |
* @since 4.18.0 |
| 19 |
*/ |
| 20 |
public static function id(): string |
| 21 |
{ |
| 22 |
return 'flush_campaigns_data_cache'; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* @since 4.18.0 |
| 27 |
*/ |
| 28 |
public static function title(): string |
| 29 |
{ |
| 30 |
return 'Flush campaign stats cache'; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* @since 4.18.0 |
| 35 |
*/ |
| 36 |
public static function timestamp(): string |
| 37 |
{ |
| 38 |
return strtotime('2026-09-21 00:00:00'); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* @since 4.18.0 |
| 43 |
*/ |
| 44 |
public function run() |
| 45 |
{ |
| 46 |
delete_option('give_campaigns_data'); |
| 47 |
delete_option('give_campaigns_subscriptions_data'); |
| 48 |
delete_option('give_campaigns_subscription_data'); |
| 49 |
} |
| 50 |
} |
| 51 |
|