autoship_legacy_version_trigger_handler (function)

(src/upgrade.php) handles upgrades from the legacy Autoship versions. It takes the $version being upgraded to and the the $init_global (initialize) sync option as its parameters.

Function

 
/**
 * The legacy upgrade handler.
 * @param string $version The version to which was just upgraded to.
 * @param bool $init_global True to set the global sync option.
 */
function autoship_legacy_version_trigger_handler( $version, $init_global = true ){

  if ( $init_global )
  autoship_set_global_sync_active_enabled('yes');

  // Get the upgrade link
  $link = add_query_arg( 'autoship_activate_sync_upgrade','upgrade', autoship_admin_settings_tab_url( 'autoship-utilities' ) );

  set_transient( 'autoship_sync_upgrade_activated',
  sprintf(
    __( '<h2>Autoship Cloud Upgrade Notice</h2><hr/><p style="max-width: 880px;"><strong>Important Action Required:</strong> You\'ve upgraded to a version of Autoship Cloud powered by QPilot that requires an update to your WooCommerce Product Data to fully utilize the latest enhancements to Product data and synchronization.</p><p><a class="button button-primary" href="%s">%s</a></p>'),
    $link , __( 'Update Product Synchronization', 'autoship') )
  );
}