Ticket #26909: patch_commit_8d334f227fb2.patch
File patch_commit_8d334f227fb2.patch, 4.1 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/plugin.php
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 8095cd4330ea4a34544e9e4d2303087290d9977b..07c20a66de147a113183220303211a0a0db76e2e 100644
a b function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { 83 83 'Network' => 'Network', 84 84 // Site Wide Only is deprecated in favor of Network. 85 85 '_sitewide' => 'Site Wide Only', 86 'WPRequirement' => 'WP Requirement', 87 'PHPRequirement' => 'PHP Requirement', 88 'MySQLRequirement' => 'MySQL Requirement' 86 89 ); 87 90 88 91 $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' ); … … function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen 533 536 if ( is_wp_error($valid) ) 534 537 return $valid; 535 538 539 $valid = plugin_requirements_check($plugin); 540 if ( is_wp_error($valid) ) 541 return $valid; 542 536 543 if ( !in_array($plugin, $current) ) { 537 544 if ( !empty($redirect) ) 538 545 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error … … function validate_plugin($plugin) { 883 890 } 884 891 885 892 /** 893 * Checks if the plugin has a requirement. 894 * 895 * @since 3.0.0 896 * 897 * @param string $plugin Plugin Path 898 * @return WP_Error|int 0 on success, WP_Error on failure. 899 */ 900 function plugin_requirements_check( $plugin ) { 901 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 902 903 $errors = new WP_Error(); 904 905 if ( isset( $plugin_data['WPRequirement'] ) ) { 906 $wp_version = version_compare( get_bloginfo( 'version' ), $plugin_data['WPRequirement'], '>=' ); 907 if ( ! $wp_version ) 908 $errors->add( 'requirement_error', sprintf( __('WordPress %s or higher'), $plugin_data['WPRequirement'] ) ); 909 } 910 911 if ( isset( $plugin_data['PHPRequirement'] ) ) { 912 $php_version = version_compare( phpversion(), $plugin_data['PHPRequirement'], '>=' ); 913 if ( ! $php_version ) 914 $errors->add( 'requirement_error', sprintf( __('PHP Version %s or higher'), $plugin_data['PHPRequirement'] ) ); 915 } 916 917 if ( isset( $plugin_data['MySQLRequirement'] ) ) { 918 $php_version = version_compare( phpversion(), $plugin_data['MySQLRequirement'], '>=' ); 919 if ( ! $php_version ) 920 $errors->add( 'requirement_error', sprintf( __('MySQL Version %s or higher'), $plugin_data['MySQLRequirement'] ) ); 921 } 922 923 if ( $errors->get_error_code() ) 924 return $errors; 925 926 return; 927 928 } 929 930 /** 886 931 * Whether the plugin can be uninstalled. 887 932 * 888 933 * @since 2.7.0 -
wp-admin/plugins.php
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 776a2b54a7d49147fae7e04dfcb5eb8d709521aa..bc49183ed9de712ad9ede3a634617b71ad028dd8 100644
a b if ( $action ) { 43 43 $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s"); 44 44 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); 45 45 exit; 46 } elseif ( 'requirement_error' == $result->get_error_code() ) { 47 $redirect = self_admin_url('plugins.php?error=true&errormsg=Plugin Requires: ' . urlencode( implode( ' & ', $result->get_error_messages() ) ) . ".&plugin_status=$status&paged=$page&s=$s"); 48 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); 49 exit; 46 50 } else { 47 51 wp_die($result); 48 52 } … … if ( !empty($invalid) ) 372 376 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); 373 377 elseif ( isset($_GET['charsout']) ) 374 378 $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); 379 elseif ( isset($_GET['errormsg']) ) 380 $errmsg = $_GET['errormsg']; 375 381 else 376 382 $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); 377 383 ?>