Skip to content

Commit

Permalink
Warn users of Gutenberg plugin of its deactivation upon 5.0 upgrade.
Browse files Browse the repository at this point in the history
Fixes #45073.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43921 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
mcsf committed Nov 21, 2018
1 parent 154e0bd commit 904cb8b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
44 changes: 30 additions & 14 deletions src/wp-admin/about.php
Expand Up @@ -24,9 +24,25 @@
<h1><?php printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version ); ?></h1>

<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>
<p class="about-text">
<a href="#classic-editor"><?php _e( 'Learn how to keep using the old editor.' ); ?></a>
</p>

<?php if (
// Was the Gutenberg plugin installed before upgrading to 5.0.x?
get_option( 'upgrade_500_was_gutenberg_active' ) == '1' &&
current_user_can( 'activate_plugins' ) &&
// Has it not been reactivated since?
is_plugin_inactive( 'gutenberg/gutenberg.php' ) &&
// Is it still installed?
file_exists( WP_PLUGIN_DIR . '/gutenberg/gutenberg.php' )
) : ?>
<div class="about-text" style="font-style:italic;">
<?php printf( __( 'The Gutenberg plugin has been deactivated, as the features are now included in WordPress %1$s by default. If you&#8217;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>' ); ?>
</div>
<?php else : ?>
<p class="about-text">
<a href="#classic-editor"><?php _e( 'Learn how to keep using the old editor.' ); ?></a>
</p>
<?php endif; ?>

<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>

<h2 class="nav-tab-wrapper wp-clearfix">
Expand Down Expand Up @@ -202,13 +218,13 @@
</video>
</div>
</div>

<div class="feature-section one-col cta">
<div class="col">
<a class="button button-primary button-hero" href="<?php echo esc_url( admin_url( 'post-new.php' ) ); ?>"><?php _e( 'Build your first post' ); ?></a>
<a class="button button-primary button-hero" href="<?php echo esc_url( admin_url( 'post-new.php' ) ); ?>"><?php _e( 'Build your first post' ); ?></a>
</div>
</div>

<hr />

<div class="feature-section one-col">
Expand Down Expand Up @@ -250,12 +266,12 @@

<div class="feature-section one-col cta">
<div class="col">
<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo esc_url( admin_url( 'customize.php?theme=twentynineteen' ) ); ?>"><?php _e( 'Give Twenty Nineteen a try' ); ?></a>
<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo esc_url( admin_url( 'customize.php?theme=twentynineteen' ) ); ?>"><?php _e( 'Give Twenty Nineteen a try' ); ?></a>
</div>
</div>

<hr />

<div class="under-the-hood feature-section">
<div class="col">
<h2><?php _e( 'Developer Happiness' ); ?></h2>
Expand All @@ -276,25 +292,25 @@
<p><?php _e( 'The new block paradigm opens up a path of exploration and imagination when it comes to solving user needs. With the unified block insertion flow, it&#8217;s easier for your clients and customers to find and use blocks for all types of content. Developers can focus on executing their vision and providing rich editing experiences, rather than fussing with difficult APIs.' ); ?></p>
</div>
</div>

<div class="under-the-hood feature-section one-col cta">
<div class="col">
<a class="button button-primary button-hero" href="<?php echo esc_url( 'https://wordpress.org/gutenberg/handbook/' ); ?>"><?php _e( 'Learn how to get started' ); ?></a>
<a class="button button-primary button-hero" href="<?php echo esc_url( 'https://wordpress.org/gutenberg/handbook/' ); ?>"><?php _e( 'Learn how to get started' ); ?></a>
</div>
</div>

<hr />

<div class="feature-section one-col" id="classic-editor">
<div class="col">
<h2><?php _e( 'Keep it Classic' ); ?></h2>
</div>
</div>

<div class="full-width">
<img src="https://wordpress.org/gutenberg/files/2018/11/classic.png" alt="">
</div>

<div class="feature-section one-col">
<div class="col">
<p><?php _e( 'Prefer to stick with the familiar Classic Editor? No problem! Support for the Classic Editor plugin will remain in WordPress until 2021.' ); ?></p>
Expand All @@ -305,7 +321,7 @@
</div>
</div>
</div>

<hr />

<div class="return-to-dashboard">
Expand Down
7 changes: 7 additions & 0 deletions src/wp-admin/includes/upgrade.php
Expand Up @@ -1824,6 +1824,13 @@ function upgrade_500() {
if ( defined( 'GUTENBERG_USE_PLUGIN' ) && GUTENBERG_USE_PLUGIN ) {
return;
}

$was_active = is_plugin_active( 'gutenberg/gutenberg.php' );
if ( $was_active ) {
// FIXME: Leave until 501 or 510 to clean up.
update_site_option( 'upgrade_500_was_gutenberg_active', '1' );
}

deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
}
}
Expand Down

0 comments on commit 904cb8b

Please sign in to comment.