Skip to content

Commit

Permalink
WP_MEMORY_LIMIT defaults to 40MB, but only sets that value if more th…
Browse files Browse the repository at this point in the history
…an system memory.
  • Loading branch information
mikejolley committed Nov 25, 2015
1 parent 27a7793 commit f9756b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions includes/admin/views/html-admin-page-status-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<td><?php
$memory = wc_let_to_num( WP_MEMORY_LIMIT );

if ( function_exists( 'memory_get_usage' ) ) {
$system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
$memory = max( $memory, $system_memory );
}

if ( $memory < 67108864 ) {
echo '<mark class="error">' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: <a href="%s" target="_blank">Increasing memory allocated to PHP</a>', 'woocommerce' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
} else {
Expand Down
14 changes: 10 additions & 4 deletions includes/class-wc-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,17 @@ private static function get_wordpress_info() {
$wp_data = array();

$memory = wc_let_to_num( WP_MEMORY_LIMIT );

if ( function_exists( 'memory_get_usage' ) ) {
$system_memory = wc_let_to_num( @ini_get( 'memory_limit' ) );
$memory = max( $memory, $system_memory );
}

$wp_data['memory_limit'] = size_format( $memory );
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
$wp_data['locale'] = get_locale();
$wp_data['version'] = get_bloginfo( 'version' );
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
$wp_data['locale'] = get_locale();
$wp_data['version'] = get_bloginfo( 'version' );
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';

return $wp_data;
}
Expand Down

0 comments on commit f9756b2

Please sign in to comment.