C:\xampp\htdocs\landing\wp-content\updraft\plugins-old\gutenberg\lib\upgrade.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
 * Upgrading Gutenberg's database.
 *
 * @package gutenberg
 */

if ( ! defined'_GUTENBERG_VERSION_MIGRATION' ) ) {
    
// It's necessary to update this version every time a new migration is needed.
    
define'_GUTENBERG_VERSION_MIGRATION''9.8.0' );
}

/**
 * Migrate Gutenberg's database on upgrade.
 *
 * @access private
 * @internal
 */
function _gutenberg_migrate_database() {
    
// The default value used here is the first version before migrations were added.
    
$gutenberg_installed_version get_option'gutenberg_version_migration''9.7.0' );

    if ( 
_GUTENBERG_VERSION_MIGRATION !== $gutenberg_installed_version ) {
        if ( 
version_compare$gutenberg_installed_version'9.8.0''<' ) ) {
            
_gutenberg_migrate_remove_fse_drafts();
        }

        
update_option'gutenberg_version_migration'_GUTENBERG_VERSION_MIGRATION );
    }
}

/**
 * Remove FSE auto drafts and associated terms.
 *
 * @access private
 * @internal
 */
function _gutenberg_migrate_remove_fse_drafts() {
    
// Delete auto-draft templates and template parts.
    
$delete_query = new WP_QUERY(
        array(
            
'post_status'    => array( 'auto-draft' ),
            
'post_type'      => array( 'wp_template''wp_template_part' ),
            
'posts_per_page' => -1,
        )
    );
    foreach ( 
$delete_query->get_posts() as $post ) {
        
wp_delete_post$post->IDtrue );
    }

    
// Delete _wp_file_based term.
    
$term get_term_by'name''_wp_file_based''wp_theme' );
    if ( 
$term ) {
        
wp_delete_term$term->term_id'wp_theme' );
    }

    
// Delete useless options.
    
delete_option'gutenberg_last_synchronize_theme_template_checks' );
    
delete_option'gutenberg_last_synchronize_theme_template-part_checks' );
}

// Deletion of the `_wp_file_based` term (in _gutenberg_migrate_remove_fse_drafts) must happen
// after its taxonomy (`wp_theme`) is registered. This happens in `gutenberg_register_wp_theme_taxonomy`,
// which is hooked into `init` (default priority, i.e. 10).
add_action'init''_gutenberg_migrate_database'20 );
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586