WordPress.org

Make WordPress Core

Ticket #45073: 45073.2.patch

File 45073.2.patch, 2.5 KB (added by mcsf, 12 months ago)
Line 
1Index: src/wp-admin/about.php
2===================================================================
3--- src/wp-admin/about.php      (revision 43913)
4+++ src/wp-admin/about.php      (working copy)
5@@ -24,9 +24,25 @@
6                <h1><?php printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version ); ?></h1>
7 
8                <p class="about-text"><?php printf( __( 'Thank you for updating to the latest version! WordPress %s introduces a robust new content creation experience.' ), $display_version ); ?></p>
9-               <p class="about-text">
10-                       <a href="#classic-editor"><?php _e( 'Learn how to keep using the old editor.' ); ?></a>
11-               </p>
12+
13+               <?php if (
14+                       // Was the Gutenberg plugin installed before upgrading to 5.0.x?
15+                       get_option( 'upgrade_500_was_gutenberg_active' ) == '1'  &&
16+                       current_user_can( 'activate_plugins' ) &&
17+                       // Has it not been reactivated since?
18+                       is_plugin_inactive( 'gutenberg/gutenberg.php' ) &&
19+                       // Is it still installed?
20+                       file_exists( WP_PLUGIN_DIR . '/gutenberg/gutenberg.php' )
21+               ) : ?>
22+                       <div class="about-text" style="font-style:italic;">
23+                               <?php printf( __( 'The Gutenberg plugin has been deactivated, as the features are now included in WordPress %1$s by default. If you\'d like to continue to test the upcoming changes in the WordPress editing experience, please %2$sreactivate the Gutenberg plugin%3$s.' ), $display_version, '<a href="' . esc_url( self_admin_url( 'plugins.php?s=gutenberg&plugin_status=all' ) ) . '">', '</a>' ); ?>
24+                       </div>
25+               <?php else : ?>
26+                       <p class="about-text">
27+                               <a href="#classic-editor"><?php _e( 'Learn how to keep using the old editor.' ); ?></a>
28+                       </p>
29+               <?php endif; ?>
30+
31                <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
32 
33                <h2 class="nav-tab-wrapper wp-clearfix">
34Index: src/wp-admin/includes/upgrade.php
35===================================================================
36--- src/wp-admin/includes/upgrade.php   (revision 43913)
37+++ src/wp-admin/includes/upgrade.php   (working copy)
38@@ -1819,11 +1819,18 @@
39  */
40 function upgrade_500() {
41        global $wp_current_db_version;
42        if ( $wp_current_db_version < 43764 ) {
43                // Allow bypassing Gutenberg plugin deactivation.
44                if ( defined( 'GUTENBERG_USE_PLUGIN' ) && GUTENBERG_USE_PLUGIN ) {
45                        return;
46                }
47+
48+               $was_active = is_plugin_active( 'gutenberg/gutenberg.php' );
49+               if ( $was_active ) {
50+                       // FIXME: Leave until 501 or 510 to clean up.
51+                       update_site_option( 'upgrade_500_was_gutenberg_active', '1' );
52+               }
53+
54                deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
55        }
56 }