コード例 #1
0
ファイル: class-upgrade.php プロジェクト: Didox/beminfinito
 /**
  * Run the Yoast SEO 1.5 upgrade routine
  *
  * @param string $version Current plugin version.
  */
 private function upgrade_15($version)
 {
     // Clean up options and meta.
     WPSEO_Options::clean_up(null, $version);
     WPSEO_Meta::clean_up();
     // Add new capabilities on upgrade.
     wpseo_add_capabilities();
 }
コード例 #2
0
/**
 * Run the upgrade procedures.
 *
 * @todo - [JRF => Yoast] check: if upgrade is run on multi-site installation, upgrade for all sites ?
 * Maybe not necessary as it is now run on plugins_loaded, so upgrade will run as soon as any page
 * on a site is requested.
 */
function wpseo_do_upgrade() {
	$option_wpseo = get_option( 'wpseo' );

	if ( $option_wpseo['version'] === '' || version_compare( $option_wpseo['version'], '1.2', '<' ) ) {
		add_action( 'init', 'wpseo_title_test' );
	}

	if ( $option_wpseo['version'] === '' || version_compare( $option_wpseo['version'], '1.4.13', '<' ) ) {
		// Run description test once theme has loaded
		add_action( 'init', 'wpseo_description_test' );
	}

	if ( $option_wpseo['version'] === '' || version_compare( $option_wpseo['version'], '1.4.15', '<' ) ) {
		add_action( 'shutdown', 'flush_rewrite_rules' );
	}

	if ( version_compare( $option_wpseo['version'], '1.5.0', '<' ) ) {

		// Clean up options and meta
		WPSEO_Options::clean_up( null, $option_wpseo['version'] );
		WPSEO_Meta::clean_up();

		// Add new capabilities on upgrade
		wpseo_add_capabilities();
	}

	/* Only correct the breadcrumb defaults for upgrades from v1.5+ to v1.5.2.3, upgrades from earlier version
	   will already get this functionality in the clean_up routine. */
	if ( version_compare( $option_wpseo['version'], '1.4.25', '>' ) && version_compare( $option_wpseo['version'], '1.5.2.3', '<' ) ) {
		add_action( 'init', array( 'WPSEO_Options', 'bring_back_breadcrumb_defaults' ), 3 );
	}

	if ( version_compare( $option_wpseo['version'], '1.4.25', '>' ) && version_compare( $option_wpseo['version'], '1.5.2.4', '<' ) ) {
		/* Make sure empty maintax/mainpt strings will convert to 0 */
		WPSEO_Options::clean_up( 'wpseo_internallinks', $option_wpseo['version'] );

		/* Remove slashes from taxonomy meta texts */
		WPSEO_Options::clean_up( 'wpseo_taxonomy_meta', $option_wpseo['version'] );
	}

	// Make sure version nr gets updated for any version without specific upgrades
	$option_wpseo = get_option( 'wpseo' ); // re-get to make sure we have the latest version
	if ( version_compare( $option_wpseo['version'], WPSEO_VERSION, '<' ) ) {
		update_option( 'wpseo', $option_wpseo );
	}
}
コード例 #3
0
/**
 * Run the upgrade procedures.
 *
 * @todo - [JRF => Yoast] check: if upgrade is run on multi-site installation, upgrade for all sites ?
 * Maybe not necessary as it is now run on plugins_loaded, so upgrade will run as soon as any page
 * on a site is requested.
 */
