=' ) ) { return; } // Existing stores should set the upgraded version and the onboarding wizard as complete. if ( ! empty( $edd_version ) ) { update_option( 'edd_version_upgraded_from', $edd_version, false ); if ( ! get_option( 'edd_onboarding_completed', false ) && ! get_option( 'edd_onboarding_started', false ) ) { update_option( 'edd_onboarding_completed', true, false ); } } edd_update_db_version(); } add_action( 'admin_init', 'edd_do_automatic_upgrades' ); /** * Display Upgrade Notices * * @since 1.3.1 * @return void */ function edd_show_upgrade_notices() { // Don't show notices on the upgrades page $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); if ( ! empty( $page ) && ( 'edd-upgrades' === $page ) ) { return; } $screen = get_current_screen(); if ( 'site-health' === $screen->id ) { return; } // Sequential Orders was the first stepped upgrade, so check if we have a stalled upgrade $resume_upgrade = edd_maybe_resume_upgrade(); if ( ! empty( $resume_upgrade ) ) { EDD()->notices->add_notice( array( 'id' => 'edd-resume-upgrade', 'class' => 'error', 'message' => sprintf( /* translators: %s: Resume upgrade link */ __( 'Easy Digital Downloads needs to complete a database upgrade that was previously started, click here to resume the upgrade.', 'easy-digital-downloads' ), esc_url( add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ) ) ), 'is_dismissible' => false, ) ); } else { // Include all 'Stepped' upgrade process notices in this else statement, // to avoid having a pending, and new upgrade suggested at the same time if ( get_option( 'edd_upgrade_sequential' ) ) { delete_option( 'edd_upgrade_sequential' ); } /** 3.0 Upgrades ******************************************************/ // Check if we need to do any upgrades. if ( ! edd_v30_is_migration_complete() ) { // If any EDD 2.x data exists, the migration should be run. $needs_migration = _edd_needs_v3_migration(); $version = false; // If the migration doesn't need to be run, mark the upgrades as complete. if ( ! $needs_migration ) { $upgrades = edd_get_v30_upgrades(); $upgrades = array_keys( $upgrades ); foreach ( $upgrades as $upgrade ) { edd_set_upgrade_complete( $upgrade ); } } else { $component = edd_get_component( 'order' ); $table = $component->get_interface( 'table' ); if ( ! empty( $table ) ) { $version = $table->get_version(); } } // The migration needs to be run, and the database table exists. if ( $needs_migration && $version ) { ?>

', '' ); ?>

', '' ); ?>

', '' ); ?>

', '', '
', 'wp edd v30_migration' ); ?>

'edd-upgrades', 'edd-upgrade' => 'v30_migration', ), admin_url() ); ?>

db_version(); // The database version is the problem. if ( version_compare( $database_version, '5.6', '<' ) ) { $message .= ' ' . sprintf( /* translators: 1. opening anchor tag, do not translate; 2. closing anchor tag, do not translate; 3. MySQL database version, do not translate */ __( 'Please contact your host and ask them to upgrade your environment to meet our %1$sminimum technical requirements%2$s. Your MySQL version is %3$s and needs to be updated.', 'easy-digital-downloads' ), '', '', $database_version ); } else { $message .= ' ' . sprintf( /* translators: 1. opening anchor tag, do not translate; 2. closing anchor tag, do not translate */ __( '%1$sContact our support team%2$s for help with next steps.', 'easy-digital-downloads' ), '', '' ); } ?>

array( 'name' => __( 'Tax Rates', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Tax_Rates' ), 'migrate_discounts' => array( 'name' => __( 'Discounts', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Discounts' ), 'migrate_orders' => array( 'name' => __( 'Orders', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Orders' ), 'migrate_customer_addresses' => array( 'name' => __( 'Customer Addresses', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Customer_Addresses' ), 'migrate_customer_email_addresses' => array( 'name' => __( 'Customer Email Addresses', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Customer_Email_Addresses' ), 'migrate_customer_notes' => array( 'name' => __( 'Customer Notes', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Customer_Notes' ), 'migrate_logs' => array( 'name' => __( 'Logs', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Logs' ), 'migrate_order_notes' => array( 'name' => __( 'Order Notes', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Order_Notes' ), 'v30_legacy_data_removed' => array( 'name' => __( 'Remove Legacy Data', 'easy-digital-downloads' ), 'class' => 'EDD\\Admin\\Upgrades\\v3\\Remove_Legacy_Data' ) ); } /** * Render 3.0 upgrade page. * * @since 3.0 */ function edd_upgrade_render_v30_migration() { $upgrades = edd_get_v30_upgrades(); $upgrade_statuses = array_fill_keys( array_keys( $upgrades ), false ); $number_complete = 0; foreach ( $upgrade_statuses as $upgrade_key => $status ) { if ( edd_has_upgrade_completed( $upgrade_key ) ) { $upgrade_statuses[ $upgrade_key ] = true; $number_complete++; continue; } // Let's see if we have a step in progress. $current_step = get_option( 'edd_v3_migration_step_' . $upgrade_key ); if ( ! empty( $current_step ) ) { $upgrade_statuses[ $upgrade_key ] = absint( $current_step ); } } $migration_complete = $number_complete === count( $upgrades ); /* * Determine if legacy data can be removed. * It can be if all upgrades except legacy data have been completed. */ $can_remove_legacy_data = array_key_exists( 'v30_legacy_data_removed', $upgrade_statuses ) && $upgrade_statuses[ 'v30_legacy_data_removed' ] !== true; if ( $can_remove_legacy_data ) { foreach( $upgrade_statuses as $upgrade_key => $status ) { if ( 'v30_legacy_data_removed' === $upgrade_key ) { continue; } // If there's at least one upgrade still unfinished, we can't remove legacy data. if ( true !== $status ) { $can_remove_legacy_data = false; break; } } } if ( $migration_complete ) { ?>

Database Upgrade Complete: All database upgrades have been completed.', 'easy-digital-downloads' ), array( 'strong' => array() ) ); ?>

Important: Do not navigate away from this page until all upgrades have completed.', 'easy-digital-downloads' ), array( 'strong' => array() ) ); ?>

wp edd v30_migration' ); ?>

>

>

Important: This removes all legacy data from where it was previously stored in custom post types and post meta. This is an optional step that is not reversible. Please back up your database and ensure your store is operational before completing this step.', 'easy-digital-downloads' ), array( 'strong' => array() ) ); ?>

'edd-tools' ) ) ) . '">', '' ); ?>

0%