/**
 * Triggers all upgrade functions
 *
 * This function is usually triggered via AJAX
 *
 * @since 1.3.1
 * @return void
*/
function edd_trigger_upgrades()
{
    $edd_version = get_option('edd_version');
    if (!$edd_version) {
        // 1.3 is the first version to use this option so we must add it
        $edd_version = '1.3';
        add_option('edd_version', $edd_version);
    }
    if (version_compare(EDD_VERSION, $edd_version, '>')) {
        edd_v131_upgrades();
    }
    if (version_compare($edd_version, '1.3.4', '<')) {
        edd_v134_upgrades();
    }
    if (version_compare($edd_version, '1.4', '<')) {
        edd_v14_upgrades();
    }
    if (version_compare($edd_version, '1.5', '<')) {
        edd_v15_upgrades();
    }
    update_option('edd_version', EDD_VERSION);
    if (DOING_AJAX) {
        die('complete');
    }
    // Let AJAX know that the upgrade is complete
}
/**
 * Triggers all upgrade functions
 *
 * This function is usually triggered via AJAX
 *
 * @since 1.3.1
 * @return void
*/
function edd_trigger_upgrades()
{
    if (!current_user_can('manage_shop_settings')) {
        wp_die(__('You do not have permission to do shop upgrades', 'edd'), __('Error', 'edd'), array('response' => 403));
    }
    $edd_version = get_option('edd_version');
    if (!$edd_version) {
        // 1.3 is the first version to use this option so we must add it
        $edd_version = '1.3';
        add_option('edd_version', $edd_version);
    }
    if (version_compare(EDD_VERSION, $edd_version, '>')) {
        edd_v131_upgrades();
    }
    if (version_compare($edd_version, '1.3.4', '<')) {
        edd_v134_upgrades();
    }
    if (version_compare($edd_version, '1.4', '<')) {
        edd_v14_upgrades();
    }
    if (version_compare($edd_version, '1.5', '<')) {
        edd_v15_upgrades();
    }
    if (version_compare($edd_version, '2.0', '<')) {
        edd_v20_upgrades();
    }
    update_option('edd_version', EDD_VERSION);
    if (DOING_AJAX) {
        die('complete');
    }
    // Let AJAX know that the upgrade is complete
}