Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -98,6 +98,103 @@ class WPSEO_Upgrade_Manager {
if ( version_compare( $version_number, '16.3-beta2', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_16_3' ], 12 );
}
if ( version_compare( $version_number, '17.2-RC0', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_17_2' ], 12 );
}
if ( version_compare( $version_number, '17.3-RC4', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_17_3' ], 12 );
}
if ( version_compare( $version_number, '17.4-RC0', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_17_4' ], 12 );
}
if ( version_compare( $version_number, '17.7-RC0', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_17_7' ], 12 );
}
if ( version_compare( $version_number, '19.3-RC0', '<' ) ) {
add_action( 'init', [ $this, 'upgrade_19_3' ], 12 );
}
}
/**
* Removes the inclusive language feature notification from the Notification center.
*
* @return void
*/
public function upgrade_19_3() {
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-inclusive-language-notice' );
}
/**
* Make sure our options autoload.
*
* @return void
*/
public function upgrade_17_7() {
global $wpdb;
foreach ( [ WPSEO_Redirect_Option::OPTION_PLAIN, WPSEO_Redirect_Option::OPTION_REGEX ] as $option ) {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Normal methods only work if the option value has changed.
$wpdb->update( $wpdb->options, [ 'autoload' => 'yes' ], [ 'option_name' => $option ] );
}
// Make sure we don't autoload the non-exported option.
$wpdb->update( $wpdb->options, [ 'autoload' => 'no' ], [ 'option_name' => WPSEO_Redirect_Option::OPTION ] );
}
/**
* Schedules the cleanup integration if it's no already scheduled.
*
* @return void
*/
public function upgrade_17_4() {
$this->retrigger_cleanup();
}
/**
* Clears the first step of the orphaned workout.
*
* @return void
*/
public function upgrade_17_3() {
$workouts_option = WPSEO_Options::get( 'workouts' );
if ( isset( $workouts_option['orphaned'] )
&& isset( $workouts_option['orphaned']['indexablesByStep'] )
&& is_array( $workouts_option['orphaned']['indexablesByStep'] )
) {
$workouts_option['orphaned']['indexablesByStep']['improveRemove'] = [];
WPSEO_Options::set( 'workouts', $workouts_option );
}
}
/**
* Schedules the cleanup integration if it's no already scheduled.
*
* @return void
*/
public function upgrade_17_2() {
$this->retrigger_cleanup();
}
/**
* Re-triggers the cleanup of old things from the database.
*
* @return void
*/
protected function retrigger_cleanup() {
// If Yoast SEO hasn't been upgraded to 17.2 the cleanup integration has not been implemented in the current way.
if ( ! \defined( '\Yoast\WP\SEO\Integrations\Cleanup_Integration::START_HOOK' ) ) {
return;
}
// If Yoast SEO premium was upgraded after Yoast SEO, reschedule the task to clean out orphaned prominent words.
if ( ! \wp_next_scheduled( \Yoast\WP\SEO\Integrations\Cleanup_Integration::START_HOOK ) ) {
\wp_schedule_single_event( ( time() + ( MINUTE_IN_SECONDS * 5 ) ), \Yoast\WP\SEO\Integrations\Cleanup_Integration::START_HOOK );
}
}
/**
@@ -200,6 +297,7 @@ class WPSEO_Upgrade_Manager {
if ( $this->should_retry_upgrade_31() ) {
if ( $immediately ) {
WPSEO_Redirect_Upgrade::upgrade_3_1();
return;
}
add_action( 'wp', [ 'WPSEO_Redirect_Upgrade', 'upgrade_3_1' ], 12 );