Edit File by line
/home/barbar84/www/wp-conte.../plugins/wordpres.../inc
File: class-upgrade.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WPSEO plugin file.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WPSEO\Internal
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Yoast\WP\Lib\Model;
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* This code handles the option upgrades.
[10] Fix | Delete
*/
[11] Fix | Delete
class WPSEO_Upgrade {
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* The taxonomy helper.
[15] Fix | Delete
*
[16] Fix | Delete
* @var \Yoast\WP\SEO\Helpers\Taxonomy_Helper
[17] Fix | Delete
*/
[18] Fix | Delete
private $taxonomy_helper;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Class constructor.
[22] Fix | Delete
*/
[23] Fix | Delete
public function __construct() {
[24] Fix | Delete
$this->taxonomy_helper = YoastSEO()->helpers->taxonomy;
[25] Fix | Delete
[26] Fix | Delete
$version = WPSEO_Options::get( 'version' );
[27] Fix | Delete
[28] Fix | Delete
WPSEO_Options::maybe_set_multisite_defaults( false );
[29] Fix | Delete
[30] Fix | Delete
$routines = [
[31] Fix | Delete
'1.5.0' => 'upgrade_15',
[32] Fix | Delete
'2.0' => 'upgrade_20',
[33] Fix | Delete
'2.1' => 'upgrade_21',
[34] Fix | Delete
'2.2' => 'upgrade_22',
[35] Fix | Delete
'2.3' => 'upgrade_23',
[36] Fix | Delete
'3.0' => 'upgrade_30',
[37] Fix | Delete
'3.3' => 'upgrade_33',
[38] Fix | Delete
'3.6' => 'upgrade_36',
[39] Fix | Delete
'4.0' => 'upgrade_40',
[40] Fix | Delete
'4.4' => 'upgrade_44',
[41] Fix | Delete
'4.7' => 'upgrade_47',
[42] Fix | Delete
'4.9' => 'upgrade_49',
[43] Fix | Delete
'5.0' => 'upgrade_50',
[44] Fix | Delete
'5.5' => 'upgrade_55',
[45] Fix | Delete
'6.3' => 'upgrade_63',
[46] Fix | Delete
'7.0-RC0' => 'upgrade_70',
[47] Fix | Delete
'7.1-RC0' => 'upgrade_71',
[48] Fix | Delete
'7.3-RC0' => 'upgrade_73',
[49] Fix | Delete
'7.4-RC0' => 'upgrade_74',
[50] Fix | Delete
'7.5.3' => 'upgrade_753',
[51] Fix | Delete
'7.7-RC0' => 'upgrade_77',
[52] Fix | Delete
'7.7.2-RC0' => 'upgrade_772',
[53] Fix | Delete
'9.0-RC0' => 'upgrade_90',
[54] Fix | Delete
'10.0-RC0' => 'upgrade_100',
[55] Fix | Delete
'11.1-RC0' => 'upgrade_111',
[56] Fix | Delete
// Reset notifications because we removed the AMP Glue plugin notification.
[57] Fix | Delete
'12.1-RC0' => 'clean_all_notifications',
[58] Fix | Delete
'12.3-RC0' => 'upgrade_123',
[59] Fix | Delete
'12.4-RC0' => 'upgrade_124',
[60] Fix | Delete
'12.8-RC0' => 'upgrade_128',
[61] Fix | Delete
'13.2-RC0' => 'upgrade_132',
[62] Fix | Delete
'14.0.3-RC0' => 'upgrade_1403',
[63] Fix | Delete
'14.1-RC0' => 'upgrade_141',
[64] Fix | Delete
'14.2-RC0' => 'upgrade_142',
[65] Fix | Delete
'14.5-RC0' => 'upgrade_145',
[66] Fix | Delete
'14.9-RC0' => 'upgrade_149',
[67] Fix | Delete
'15.1-RC0' => 'upgrade_151',
[68] Fix | Delete
'15.3-RC0' => 'upgrade_153',
[69] Fix | Delete
'15.5-RC0' => 'upgrade_155',
[70] Fix | Delete
'15.7-RC0' => 'upgrade_157',
[71] Fix | Delete
'15.9.1-RC0' => 'upgrade_1591',
[72] Fix | Delete
'16.2-RC0' => 'upgrade_162',
[73] Fix | Delete
'16.5-RC0' => 'upgrade_165',
[74] Fix | Delete
'17.1-RC0' => 'upgrade_171',
[75] Fix | Delete
'17.2-RC0' => 'upgrade_172',
[76] Fix | Delete
];
[77] Fix | Delete
[78] Fix | Delete
array_walk( $routines, [ $this, 'run_upgrade_routine' ], $version );
[79] Fix | Delete
[80] Fix | Delete
if ( version_compare( $version, '12.5-RC0', '<' ) ) {
[81] Fix | Delete
/*
[82] Fix | Delete
* We have to run this by hook, because otherwise:
[83] Fix | Delete
* - the theme support check isn't available.
[84] Fix | Delete
* - the notification center notifications are not filled yet.
[85] Fix | Delete
*/
[86] Fix | Delete
add_action( 'init', [ $this, 'upgrade_125' ] );
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
// Since 3.7.
[90] Fix | Delete
$upsell_notice = new WPSEO_Product_Upsell_Notice();
[91] Fix | Delete
$upsell_notice->set_upgrade_notice();
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Filter: 'wpseo_run_upgrade' - Runs the upgrade hook which are dependent on Yoast SEO.
[95] Fix | Delete
*
[96] Fix | Delete
* @api string - The current version of Yoast SEO
[97] Fix | Delete
*/
[98] Fix | Delete
do_action( 'wpseo_run_upgrade', $version );
[99] Fix | Delete
[100] Fix | Delete
$this->finish_up( $version );
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Runs the upgrade routine.
[105] Fix | Delete
*
[106] Fix | Delete
* @param string $routine The method to call.
[107] Fix | Delete
* @param string $version The new version.
[108] Fix | Delete
* @param string $current_version The current set version.
[109] Fix | Delete
*
[110] Fix | Delete
* @return void
[111] Fix | Delete
*/
[112] Fix | Delete
protected function run_upgrade_routine( $routine, $version, $current_version ) {
[113] Fix | Delete
if ( version_compare( $current_version, $version, '<' ) ) {
[114] Fix | Delete
$this->$routine( $current_version );
[115] Fix | Delete
}
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* Adds a new upgrade history entry.
[120] Fix | Delete
*
[121] Fix | Delete
* @param string $current_version The old version from which we are upgrading.
[122] Fix | Delete
* @param string $new_version The version we are upgrading to.
[123] Fix | Delete
*/
[124] Fix | Delete
protected function add_upgrade_history( $current_version, $new_version ) {
[125] Fix | Delete
$upgrade_history = new WPSEO_Upgrade_History();
[126] Fix | Delete
$upgrade_history->add( $current_version, $new_version, array_keys( WPSEO_Options::$options ) );
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
/**
[130] Fix | Delete
* Runs the needed cleanup after an update, setting the DB version to latest version, flushing caches etc.
[131] Fix | Delete
*
[132] Fix | Delete
* @param string|null $previous_version The previous version.
[133] Fix | Delete
*
[134] Fix | Delete
* @return void
[135] Fix | Delete
*/
[136] Fix | Delete
protected function finish_up( $previous_version = null ) {
[137] Fix | Delete
if ( $previous_version ) {
[138] Fix | Delete
WPSEO_Options::set( 'previous_version', $previous_version );
[139] Fix | Delete
}
[140] Fix | Delete
WPSEO_Options::set( 'version', WPSEO_VERSION );
[141] Fix | Delete
[142] Fix | Delete
// Just flush rewrites, always, to at least make them work after an upgrade.
[143] Fix | Delete
add_action( 'shutdown', 'flush_rewrite_rules' );
[144] Fix | Delete
[145] Fix | Delete
// Flush the sitemap cache.
[146] Fix | Delete
WPSEO_Sitemaps_Cache::clear();
[147] Fix | Delete
[148] Fix | Delete
// Make sure all our options always exist - issue #1245.
[149] Fix | Delete
WPSEO_Options::ensure_options_exist();
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* Run the Yoast SEO 1.5 upgrade routine.
[154] Fix | Delete
*
[155] Fix | Delete
* @param string $version Current plugin version.
[156] Fix | Delete
*/
[157] Fix | Delete
private function upgrade_15( $version ) {
[158] Fix | Delete
// Clean up options and meta.
[159] Fix | Delete
WPSEO_Options::clean_up( null, $version );
[160] Fix | Delete
WPSEO_Meta::clean_up();
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* Moves options that moved position in WPSEO 2.0.
[165] Fix | Delete
*/
[166] Fix | Delete
private function upgrade_20() {
[167] Fix | Delete
/**
[168] Fix | Delete
* Clean up stray wpseo_ms options from the options table, option should only exist in the sitemeta table.
[169] Fix | Delete
* This could have been caused in many version of Yoast SEO, so deleting it for everything below 2.0.
[170] Fix | Delete
*/
[171] Fix | Delete
delete_option( 'wpseo_ms' );
[172] Fix | Delete
[173] Fix | Delete
$wpseo = $this->get_option_from_database( 'wpseo' );
[174] Fix | Delete
$this->save_option_setting( $wpseo, 'pinterestverify' );
[175] Fix | Delete
[176] Fix | Delete
// Re-save option to trigger sanitization.
[177] Fix | Delete
$this->cleanup_option_data( 'wpseo' );
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
/**
[181] Fix | Delete
* Detects if taxonomy terms were split and updates the corresponding taxonomy meta's accordingly.
[182] Fix | Delete
*/
[183] Fix | Delete
private function upgrade_21() {
[184] Fix | Delete
$taxonomies = get_option( 'wpseo_taxonomy_meta', [] );
[185] Fix | Delete
[186] Fix | Delete
if ( ! empty( $taxonomies ) ) {
[187] Fix | Delete
foreach ( $taxonomies as $taxonomy => $tax_metas ) {
[188] Fix | Delete
foreach ( $tax_metas as $term_id => $tax_meta ) {
[189] Fix | Delete
if ( function_exists( 'wp_get_split_term' ) ) {
[190] Fix | Delete
$new_term_id = wp_get_split_term( $term_id, $taxonomy );
[191] Fix | Delete
if ( $new_term_id !== false ) {
[192] Fix | Delete
$taxonomies[ $taxonomy ][ $new_term_id ] = $taxonomies[ $taxonomy ][ $term_id ];
[193] Fix | Delete
unset( $taxonomies[ $taxonomy ][ $term_id ] );
[194] Fix | Delete
}
[195] Fix | Delete
}
[196] Fix | Delete
}
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
update_option( 'wpseo_taxonomy_meta', $taxonomies );
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
/**
[204] Fix | Delete
* Performs upgrade functions to Yoast SEO 2.2.
[205] Fix | Delete
*/
[206] Fix | Delete
private function upgrade_22() {
[207] Fix | Delete
// Unschedule our tracking.
[208] Fix | Delete
wp_clear_scheduled_hook( 'yoast_tracking' );
[209] Fix | Delete
[210] Fix | Delete
$this->cleanup_option_data( 'wpseo' );
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
/**
[214] Fix | Delete
* Schedules upgrade function to Yoast SEO 2.3.
[215] Fix | Delete
*/
[216] Fix | Delete
private function upgrade_23() {
[217] Fix | Delete
add_action( 'wp', [ $this, 'upgrade_23_query' ], 90 );
[218] Fix | Delete
add_action( 'admin_head', [ $this, 'upgrade_23_query' ], 90 );
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
/**
[222] Fix | Delete
* Performs upgrade query to Yoast SEO 2.3.
[223] Fix | Delete
*/
[224] Fix | Delete
public function upgrade_23_query() {
[225] Fix | Delete
$wp_query = new WP_Query( 'post_type=any&meta_key=_yoast_wpseo_sitemap-include&meta_value=never&order=ASC' );
[226] Fix | Delete
[227] Fix | Delete
if ( ! empty( $wp_query->posts ) ) {
[228] Fix | Delete
$options = get_option( 'wpseo_xml' );
[229] Fix | Delete
[230] Fix | Delete
$excluded_posts = [];
[231] Fix | Delete
if ( $options['excluded-posts'] !== '' ) {
[232] Fix | Delete
$excluded_posts = explode( ',', $options['excluded-posts'] );
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
foreach ( $wp_query->posts as $post ) {
[236] Fix | Delete
if ( ! in_array( (string) $post->ID, $excluded_posts, true ) ) {
[237] Fix | Delete
$excluded_posts[] = $post->ID;
[238] Fix | Delete
}
[239] Fix | Delete
}
[240] Fix | Delete
[241] Fix | Delete
// Updates the meta value.
[242] Fix | Delete
$options['excluded-posts'] = implode( ',', $excluded_posts );
[243] Fix | Delete
[244] Fix | Delete
// Update the option.
[245] Fix | Delete
update_option( 'wpseo_xml', $options );
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
// Remove the meta fields.
[249] Fix | Delete
delete_post_meta_by_key( '_yoast_wpseo_sitemap-include' );
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
/**
[253] Fix | Delete
* Performs upgrade functions to Yoast SEO 3.0.
[254] Fix | Delete
*/
[255] Fix | Delete
private function upgrade_30() {
[256] Fix | Delete
// Remove the meta fields for sitemap prio.
[257] Fix | Delete
delete_post_meta_by_key( '_yoast_wpseo_sitemap-prio' );
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
/**
[261] Fix | Delete
* Performs upgrade functions to Yoast SEO 3.3.
[262] Fix | Delete
*/
[263] Fix | Delete
private function upgrade_33() {
[264] Fix | Delete
// Notification dismissals have been moved to User Meta instead of global option.
[265] Fix | Delete
delete_option( Yoast_Notification_Center::STORAGE_KEY );
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
/**
[269] Fix | Delete
* Performs upgrade functions to Yoast SEO 3.6.
[270] Fix | Delete
*/
[271] Fix | Delete
private function upgrade_36() {
[272] Fix | Delete
global $wpdb;
[273] Fix | Delete
[274] Fix | Delete
// Between 3.2 and 3.4 the sitemap options were saved with autoloading enabled.
[275] Fix | Delete
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "wpseo_sitemap_%" AND autoload = "yes"' );
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
/**
[279] Fix | Delete
* Removes the about notice when its still in the database.
[280] Fix | Delete
*/
[281] Fix | Delete
private function upgrade_40() {
[282] Fix | Delete
$center = Yoast_Notification_Center::get();
[283] Fix | Delete
$center->remove_notification_by_id( 'wpseo-dismiss-about' );
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
/**
[287] Fix | Delete
* Moves the content-analysis-active and keyword-analysis-acive options from wpseo-titles to wpseo.
[288] Fix | Delete
*/
[289] Fix | Delete
private function upgrade_44() {
[290] Fix | Delete
$wpseo_titles = $this->get_option_from_database( 'wpseo_titles' );
[291] Fix | Delete
[292] Fix | Delete
$this->save_option_setting( $wpseo_titles, 'content-analysis-active', 'content_analysis_active' );
[293] Fix | Delete
$this->save_option_setting( $wpseo_titles, 'keyword-analysis-active', 'keyword_analysis_active' );
[294] Fix | Delete
[295] Fix | Delete
// Remove irrelevant content from the option.
[296] Fix | Delete
$this->cleanup_option_data( 'wpseo_titles' );
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Renames the meta name for the cornerstone content. It was a public meta field and it has to be private.
[301] Fix | Delete
*/
[302] Fix | Delete
private function upgrade_47() {
[303] Fix | Delete
global $wpdb;
[304] Fix | Delete
[305] Fix | Delete
// The meta key has to be private, so prefix it.
[306] Fix | Delete
$wpdb->query(
[307] Fix | Delete
$wpdb->prepare(
[308] Fix | Delete
'UPDATE ' . $wpdb->postmeta . ' SET meta_key = %s WHERE meta_key = "yst_is_cornerstone"',
[309] Fix | Delete
WPSEO_Cornerstone_Filter::META_NAME
[310] Fix | Delete
)
[311] Fix | Delete
);
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
/**
[315] Fix | Delete
* Removes the 'wpseo-dismiss-about' notice for every user that still has it.
[316] Fix | Delete
*/
[317] Fix | Delete
private function upgrade_49() {
[318] Fix | Delete
global $wpdb;
[319] Fix | Delete
[320] Fix | Delete
/*
[321] Fix | Delete
* Using a filter to remove the notification for the current logged in user. The notification center is
[322] Fix | Delete
* initializing the notifications before the upgrade routine has been executedd and is saving the stored
[323] Fix | Delete
* notifications on shutdown. This causes the returning notification. By adding this filter the shutdown
[324] Fix | Delete
* routine on the notification center will remove the notification.
[325] Fix | Delete
*/
[326] Fix | Delete
add_filter( 'yoast_notifications_before_storage', [ $this, 'remove_about_notice' ] );
[327] Fix | Delete
[328] Fix | Delete
$meta_key = $wpdb->get_blog_prefix() . Yoast_Notification_Center::STORAGE_KEY;
[329] Fix | Delete
[330] Fix | Delete
$usermetas = $wpdb->get_results(
[331] Fix | Delete
$wpdb->prepare(
[332] Fix | Delete
'
[333] Fix | Delete
SELECT user_id, meta_value
[334] Fix | Delete
FROM ' . $wpdb->usermeta . '
[335] Fix | Delete
WHERE meta_key = %s AND meta_value LIKE %s
[336] Fix | Delete
',
[337] Fix | Delete
$meta_key,
[338] Fix | Delete
'%wpseo-dismiss-about%'
[339] Fix | Delete
),
[340] Fix | Delete
ARRAY_A
[341] Fix | Delete
);
[342] Fix | Delete
[343] Fix | Delete
if ( empty( $usermetas ) ) {
[344] Fix | Delete
return;
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
foreach ( $usermetas as $usermeta ) {
[348] Fix | Delete
$notifications = maybe_unserialize( $usermeta['meta_value'] );
[349] Fix | Delete
[350] Fix | Delete
foreach ( $notifications as $notification_key => $notification ) {
[351] Fix | Delete
if ( ! empty( $notification['options']['id'] ) && $notification['options']['id'] === 'wpseo-dismiss-about' ) {
[352] Fix | Delete
unset( $notifications[ $notification_key ] );
[353] Fix | Delete
}
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
update_user_option( $usermeta['user_id'], Yoast_Notification_Center::STORAGE_KEY, array_values( $notifications ) );
[357] Fix | Delete
}
[358] Fix | Delete
}
[359] Fix | Delete
[360] Fix | Delete
/**
[361] Fix | Delete
* Removes the wpseo-dismiss-about notice from a list of notifications.
[362] Fix | Delete
*
[363] Fix | Delete
* @param Yoast_Notification[] $notifications The notifications to filter.
[364] Fix | Delete
*
[365] Fix | Delete
* @return Yoast_Notification[] The filtered list of notifications. Excluding the wpseo-dismiss-about notification.
[366] Fix | Delete
*/
[367] Fix | Delete
public function remove_about_notice( $notifications ) {
[368] Fix | Delete
foreach ( $notifications as $notification_key => $notification ) {
[369] Fix | Delete
if ( $notification->get_id() === 'wpseo-dismiss-about' ) {
[370] Fix | Delete
unset( $notifications[ $notification_key ] );
[371] Fix | Delete
}
[372] Fix | Delete
}
[373] Fix | Delete
[374] Fix | Delete
return $notifications;
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
/**
[378] Fix | Delete
* Adds the yoast_seo_links table to the database.
[379] Fix | Delete
*/
[380] Fix | Delete
private function upgrade_50() {
[381] Fix | Delete
global $wpdb;
[382] Fix | Delete
[383] Fix | Delete
// Deletes the post meta value, which might created in the RC.
[384] Fix | Delete
$wpdb->query( 'DELETE FROM ' . $wpdb->postmeta . ' WHERE meta_key = "_yst_content_links_processed"' );
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
/**
[388] Fix | Delete
* Register new capabilities and roles.
[389] Fix | Delete
*/
[390] Fix | Delete
private function upgrade_55() {
[391] Fix | Delete
// Register roles.
[392] Fix | Delete
do_action( 'wpseo_register_roles' );
[393] Fix | Delete
WPSEO_Role_Manager_Factory::get()->add();
[394] Fix | Delete
[395] Fix | Delete
// Register capabilities.
[396] Fix | Delete
do_action( 'wpseo_register_capabilities' );
[397] Fix | Delete
WPSEO_Capability_Manager_Factory::get()->add();
[398] Fix | Delete
}
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* Removes some no longer used options for noindexing subpages and for meta keywords and its associated templates.
[402] Fix | Delete
*
[403] Fix | Delete
* @return void
[404] Fix | Delete
*/
[405] Fix | Delete
private function upgrade_63() {
[406] Fix | Delete
$this->cleanup_option_data( 'wpseo_titles' );
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
/**
[410] Fix | Delete
* Perform the 7.0 upgrade, moves settings around, deletes several options.
[411] Fix | Delete
*
[412] Fix | Delete
* @return void
[413] Fix | Delete
*/
[414] Fix | Delete
private function upgrade_70() {
[415] Fix | Delete
[416] Fix | Delete
$wpseo_permalinks = $this->get_option_from_database( 'wpseo_permalinks' );
[417] Fix | Delete
$wpseo_xml = $this->get_option_from_database( 'wpseo_xml' );
[418] Fix | Delete
$wpseo_rss = $this->get_option_from_database( 'wpseo_rss' );
[419] Fix | Delete
$wpseo = $this->get_option_from_database( 'wpseo' );
[420] Fix | Delete
$wpseo_internallinks = $this->get_option_from_database( 'wpseo_internallinks' );
[421] Fix | Delete
[422] Fix | Delete
// Move some permalink settings, then delete the option.
[423] Fix | Delete
$this->save_option_setting( $wpseo_permalinks, 'redirectattachment', 'disable-attachment' );
[424] Fix | Delete
$this->save_option_setting( $wpseo_permalinks, 'stripcategorybase' );
[425] Fix | Delete
[426] Fix | Delete
// Move one XML sitemap setting, then delete the option.
[427] Fix | Delete
$this->save_option_setting( $wpseo_xml, 'enablexmlsitemap', 'enable_xml_sitemap' );
[428] Fix | Delete
[429] Fix | Delete
[430] Fix | Delete
// Move the RSS settings to the search appearance settings, then delete the RSS option.
[431] Fix | Delete
$this->save_option_setting( $wpseo_rss, 'rssbefore' );
[432] Fix | Delete
$this->save_option_setting( $wpseo_rss, 'rssafter' );
[433] Fix | Delete
[434] Fix | Delete
$this->save_option_setting( $wpseo, 'company_logo' );
[435] Fix | Delete
$this->save_option_setting( $wpseo, 'company_name' );
[436] Fix | Delete
$this->save_option_setting( $wpseo, 'company_or_person' );
[437] Fix | Delete
$this->save_option_setting( $wpseo, 'person_name' );
[438] Fix | Delete
[439] Fix | Delete
// Remove the website name and altername name as we no longer need them.
[440] Fix | Delete
$this->cleanup_option_data( 'wpseo' );
[441] Fix | Delete
[442] Fix | Delete
// All the breadcrumbs settings have moved to the search appearance settings.
[443] Fix | Delete
foreach ( array_keys( $wpseo_internallinks ) as $key ) {
[444] Fix | Delete
$this->save_option_setting( $wpseo_internallinks, $key );
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
// Convert hidden metabox options to display metabox options.
[448] Fix | Delete
$title_options = get_option( 'wpseo_titles' );
[449] Fix | Delete
[450] Fix | Delete
foreach ( $title_options as $key => $value ) {
[451] Fix | Delete
if ( strpos( $key, 'hideeditbox-tax-' ) === 0 ) {
[452] Fix | Delete
$taxonomy = substr( $key, strlen( 'hideeditbox-tax-' ) );
[453] Fix | Delete
WPSEO_Options::set( 'display-metabox-tax-' . $taxonomy, ! $value );
[454] Fix | Delete
continue;
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
if ( strpos( $key, 'hideeditbox-' ) === 0 ) {
[458] Fix | Delete
$post_type = substr( $key, strlen( 'hideeditbox-' ) );
[459] Fix | Delete
WPSEO_Options::set( 'display-metabox-pt-' . $post_type, ! $value );
[460] Fix | Delete
continue;
[461] Fix | Delete
}
[462] Fix | Delete
}
[463] Fix | Delete
[464] Fix | Delete
// Cleanup removed options.
[465] Fix | Delete
delete_option( 'wpseo_xml' );
[466] Fix | Delete
delete_option( 'wpseo_permalinks' );
[467] Fix | Delete
delete_option( 'wpseo_rss' );
[468] Fix | Delete
delete_option( 'wpseo_internallinks' );
[469] Fix | Delete
[470] Fix | Delete
// Remove possibly present plugin conflict notice for plugin that was removed from the list of conflicting plugins.
[471] Fix | Delete
$yoast_plugin_conflict = WPSEO_Plugin_Conflict::get_instance();
[472] Fix | Delete
$yoast_plugin_conflict->clear_error( 'header-footer/plugin.php' );
[473] Fix | Delete
[474] Fix | Delete
// Moves the user meta for excluding from the XML sitemap to a noindex.
[475] Fix | Delete
global $wpdb;
[476] Fix | Delete
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_key = 'wpseo_noindex_author' WHERE meta_key = 'wpseo_excludeauthorsitemap'" );
[477] Fix | Delete
}
[478] Fix | Delete
[479] Fix | Delete
/**
[480] Fix | Delete
* Perform the 7.1 upgrade.
[481] Fix | Delete
*
[482] Fix | Delete
* @return void
[483] Fix | Delete
*/
[484] Fix | Delete
private function upgrade_71() {
[485] Fix | Delete
$this->cleanup_option_data( 'wpseo_social' );
[486] Fix | Delete
[487] Fix | Delete
// Move the breadcrumbs setting and invert it.
[488] Fix | Delete
$title_options = $this->get_option_from_database( 'wpseo_titles' );
[489] Fix | Delete
[490] Fix | Delete
if ( array_key_exists( 'breadcrumbs-blog-remove', $title_options ) ) {
[491] Fix | Delete
WPSEO_Options::set( 'breadcrumbs-display-blog-page', ! $title_options['breadcrumbs-blog-remove'] );
[492] Fix | Delete
[493] Fix | Delete
$this->cleanup_option_data( 'wpseo_titles' );
[494] Fix | Delete
}
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
/**
[498] Fix | Delete
* Perform the 7.3 upgrade.
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function