WPSEO_Upgrade::upgrade_189()privateYoast 1.0

Performs the 18.9 upgrade routine.

Метод класса: WPSEO_Upgrade{}

Хуков нет.

Возвращает

null. Ничего.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->upgrade_189();

Код WPSEO_Upgrade::upgrade_189() Yoast 20.3

private function upgrade_189() {
	// Make old users not get the Installation Success page after upgrading.
	WPSEO_Options::set( 'should_redirect_after_install_free', false );
	// We're adding a hardcoded time here, so that in the future we can be able to identify whether the user did see the Installation Success page or not.
	// If they did, they wouldn't have this hardcoded value in that option, but rather (roughly) the timestamp of the moment they saw it.
	WPSEO_Options::set( 'activation_redirect_timestamp_free', 1652258756 );

	// Transfer the Social URLs.
	$other   = [];
	$other[] = WPSEO_Options::get( 'instagram_url' );
	$other[] = WPSEO_Options::get( 'linkedin_url' );
	$other[] = WPSEO_Options::get( 'myspace_url' );
	$other[] = WPSEO_Options::get( 'pinterest_url' );
	$other[] = WPSEO_Options::get( 'youtube_url' );
	$other[] = WPSEO_Options::get( 'wikipedia_url' );

	WPSEO_Options::set( 'other_social_urls', array_values( array_unique( array_filter( $other ) ) ) );

	// Transfer the progress of the old Configuration Workout.
	$workout_data      = WPSEO_Options::get( 'workouts_data' );
	$old_conf_progress = isset( $workout_data['configuration']['finishedSteps'] ) ? $workout_data['configuration']['finishedSteps'] : [];

	if ( in_array( 'optimizeSeoData', $old_conf_progress, true ) && in_array( 'siteRepresentation', $old_conf_progress, true ) ) {
		// If completed ‘SEO optimization’ and ‘Site representation’ step, we assume the workout was completed.
		$configuration_finished_steps = [
			'siteRepresentation',
			'socialProfiles',
			'personalPreferences',
		];
		WPSEO_Options::set( 'configuration_finished_steps', $configuration_finished_steps );
	}
}