Check MySQL and PHP versions when auto upgrading. Props westi, Denis-de-Bernardy, nacin, caesarsgrunt. see #11464
git-svn-id: http://svn.automattic.com/wordpress/trunk@12422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9111a5405f
commit
c0437cd3a6
|
@ -215,10 +215,22 @@ $_old_files = array(
|
||||||
* @return WP_Error|null WP_Error on failure, null on success.
|
* @return WP_Error|null WP_Error on failure, null on success.
|
||||||
*/
|
*/
|
||||||
function update_core($from, $to) {
|
function update_core($from, $to) {
|
||||||
global $wp_filesystem, $_old_files;
|
global $wp_filesystem, $_old_files, $wpdb;
|
||||||
|
|
||||||
@set_time_limit( 300 );
|
@set_time_limit( 300 );
|
||||||
|
|
||||||
|
$php_version = phpversion();
|
||||||
|
$php_compat = version_compare( $php_version, '4.3', '>=' );
|
||||||
|
$mysql_version = $wpdb->db_version;
|
||||||
|
$mysql_compat = version_compare( $mysql_version, '4.1.2', '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
|
||||||
|
|
||||||
|
if ( !$mysql_compat && !$php_compat )
|
||||||
|
return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress requires PHP version 4.3 or higher and MySQL version 4.1.2 or higher. You are running PHP version %1$s and MySQL version %2$s.'), $php_version, $mysql_version ) );
|
||||||
|
elseif ( !$php_compat )
|
||||||
|
return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress requires PHP version 4.3 or higher. You are running version %s.'), $php_version ) );
|
||||||
|
elseif ( !$mysql_compat )
|
||||||
|
return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress requires MySQL version 4.1.2 or higher. You are running version %s.'), $mysql_version ) );
|
||||||
|
|
||||||
// Sanity check the unzipped distribution
|
// Sanity check the unzipped distribution
|
||||||
apply_filters('update_feedback', __('Verifying the unpacked files'));
|
apply_filters('update_feedback', __('Verifying the unpacked files'));
|
||||||
if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
|
if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
|
||||||
|
|
Loading…
Reference in New Issue