| 1 |
<?php |
| 2 |
/** |
| 3 |
* Deprecated features and migration functions |
| 4 |
* |
| 5 |
* @package Powerkit |
| 6 |
* @subpackage Core |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* Migration to 2.0.7 |
| 11 |
* |
| 12 |
* @param string $current Current version. |
| 13 |
* @param string $new New version. |
| 14 |
*/ |
| 15 |
add_action( 'powerkit_plugin_upgrade', function ( $current, $new ) { |
| 16 |
/* Migration to 2.0.7 */ |
| 17 |
if ( version_compare( $current, '2.0.7', '<' ) ) { |
| 18 |
require_once POWERKIT_PATH . 'modules/post-views/helpers/db-powerkit-post-views.php'; |
| 19 |
|
| 20 |
$post_views_db = new Powerkit_Post_Views_DB(); |
| 21 |
|
| 22 |
$post_views_db->activate_single(); |
| 23 |
} |
| 24 |
}, 10, 2 ); |
| 25 |
|
| 26 |
/** |
| 27 |
* Migration to 2.2.2 |
| 28 |
* |
| 29 |
* @param string $current Current version. |
| 30 |
* @param string $new New version. |
| 31 |
*/ |
| 32 |
add_action( 'powerkit_plugin_upgrade', function ( $current, $new ) { |
| 33 |
/* Migration to 2.2.2 */ |
| 34 |
if ( version_compare( $current, '2.2.2', '<' ) ) { |
| 35 |
$transients = array( |
| 36 |
'powerkit_connect_instagram_app_access_token', |
| 37 |
'powerkit_connect_instagram_app_type', |
| 38 |
'powerkit_connect_instagram_app_user_id', |
| 39 |
'powerkit_connect_instagram_app_username', |
| 40 |
'powerkit_connect_instagram_app_refresh', |
| 41 |
'powerkit_connect_facebook_app_access_token', |
| 42 |
'powerkit_connect_facebook_app_accounts', |
| 43 |
'powerkit_connect_facebook_app_refresh', |
| 44 |
'powerkit_connect_twitter_app_user_id', |
| 45 |
'powerkit_connect_twitter_app_screen_name', |
| 46 |
'powerkit_connect_twitter_app_oauth_token', |
| 47 |
'powerkit_connect_twitter_app_oauth_token_secret', |
| 48 |
); |
| 49 |
|
| 50 |
foreach ( $transients as $key => $transient ) { |
| 51 |
if ( get_transient( $transient ) && ! get_option( $transient ) ) { |
| 52 |
update_option( $transient, get_transient( $transient ) ); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
if ( ! wp_next_scheduled( 'event_access_token_refresh' ) ) { |
| 57 |
wp_schedule_event( time(), 'daily', 'event_access_token_refresh' ); |
| 58 |
} |
| 59 |
} |
| 60 |
}, 10, 2 ); |
| 61 |
|
| 62 |
/** |
| 63 |
* Migration to 2.3.0 |
| 64 |
* |
| 65 |
* @param string $current Current version. |
| 66 |
* @param string $new New version. |
| 67 |
*/ |
| 68 |
add_action( 'powerkit_plugin_upgrade', function ( $current, $new ) { |
| 69 |
/* Migration to 2.3.0 */ |
| 70 |
if ( version_compare( $current, '2.3.0', '<' ) ) { |
| 71 |
if ( 'before' === get_option( 'powerkit_toc_display', 'none' ) ) { |
| 72 |
update_option( 'powerkit_toc_enable_automatically', true ); |
| 73 |
} |
| 74 |
if ( 'after' === get_option( 'powerkit_toc_display', 'none' ) ) { |
| 75 |
update_option( 'powerkit_toc_enable_automatically', true ); |
| 76 |
} |
| 77 |
} |
| 78 |
}, 10, 2 ); |
| 79 |
|