| @@ -46,9 +46,8 @@ | ||
| 46 | 46 | 'home_url' => 'Home URL', |
| 47 | 47 | 'is_multisite' => 'WP Multisite', |
| 48 | 48 | 'max_upload_size' => 'Max Upload Size', |
| 49 | 49 | 'memory_limit' => 'Memory limit', |
| 50 | - 'max_memory_limit' => 'Max Memory limit', | |
| 51 | 50 | 'permalink_structure' => 'Permalink Structure', |
| 52 | 51 | 'language' => 'Language', |
| 53 | 52 | 'timezone' => 'Timezone', |
| 54 | 53 | 'admin_email' => 'Admin Email', |
| @@ -66,32 +65,37 @@ | ||
| 66 | 65 | * |
| 67 | 66 | * @return array { |
| 68 | 67 | * Report data. |
| 69 | 68 | * |
| 70 | - * @type string $value WordPress memory limit. | |
| 69 | + * @type string $value WordPress memory limit. | |
| 70 | + * @type string $recommendation Recommendation memory limit. | |
| 71 | + * @type bool $warning Whether to display a warning. True if the limit | |
| 72 | + * is below the recommended 64M, False otherwise. | |
| 71 | 73 | * } |
| 72 | 74 | */ |
| 73 | 75 | public function get_memory_limit() { |
| 74 | - return [ | |
| 75 | - 'value' => (string) WP_MEMORY_LIMIT, | |
| 76 | + $result = [ | |
| 77 | + 'value' => ini_get( 'memory_limit' ), | |
| 76 | 78 | ]; |
| 77 | - } | |
| 78 | 79 | |
| 79 | - /** | |
| 80 | - * Get WordPress max memory limit. | |
| 81 | - * | |
| 82 | - * Retrieve the WordPress max memory limit. | |
| 83 | - * | |
| 84 | - * @return array { | |
| 85 | - * Report data. | |
| 86 | - * | |
| 87 | - * @type string $value WordPress max memory limit. | |
| 88 | - * } | |
| 89 | - */ | |
| 90 | - public function get_max_memory_limit() { | |
| 91 | - return [ | |
| 92 | - 'value' => (string) WP_MAX_MEMORY_LIMIT, | |
| 93 | - ]; | |
| 80 | + $min_recommended_memory = '64M'; | |
| 81 | + | |
| 82 | + $memory_limit_bytes = wp_convert_hr_to_bytes( $result['value'] ); | |
| 83 | + | |
| 84 | + $min_recommended_bytes = wp_convert_hr_to_bytes( $min_recommended_memory ); | |
| 85 | + | |
| 86 | + if ( $memory_limit_bytes < $min_recommended_bytes ) { | |
| 87 | + $result['recommendation'] = sprintf( | |
| 88 | + /* translators: 1: Minimum recommended_memory, 2: WordPress wp-config memory documentation. */ | |
| 89 | + _x( 'We recommend setting memory to at least %1$s. For more information, read about <a href="%2$s">how to Increase memory allocated to PHP</a>.', 'System Info', 'elementor' ), | |
| 90 | + $min_recommended_memory, | |
| 91 | + 'https://go.elementor.com/wordpress-wp-config-memory/' | |
| 92 | + ); | |
| 93 | + | |
| 94 | + $result['warning'] = true; | |
| 95 | + } | |
| 96 | + | |
| 97 | + return $result; | |
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 100 | /** |
| 97 | 101 | * Get WordPress version. |
| @@ -216,9 +220,9 @@ | ||
| 216 | 220 | * } |
| 217 | 221 | */ |
| 218 | 222 | public function get_language() { |
| 219 | 223 | return [ |
| 220 | - 'value' => get_locale(), | |
| 224 | + 'value' => get_bloginfo( 'language' ), | |
| 221 | 225 | ]; |
| 222 | 226 | } |
| 223 | 227 | |
| 224 | 228 | /** |