=' ) ) { return; } global $wpdb; // The options this plugin stored up to 1.4 (transients expire by themselves). Only these // names are touched: other options that happen to start with "acw_" belong to someone else. $options = array( 'acw_settings' => 'aiolos_settings', 'acw_remote_notices' => 'aiolos_remote_notices', 'acw_checkout_page_switched' => 'aiolos_checkout_page_switched', 'acw_checkout_page_notice' => 'aiolos_checkout_page_notice', ); foreach ( $options as $old => $new ) { $value = get_option( $old, null ); if ( null === $value ) { continue; } // A value already saved under the new name wins; the old copy is no longer needed. if ( null === get_option( $new, null ) ) { update_option( $new, $value ); } delete_option( $old ); } // phpcs:disable WordPress.DB.DirectDatabaseQuery -- a one-time rename of this plugin's own meta keys. // Meta keys of pages (checkout block backup), users (dismissed notices) and orders. $keys = array( $wpdb->postmeta => array( '_acw_checkout_block_backup' => '_aiolos_checkout_block_backup', '_acw_tracked' => '_aiolos_tracked', ), $wpdb->usermeta => array( 'acw_dismissed_notices' => 'aiolos_dismissed_notices' ), ); $orders_meta = $wpdb->prefix . 'wc_orders_meta'; if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $orders_meta ) ) === $orders_meta ) { $keys[ $orders_meta ] = array( '_acw_tracked' => '_aiolos_tracked' ); } foreach ( $keys as $table => $map ) { foreach ( $map as $old => $new ) { $wpdb->update( $table, array( 'meta_key' => $new ), array( 'meta_key' => $old ) ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- one time. } } // phpcs:enable wp_clear_scheduled_hook( 'acw_fetch_notices' ); wp_cache_delete( 'alloptions', 'options' ); wp_cache_delete( 'notoptions', 'options' ); if ( function_exists( 'wp_cache_supports' ) && wp_cache_supports( 'flush_group' ) ) { wp_cache_flush_group( 'post_meta' ); wp_cache_flush_group( 'user_meta' ); } update_option( self::DONE, '1.5.0', true ); } }