index.php
1 year ago
upgrade-1.48.4.php
1 year ago
upgrade-1.48.5.php
1 year ago
upgrade-1.52.1.php
5 days ago
upgrade-2.0.0.php
1 year ago
upgrade-2.0.8.php
1 week ago
upgrade-2.0.9.php
5 days ago
upgrade-2.1.0.php
2 days ago
upgrade-2.1.0.php
43 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Legacy license migration: exchange patch then flat-map retirement. |
| 4 | * |
| 5 | * Phase A: POST shop /license/exchange for each unique legacy key → advanced-ads-app-licenses. |
| 6 | * Phase B: Local retire advanced-ads-licenses flat map + bootstrap AA add-ons. |
| 7 | * |
| 8 | * @package AdvancedAds |
| 9 | * @author Advanced Ads <info@wpadvancedads.com> |
| 10 | * @since 2.1.0 |
| 11 | */ |
| 12 | |
| 13 | use AdvancedAds\Crons\Licenses as License_Cron; |
| 14 | use AdvancedAds\License\License; |
| 15 | use AdvancedAds\License\License_Utils; |
| 16 | |
| 17 | defined( 'ABSPATH' ) || exit; |
| 18 | |
| 19 | /** |
| 20 | * Exchange legacy keys for rich rows, then retire the flat addon map when ready. |
| 21 | * |
| 22 | * @return void |
| 23 | */ |
| 24 | function advads_upgrade_2_1_0_migrate_legacy_licenses(): void { |
| 25 | if ( License::is_flat_map_retired() ) { |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | $map = License_Utils::normalize_legacy_map( get_option( License::OPTION_LEGACY_MAP, [] ) ); |
| 30 | if ( [] === $map ) { |
| 31 | update_option( License::OPTION_FLAT_MAP_RETIRED, '1', false ); |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | License::maybe_complete_legacy_license_migration(); |
| 36 | |
| 37 | if ( License::is_flat_map_retired() ) { |
| 38 | License_Cron::schedule_license_expiry( License::get_licenses() ); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | advads_upgrade_2_1_0_migrate_legacy_licenses(); |
| 43 |