Skip to content

Commit

Permalink
General: updated minimum required WP version to run Jetpack (#13620)
Browse files Browse the repository at this point in the history
* General: update minimum supported WP version to WP -1

* Remove PHP version check.

We don't need it anymore since Jetpack's requirements match WordPress'.
  • Loading branch information
jeherve authored and kraftbj committed Nov 12, 2019
1 parent e7b3d49 commit 50b080c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Jetpack">
<config name="minimum_supported_wp_version" value="5.1" />
<config name="minimum_supported_wp_version" value="5.2" />
<config name="testVersion" value="5.6-"/>

<rule ref="PHPCompatibilityWP"/>
Expand Down
62 changes: 7 additions & 55 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @package Jetpack
*/

define( 'JETPACK__MINIMUM_WP_VERSION', '5.1' );
define( 'JETPACK__MINIMUM_WP_VERSION', '5.2' );
define( 'JETPACK__MINIMUM_PHP_VERSION', '5.6' );
define( 'JETPACK__VERSION', '8.0-alpha' );
define( 'JETPACK_MASTER_USER', true );
Expand Down Expand Up @@ -83,61 +83,13 @@ function jetpack_admin_unsupported_wp_notice() { ?>
/**
* This is where the loading of Jetpack begins.
*
* First, we check for our supported version of PHP and load our composer autoloader. If either of these fail,
* we "pause" Jetpack by ending the loading process and displaying an admin_notice to inform the site owner.
* First, we try to load our composer autoloader.
*
* After both those things happen successfully, we require load-jetpack.php,
* where all legacy files are required,
* and where we add on to various hooks that we expect to always run.
* Lastly, we fire Jetpack::init() to fire up the engines.
*/
if ( version_compare( phpversion(), JETPACK__MINIMUM_PHP_VERSION, '<' ) ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
sprintf(
/* translators: Placeholders are numbers, versions of PHP in use on the site, and required by Jetpack. */
esc_html__( 'Your version of PHP (%1$s) is lower than the version required by Jetpack (%2$s). Please update PHP to continue enjoying Jetpack.', 'jetpack' ),
esc_html( phpversion() ),
JETPACK__MINIMUM_PHP_VERSION
)
);
}

/**
* Outputs an admin notice for folks running an outdated version of PHP.
*
* @todo: Remove once WP 5.2 is the minimum version.
*
* @since 7.4.0
*/
function jetpack_admin_unsupported_php_notice() {
?>
<div class="notice notice-error is-dismissible">
<p><?php esc_html_e( 'Jetpack requires a more recent version of PHP and has been paused. Please update PHP to continue enjoying Jetpack.', 'jetpack' ); ?></p>
<p class="button-container">
<?php
printf(
'<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( wp_get_update_php_url() ),
esc_html__( 'Learn more about updating PHP' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
/* translators: accessibility text */
esc_html__( '(opens in a new tab)' ) // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
);
?>
</p>
</div>
<?php
}

add_action( 'admin_notices', 'jetpack_admin_unsupported_php_notice' );
return;
}

/**
* Load all the packages.
*
* We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.
* If the autoloader is not present, let's log the failure, pause Jetpack, and display a nice admin notice.
* - If it fails, we "pause" Jetpack by ending the loading process
* and displaying an admin_notice to inform the site owner.
* (We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.)
* - If it succeeds, we require load-jetpack.php, where all legacy files are required,
* and where we add on to various hooks that we expect to always run.
*/
$jetpack_autoloader = JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
if ( is_readable( $jetpack_autoloader ) ) {
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: automattic, adamkheckler, aduth, akirk, allendav, alternatekev, andy, annezazu, apeatling, azaozz, batmoo, barry, beaulebens, blobaugh, cainm, cena, cfinke, chaselivingston, chellycat, clickysteve, csonnek, danielbachhuber, davoraltman, daniloercoli, designsimply, dllh, drawmyface, dsmart, dzver, ebinnion, egregor, eliorivero, enej, eoigal, erania-pinnera, ethitter, gcorne, georgestephanis, gibrown, goldsounds, hew, hugobaeta, hypertextranch, iammattthomas, iandunn, jblz, jasmussen, jeffgolenski, jeherve, jenhooks, jenia, jessefriedman, jgs, jkudish, jmdodd, joanrho, johnjamesjacoby, jshreve, kbrownkd, keoshi, koke, kraftbj, lancewillett, lschuyler, macmanx, martinremy, matt, matveb, mattwiebe, maverick3x6, mcsf, mdawaffe, MichaelArestad, migueluy, mikeyarce, mkaz, nancythanki, nickmomrik, obenland, oskosk, pento, professor44, rachelsquirrel, rdcoll, ryancowles, richardmuscat, richardmtl, roccotripaldi, samhotchkiss, scarstocea, sdquirk, stephdau, tmoorewp, tyxla, Viper007Bond, westi, yoavf, zinigor
Tags: Jetpack, WordPress.com, backup, security, related posts, CDN, speed, anti-spam, social sharing, SEO, video, stats
Stable tag: 7.8
Requires at least: 5.1
Requires at least: 5.2
Requires PHP: 5.6
Tested up to: 5.3

Expand Down

0 comments on commit 50b080c

Please sign in to comment.