Permalink
Browse files

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

git-svn-id: http://svn.automattic.com/wordpress/branches/2.9@12578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 4ad5471 commit 7cfdf3deea5460c2d7704a93f15b4e5c556306c5 ryan committed Dec 29, 2009
Showing with 18 additions and 1 deletion.
  1. +17 −0 wp-admin/install.php
  2. +1 −1 wp-admin/upgrade.php
View
@@ -82,6 +82,23 @@ function display_setup_form( $error = null ) {
// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
+$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' );
+
+if ( !$mysql_compat && !$php_compat )
+ $compat = sprintf( __('You cannot install 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 )
+ $compat = sprintf( __('You cannot install 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 )
+ $compat = sprintf( __('You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
+
+if ( !$mysql_compat || !$php_compat ) {
+ display_header();
+ die('<h1>' . __('Insufficient Requirements') . '</h1><p>' . $compat . '</p></body></html>');
+}
+
switch($step) {
case 0:
case 1: // in case people are directly linking to this
View
@@ -64,7 +64,7 @@
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 );
+ printf( __('You cannot upgrade 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 ) :

0 comments on commit 7cfdf3d

Please sign in to comment.