Skip to content
Browse files

Check PHP and MySQL versions in upgrade.php. see #11666 for 2.9

git-svn-id: http://svn.automattic.com/wordpress/branches/2.9@12576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 9b7adfd commit 4ad5471e7fc38f7055660beb041a128eb5957b6f ryan committed Dec 29, 2009
Showing with 13 additions and 0 deletions.
  1. +13 −0 wp-admin/upgrade.php
View
13 wp-admin/upgrade.php
@@ -35,6 +35,11 @@
$step = (int) $step;
+$php_version = phpversion();
+$mysql_version = $wpdb->db_version();
+$php_compat = version_compare( $php_version, $required_php_version, '>=' );
+$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
+
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -53,6 +58,14 @@
<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
<p class="step"><a class="button" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
+<?php elseif ( !$php_compat || !$mysql_compat ) :
+ if ( !$mysql_compat && !$php_compat )
+ printf( __('You cannot upgrade because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
+ elseif ( !$php_compat )
+ printf( __('You cannot upgrade because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version );
+ elseif ( !$mysql_compat )
+ printf( __('You cannot upgrade because because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
+?>
<?php else :
switch ( $step ) :
case 0:

0 comments on commit 4ad5471

Please sign in to comment.
Something went wrong with that request. Please try again.