This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
BSF_Analytics::maybe_migrate_options()
Migrate old “analytics” options to new “usage” naming.
Description
Copies values to new options and deletes old options.
Source
File: inc/lib/bsf-analytics/class-bsf-analytics.php
private function maybe_migrate_options() {
if ( get_site_option( 'bsf_usage_migrated' ) ) {
return;
}
// Migrate global options.
$old_last_displayed = get_site_option( 'bsf_analytics_last_displayed_time' );
if ( false !== $old_last_displayed ) {
update_site_option( 'bsf_usage_last_displayed_time', $old_last_displayed );
delete_site_option( 'bsf_analytics_last_displayed_time' );
}
// Migrate per-product options.
foreach ( $this->entities as $key => $data ) {
$old_optin = get_site_option( $key . '_analytics_optin' );
if ( false !== $old_optin ) {
update_site_option( $key . '_usage_optin', $old_optin );
delete_site_option( $key . '_analytics_optin' );
}
$old_install_time = get_site_option( $key . '_analytics_installed_time' );
if ( false !== $old_install_time ) {
update_site_option( $key . '_usage_installed_time', $old_install_time );
delete_site_option( $key . '_analytics_installed_time' );
}
}
// Migrate transient.
$old_track = get_site_transient( 'bsf_analytics_track' );
if ( false !== $old_track ) {
set_site_transient( 'bsf_usage_track', $old_track, 2 * DAY_IN_SECONDS );
delete_site_transient( 'bsf_analytics_track' );
}
update_site_option( 'bsf_usage_migrated', true );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.1.17 | Introduced. |