function wpseo_do_upgrade()
{
    /* Make sure title_test and description_test functions are available */
    require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    $option_wpseo = get_option('wpseo');
    WPSEO_Options::maybe_set_multisite_defaults(false);
    //	if ( $option_wpseo['version'] === '' || version_compare( $option_wpseo['version'], '1.2', '<' ) ) {
    //		add_action( 'init', 'wpseo_title_test' );
    //	}
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.13', '<')) {
        // Run description test once theme has loaded
        add_action('init', 'wpseo_description_test');
    }
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.15', '<')) {
        add_action('shutdown', 'flush_rewrite_rules');
    }
    if (version_compare($option_wpseo['version'], '1.5.0', '<')) {
        // Clean up options and meta
        WPSEO_Options::clean_up(null, $option_wpseo['version']);
        WPSEO_Meta::clean_up();
        // Add new capabilities on upgrade
        wpseo_add_capabilities();
    }
    /* Only correct the breadcrumb defaults for upgrades from v1.5+ to v1.5.2.3, upgrades from earlier version
       will already get this functionality in the clean_up routine. */
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.3', '<')) {
        add_action('init', array('WPSEO_Options', 'bring_back_breadcrumb_defaults'), 3);
    }
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.4', '<')) {
        /* Make sure empty maintax/mainpt strings will convert to 0 */
        WPSEO_Options::clean_up('wpseo_internallinks', $option_wpseo['version']);
        /* Remove slashes from taxonomy meta texts */
        WPSEO_Options::clean_up('wpseo_taxonomy_meta', $option_wpseo['version']);
    }
    /* Clean up stray wpseo_ms options from the options table, option should only exist in the sitemeta table */
    delete_option('wpseo_ms');
    // Make sure version nr gets updated for any version without specific upgrades
    $option_wpseo = get_option('wpseo');
    // re-get to make sure we have the latest version
    if (version_compare($option_wpseo['version'], WPSEO_VERSION, '<')) {
        update_option('wpseo', $option_wpseo);
    }
    // Make sure all our options always exist - issue #1245
    WPSEO_Options::ensure_options_exist();
}
コード例 #4
0
 /**
  * Execute upgrade actions when needed
  */
 function upgrade()
 {
     $options = get_option('wpseo_video');
     // early bail if dbversion is equal to current version
     if (isset($options['dbversion']) && version_compare($options['dbversion'], WPSEO_VIDEO_VERSION, '==')) {
         return;
     }
     $yoast_product = new Yoast_Product_WPSEO_Video();
     $license_manager = new Yoast_Plugin_License_Manager($yoast_product);
     // upgrade to license manager
     if ($license_manager->get_license_key() === '') {
         if (isset($options['yoast-video-seo-license'])) {
             $license_manager->set_license_key($options['yoast-video-seo-license']);
         }
         if (isset($options['yoast-video-seo-license-status'])) {
             $license_manager->set_license_status($options['yoast-video-seo-license-status']);
         }
         update_option('wpseo_video', $options);
     }
     // upgrade to new option & meta classes
     if (!isset($options['dbversion']) || version_compare($options['dbversion'], '1.6', '<')) {
         $this->option_instance->clean();
         WPSEO_Meta::clean_up();
         // Make sure our meta values are cleaned up even if WP SEO would have been upgraded already
     }
     // Re-add missing durations
     if (!isset($options['dbversion']) || version_compare($options['dbversion'], '1.7', '<') && version_compare($options['dbversion'], '1.6', '>')) {
         WPSEO_Meta_Video::re_add_durations();
     }
     // Recommend re-index
     if (isset($options['dbversion']) && version_compare($options['dbversion'], '1.8', '<')) {
         set_transient('video_seo_recommend_reindex', 1);
     }
     // Make sure version nr gets updated for any version without specific upgrades
     $options = get_option('wpseo_video');
     // re-get to make sure we have the latest version
     if (version_compare($options['dbversion'], WPSEO_VIDEO_VERSION, '<')) {
         $options['dbversion'] = WPSEO_VIDEO_VERSION;
         update_option('wpseo_video', $options);
     }
 }
コード例 #5
0
/**
 * Run the upgrade procedures.
 *
 * @todo - [JRF => Yoast] check: if upgrade is run on multi-site installation, upgrade for all sites ?
 * Maybe not necessary as it is now run on plugins_loaded, so upgrade will run as soon as any page
 * on a site is requested.
 */
function wpseo_do_upgrade()
{
    /* Make sure title_test and description_test functions are available */
    require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    $option_wpseo = get_option('wpseo');
    WPSEO_Options::maybe_set_multisite_defaults(false);
    // Just flush rewrites, always, to at least make them work after an upgrade.
    add_action('shutdown', 'flush_rewrite_rules');
    WPSEO_Utils::clear_sitemap_cache();
    if (version_compare($option_wpseo['version'], '1.8.0', '<')) {
        $options_titles = get_option('wpseo_titles');
        $options_permalinks = get_option('wpseo_permalinks');
        foreach (array('hide-feedlinks', 'hide-rsdlink', 'hide-shortlink', 'hide-wlwmanifest') as $hide) {
            if (isset($options_titles[$hide])) {
                $options_permalinks[$hide] = $options_titles[$hide];
                unset($options_titles[$hide]);
                update_option('wpseo_permalinks', $options_permalinks);
                update_option('wpseo_titles', $options_titles);
            }
        }
        unset($options_titles, $options_permalinks);
        $options_social = get_option('wpseo_social');
        if (isset($option_wpseo['pinterestverify'])) {
            $options_social['pinterestverify'] = $option_wpseo['pinterestverify'];
            unset($option_wpseo['pinterestverify']);
            update_option('wpseo_social', $options_social);
            update_option('wpseo', $option_wpseo);
        }
        unset($options_social);
    }
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.13', '<')) {
        // Run description test once theme has loaded
        add_action('init', 'wpseo_description_test');
    }
    if (version_compare($option_wpseo['version'], '1.5.0', '<')) {
        // Clean up options and meta
        WPSEO_Options::clean_up(null, $option_wpseo['version']);
        WPSEO_Meta::clean_up();
        // Add new capabilities on upgrade
        wpseo_add_capabilities();
    }
    /* Only correct the breadcrumb defaults for upgrades from v1.5+ to v1.5.2.3, upgrades from earlier version
       will already get this functionality in the clean_up routine. */
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.3', '<')) {
        add_action('init', array('WPSEO_Options', 'bring_back_breadcrumb_defaults'), 3);
    }
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.4', '<')) {
        /* Make sure empty maintax/mainpt strings will convert to 0 */
        WPSEO_Options::clean_up('wpseo_internallinks', $option_wpseo['version']);
        /* Remove slashes from taxonomy meta texts */
        WPSEO_Options::clean_up('wpseo_taxonomy_meta', $option_wpseo['version']);
    }
    /* Clean up stray wpseo_ms options from the options table, option should only exist in the sitemeta table */
    delete_option('wpseo_ms');
    // Make sure version nr gets updated for any version without specific upgrades
    $option_wpseo = get_option('wpseo');
    // re-get to make sure we have the latest version
    if (version_compare($option_wpseo['version'], WPSEO_VERSION, '<')) {
        update_option('wpseo', $option_wpseo);
    }
    // Make sure all our options always exist - issue #1245
    WPSEO_Options::ensure_options_exist();
    add_action('admin_footer', 'wpseo_redirect_to_about');
}