PluginProbe
Gutenberg / 19.6.1
Gutenberg v19.6.1
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | lib/upgrade.php +1 -89 24.0.019.6.1 View file →
@@ -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', '23.9.0' );
10 + define( '_GUTENBERG_VERSION_MIGRATION', '9.8.0' );
11 11 }
12 12
13 13 /**
14 14 * Migrate Gutenberg's database on upgrade.
@@ -24,16 +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, '23.8.0', '<' ) ) {
29 - _gutenberg_migrate_remove_legacy_collaboration_options();
30 - }
31 -
32 - if ( version_compare( $gutenberg_installed_version, '23.9.0', '<' ) ) {
33 - _gutenberg_migrate_active_templates();
34 - }
35 -
36 28 update_option( 'gutenberg_version_migration', _GUTENBERG_VERSION_MIGRATION );
37 29 }
38 30 }
39 31
@@ -64,88 +56,8 @@
64 56
65 57 // Delete useless options.
66 58 delete_option( 'gutenberg_last_synchronize_theme_template_checks' );
67 59 delete_option( 'gutenberg_last_synchronize_theme_template-part_checks' );
68 -}
69 -
70 -/**
71 - * Removes collaboration options replaced by the Real-Time Collaboration experiment.
72 - *
73 - * The previous values are intentionally not migrated to the experiment. Real-time
74 - * collaboration is now opt-in, so existing sites must explicitly enable the
75 - * experiment instead of being opted in by a legacy setting.
76 - *
77 - * @since 23.8.0
78 - */
79 -function _gutenberg_migrate_remove_legacy_collaboration_options() {
80 - delete_option( 'enable_real_time_collaboration' );
81 - delete_option( 'wp_enable_real_time_collaboration' );
82 - delete_option( 'wp_collaboration_enabled' );
83 -}
84 -
85 -/**
86 - * Migrates templates created by the removed template activation experiment.
87 - *
88 - * The experiment allowed multiple templates with the same slug, with the
89 - * `active_templates` option deciding which one renders. Without the
90 - * experiment, WordPress expects at most one template per slug, so an inactive
91 - * duplicate could take over rendering. Move every template the experiment did
92 - * not treat as active out of the template hierarchy by renaming it to a
93 - * `custom-{slug}` slug; it remains available as a custom template.
94 - *
95 - * Only runs on sites where the `active_templates` option exists, which means
96 - * the experiment was enabled at some point.
97 - *
98 - * @since 23.9.0
99 - *
100 - * @access private
101 - * @internal
102 - */
103 -function _gutenberg_migrate_active_templates() {
104 - $active_templates = get_option( 'active_templates' );
105 -
106 - if ( ! is_array( $active_templates ) ) {
107 - // The template activation experiment was never enabled on this site.
108 - return;
109 - }
110 -
111 - $template_query = new WP_Query(
112 - array(
113 - 'post_type' => 'wp_template',
114 - 'post_status' => array( 'publish', 'draft', 'auto-draft' ),
115 - 'posts_per_page' => -1,
116 - 'no_found_rows' => true,
117 - )
118 - );
119 -
120 - foreach ( $template_query->posts as $post ) {
121 - $slug = $post->post_name;
122 -
123 - // The active template keeps its slug, so it continues to override the
124 - // theme's template as it did under the experiment.
125 - if ( isset( $active_templates[ $slug ] ) && absint( $active_templates[ $slug ] ) === $post->ID ) {
126 - continue;
127 - }
128 -
129 - $template = _build_block_template_result_from_post( $post );
130 -
131 - // Custom templates never needed activation; leave them untouched.
132 - if ( is_wp_error( $template ) || $template->is_custom ) {
133 - continue;
134 - }
135 -
136 - wp_update_post(
137 - array(
138 - 'ID' => $post->ID,
139 - 'post_name' => 'custom-' . $slug,
140 - )
141 - );
142 - // The template is a plain custom template from now on.
143 - delete_post_meta( $post->ID, 'is_wp_suggestion' );
144 - delete_post_meta( $post->ID, 'is_inactive_by_default' );
145 - }
146 -
147 - delete_option( 'active_templates' );
148 60 }
149 61
150 62 // Deletion of the `_wp_file_based` term (in _gutenberg_migrate_remove_fse_drafts) must happen
151 63 // after its taxonomy (`wp_theme`) is registered. This happens in `gutenberg_register_wp_theme_taxonomy`,