PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.5
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.5
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / gutenberg / lib / upgrade.php
widget-options / includes / widgets / gutenberg / lib Last commit date
block-supports 2 years ago compat 2 years ago experimental 2 years ago README.md 2 years ago block-editor-settings.php 2 years ago blocks.php 2 years ago class-wp-duotone-gutenberg.php 2 years ago class-wp-theme-json-data-gutenberg.php 2 years ago class-wp-theme-json-gutenberg.php 2 years ago class-wp-theme-json-resolver-gutenberg.php 2 years ago client-assets.php 2 years ago demo.php 2 years ago experiments-page.php 2 years ago global-styles-and-settings.php 2 years ago init.php 2 years ago load.php 2 years ago script-loader.php 2 years ago theme-i18n.json 2 years ago theme.json 2 years ago upgrade.php 2 years ago
upgrade.php
66 lines
1 <?php
2 /**
3 * Upgrading Gutenberg's database.
4 *
5 * @package gutenberg
6 */
7
8 if ( ! defined( '_GUTENBERG_VERSION_MIGRATION' ) ) {
9 // It's necessary to update this version every time a new migration is needed.
10 define( '_GUTENBERG_VERSION_MIGRATION', '9.8.0' );
11 }
12
13 /**
14 * Migrate Gutenberg's database on upgrade.
15 *
16 * @access private
17 * @internal
18 */
19 function _gutenberg_migrate_database() {
20 // The default value used here is the first version before migrations were added.
21 $gutenberg_installed_version = get_option( 'gutenberg_version_migration', '9.7.0' );
22
23 if ( _GUTENBERG_VERSION_MIGRATION !== $gutenberg_installed_version ) {
24 if ( version_compare( $gutenberg_installed_version, '9.8.0', '<' ) ) {
25 _gutenberg_migrate_remove_fse_drafts();
26 }
27
28 update_option( 'gutenberg_version_migration', _GUTENBERG_VERSION_MIGRATION );
29 }
30 }
31
32 /**
33 * Remove FSE auto drafts and associated terms.
34 *
35 * @access private
36 * @internal
37 */
38 function _gutenberg_migrate_remove_fse_drafts() {
39 // Delete auto-draft templates and template parts.
40 $delete_query = new WP_Query(
41 array(
42 'post_status' => array( 'auto-draft' ),
43 'post_type' => array( 'wp_template', 'wp_template_part' ),
44 'posts_per_page' => -1,
45 )
46 );
47 foreach ( $delete_query->posts as $post ) {
48 wp_delete_post( $post->ID, true );
49 }
50
51 // Delete _wp_file_based term.
52 $term = get_term_by( 'name', '_wp_file_based', 'wp_theme' );
53 if ( $term ) {
54 wp_delete_term( $term->term_id, 'wp_theme' );
55 }
56
57 // Delete useless options.
58 delete_option( 'gutenberg_last_synchronize_theme_template_checks' );
59 delete_option( 'gutenberg_last_synchronize_theme_template-part_checks' );
60 }
61
62 // Deletion of the `_wp_file_based` term (in _gutenberg_migrate_remove_fse_drafts) must happen
63 // after its taxonomy (`wp_theme`) is registered. This happens in `gutenberg_register_wp_theme_taxonomy`,
64 // which is hooked into `init` (default priority, i.e. 10).
65 add_action( 'init', '_gutenberg_migrate_database', 20 );
66