Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General: require PHP 5.3+ to be able to run Jetpack. #12395

Merged
merged 3 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ env:
# so it doesn't need to be re-defined below.
matrix:
include:
# The versions listed below run within Precise distro with PHP 5.2 due to Travis limitation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these red lines :)

# Hard-coding the versions since WP 5.2 has a PHP 5.6 minimum support.
# When removing this, remove corresponding setup functions in setup-travis.sh.
- php: "5.2"
env: WP_MODE=single WP_BRANCH=5.1
dist: precise
- if: branch !~ /(^branch-.*-built)/
language: node_js
env: WP_TRAVISCI="yarn lint"
Expand Down
40 changes: 40 additions & 0 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

define( 'JETPACK__MINIMUM_WP_VERSION', '5.1' );
define( 'JETPACK__MINIMUM_PHP_VERSION', '5.3' );

define( 'JETPACK__VERSION', '7.4-alpha' );
define( 'JETPACK_MASTER_USER', true );
Expand Down Expand Up @@ -93,6 +94,45 @@ function jetpack_admin_unsupported_wp_notice() { ?>
return;
}

/**
* 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() { ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could moved this inside the if ( version_compare( phpversion(), JETPACK__MINIMUM_PHP_VERSION, '<' ) ) {?

<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() ),
__( 'Learn more about updating PHP' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
);
?>
</p>
</div>
<?php
}

if ( version_compare( phpversion(), JETPACK__MINIMUM_PHP_VERSION, '<' ) ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
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
)
);
}
add_action( 'admin_notices', 'jetpack_admin_unsupported_php_notice' );
return;
}

add_filter( 'jetpack_require_lib_dir', 'jetpack_require_lib_dir' );
add_filter( 'jetpack_should_use_minified_assets', 'jetpack_should_use_minified_assets', 9 );

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Contributors: automattic, adamkheckler, aduth, akirk, allendav, alternatekev, an
Tags: Jetpack, WordPress.com, backup, security, related posts, CDN, speed, anti-spam, social sharing, SEO, video, stats
Stable tag: 7.3.1
Requires at least: 5.0
Requires PHP: 5.3
Tested up to: 5.2

The ideal plugin for stats, related posts, search engine optimization, social sharing, protection, backups, security, and more.
Expand Down
6 changes: 0 additions & 6 deletions tests/setup-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ latest)
previous)
git clone --depth=1 --branch $(php ./tests/get-wp-version.php --previous) git://develop.git.wordpress.org/ /tmp/wordpress-previous
;;
5.0)
git clone --depth=1 --branch 5.0 git://develop.git.wordpress.org/ /tmp/wordpress-5.0
;;
5.1)
git clone --depth=1 --branch 5.1 git://develop.git.wordpress.org/ /tmp/wordpress-5.1
;;
esac

clone_exit_code=$?
Expand Down