| 1 |
<?php |
| 2 |
|
| 3 |
if (! defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if (class_exists('WCPN_Upgrade_Migration_v3_0_4')) { |
| 8 |
return new WCPN_Upgrade_Migration_v3_0_4(); |
| 9 |
} |
| 10 |
|
| 11 |
/** |
| 12 |
* Migrates pre v3.0.4 settings |
| 13 |
*/ |
| 14 |
class WCPN_Upgrade_Migration_v3_0_4 |
| 15 |
{ |
| 16 |
public function __construct() |
| 17 |
{ |
| 18 |
$old_settings = get_option('woocommerce_postnl_checkout_settings'); |
| 19 |
$new_settings = $old_settings; |
| 20 |
|
| 21 |
// Add/replace new settings |
| 22 |
$new_settings['use_split_address_fields'] = '1'; |
| 23 |
|
| 24 |
// Rename signed to signature for consistency |
| 25 |
$new_settings['signature_enabled'] = $old_settings['signed_enabled']; |
| 26 |
$new_settings['signature_title'] = $old_settings['signed_title']; |
| 27 |
$new_settings['signature_fee'] = $old_settings['signed_fee']; |
| 28 |
|
| 29 |
// Remove old settings |
| 30 |
unset($new_settings['signed_enabled']); |
| 31 |
unset($new_settings['signed_title']); |
| 32 |
unset($new_settings['signed_fee']); |
| 33 |
|
| 34 |
update_option('woocommerce_postnl_checkout_settings', $new_settings); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
new WCPN_Upgrade_Migration_v3_0_4(); |
| 39 |
|