| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | if ( ! defined( '_GUTENBERG_VERSION_MIGRATION' ) ) { |
| 9 | 9 | // It's necessary to update this version every time a new migration is needed. |
| 10 | - define( '_GUTENBERG_VERSION_MIGRATION', '22.8.0' ); | |
| 10 | + define( '_GUTENBERG_VERSION_MIGRATION', '9.8.0' ); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Migrate Gutenberg's database on upgrade. |
| @@ -24,12 +24,8 @@ | ||
| 24 | 24 | if ( version_compare( $gutenberg_installed_version, '9.8.0', '<' ) ) { |
| 25 | 25 | _gutenberg_migrate_remove_fse_drafts(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if ( version_compare( $gutenberg_installed_version, '22.8.0', '<' ) ) { | |
| 29 | - _gutenberg_migrate_enable_real_time_collaboration(); | |
| 30 | - } | |
| 31 | - | |
| 32 | 28 | update_option( 'gutenberg_version_migration', _GUTENBERG_VERSION_MIGRATION ); |
| 33 | 29 | } |
| 34 | 30 | } |
| 35 | 31 | |
| @@ -40,9 +36,9 @@ | ||
| 40 | 36 | * @internal |
| 41 | 37 | */ |
| 42 | 38 | function _gutenberg_migrate_remove_fse_drafts() { |
| 43 | 39 | // Delete auto-draft templates and template parts. |
| 44 | - $delete_query = new WP_Query( | |
| 40 | + $delete_query = new WP_QUERY( | |
| 45 | 41 | array( |
| 46 | 42 | 'post_status' => array( 'auto-draft' ), |
| 47 | 43 | 'post_type' => array( 'wp_template', 'wp_template_part' ), |
| 48 | 44 | 'posts_per_page' => -1, |
| @@ -47,9 +43,9 @@ | ||
| 47 | 43 | 'post_type' => array( 'wp_template', 'wp_template_part' ), |
| 48 | 44 | 'posts_per_page' => -1, |
| 49 | 45 | ) |
| 50 | 46 | ); |
| 51 | - foreach ( $delete_query->posts as $post ) { | |
| 47 | + foreach ( $delete_query->get_posts() as $post ) { | |
| 52 | 48 | wp_delete_post( $post->ID, true ); |
| 53 | 49 | } |
| 54 | 50 | |
| 55 | 51 | // Delete _wp_file_based term. |
| @@ -60,27 +56,8 @@ | ||
| 60 | 56 | |
| 61 | 57 | // Delete useless options. |
| 62 | 58 | delete_option( 'gutenberg_last_synchronize_theme_template_checks' ); |
| 63 | 59 | delete_option( 'gutenberg_last_synchronize_theme_template-part_checks' ); |
| 64 | -} | |
| 65 | - | |
| 66 | -/** | |
| 67 | - * Update RTC option name. | |
| 68 | - * | |
| 69 | - * @since 22.8.0 | |
| 70 | - */ | |
| 71 | -function _gutenberg_migrate_enable_real_time_collaboration() { | |
| 72 | - $value1 = get_option( 'enable_real_time_collaboration', '1' ); | |
| 73 | - $value2 = get_option( 'wp_enable_real_time_collaboration', '1' ); | |
| 74 | - | |
| 75 | - // RTC is enabled by default in the plugin, so only set the value if it was | |
| 76 | - // previously disabled. Otherwise rely on the default value. | |
| 77 | - if ( ! $value1 || ! $value2 ) { | |
| 78 | - update_option( 'wp_collaboration_enabled', '0' ); | |
| 79 | - } | |
| 80 | - | |
| 81 | - delete_option( 'enable_real_time_collaboration' ); | |
| 82 | - delete_option( 'wp_enable_real_time_collaboration' ); | |
| 83 | 60 | } |
| 84 | 61 | |
| 85 | 62 | // Deletion of the `_wp_file_based` term (in _gutenberg_migrate_remove_fse_drafts) must happen |
| 86 | 63 | // after its taxonomy (`wp_theme`) is registered. This happens in `gutenberg_register_wp_theme_taxonomy`, |