PluginProbe
Elementor Website Builder – more than just a page builder / 3.9.2
Elementor Website Builder – more than just a page builder v3.9.2
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/system-info/reporters/server.php +20 -13 4.2.4 → 3.9.2 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2 namespace Elementor\Modules\System_Info\Reporters;
3 3
4 4 use Elementor\Api;
5 -use Elementor\Utils;
6 5
7 6 if ( ! defined( 'ABSPATH' ) ) {
8 7 exit; // Exit if accessed directly.
9 8 }
@@ -17,8 +16,9 @@
17 16 * @since 1.0.0
18 17 */
19 18 class Server extends Base {
20 19
20 + const KEY_PATH_WP_ROOT_DIR = 'wp_root';
21 21 const KEY_PATH_WP_CONTENT_DIR = 'wp_content';
22 22 const KEY_PATH_UPLOADS_DIR = 'uploads';
23 23 const KEY_PATH_ELEMENTOR_UPLOADS_DIR = 'elementor_uploads';
24 24 const KEY_PATH_HTACCESS_FILE = '.htaccess';
@@ -98,9 +98,9 @@
98 98 * }
99 99 */
100 100 public function get_software() {
101 101 return [
102 - 'value' => Utils::get_super_global_value( $_SERVER, 'SERVER_SOFTWARE' ),
102 + 'value' => $_SERVER['SERVER_SOFTWARE'],
103 103 ];
104 104 }
105 105
106 106 /**
@@ -122,15 +122,14 @@
122 122 public function get_php_version() {
123 123 $result = [
124 124 'value' => PHP_VERSION,
125 125 ];
126 - $recommended_php_version = '7.4';
127 126
128 - if ( version_compare( $result['value'], $recommended_php_version, '<' ) ) {
127 + if ( version_compare( $result['value'], '7.4', '<' ) ) {
129 128 $result['recommendation'] = sprintf(
130 129 /* translators: %s: Recommended PHP version. */
131 - esc_html__( 'We recommend using PHP version %s or higher.', 'elementor' ),
132 - $recommended_php_version
130 + esc_html_x( 'We recommend using PHP version %s or higher.', 'System Info', 'elementor' ),
131 + '7.4'
133 132 );
134 133
135 134 $result['warning'] = true;
136 135 }
@@ -153,9 +152,9 @@
153 152 * }
154 153 */
155 154 public function get_php_memory_limit() {
156 155 $result = [
157 - 'value' => (string) ini_get( 'memory_limit' ),
156 + 'value' => (string) get_cfg_var( 'memory_limit' ),
158 157 ];
159 158
160 159 $min_recommended_memory = '128M';
161 160 $preferred_memory = '256M';
@@ -166,9 +165,9 @@
166 165
167 166 if ( $memory_limit_bytes < $min_recommended_bytes ) {
168 167 $result['recommendation'] = sprintf(
169 168 /* translators: 1: Minimum recommended_memory, 2: Preferred memory, 3: WordPress wp-config memory documentation. */
170 - __( 'We recommend setting memory to at least %1$s. (%2$s or higher is preferred) For more information, read about <a href="%3$s">how to increase memory allocated to PHP</a>.', 'elementor' ),
169 + _x( 'We recommend setting memory to at least %1$s. (%2$s or higher is preferred) For more information, read about <a href="%3$s">how to increase memory allocated to PHP</a>.', 'System Info', 'elementor' ),
171 170 $min_recommended_memory,
172 171 $preferred_memory,
173 172 'https://go.elementor.com/wordpress-wp-config-memory/'
174 173 );
@@ -314,10 +313,11 @@
314 313 * @type bool $warning Whether to display a warning. True if some required
315 314 * folders don't have writing permissions, False otherwise.
316 315 * }
317 316 */
318 - public function get_write_permissions(): array {
317 + public function get_write_permissions() : array {
319 318 $paths_to_check = [
319 + static::KEY_PATH_WP_ROOT_DIR => $this->get_system_path( static::KEY_PATH_WP_ROOT_DIR ),
320 320 static::KEY_PATH_HTACCESS_FILE => $this->get_system_path( static::KEY_PATH_HTACCESS_FILE ),
321 321 static::KEY_PATH_UPLOADS_DIR => $this->get_system_path( static::KEY_PATH_UPLOADS_DIR ),
322 322 static::KEY_PATH_ELEMENTOR_UPLOADS_DIR => $this->get_system_path( static::KEY_PATH_ELEMENTOR_UPLOADS_DIR ),
323 323 ];
@@ -325,8 +325,12 @@
325 325 $paths_permissions = $this->get_paths_permissions( $paths_to_check );
326 326
327 327 $write_problems = [];
328 328
329 + if ( ! $paths_permissions[ static::KEY_PATH_WP_ROOT_DIR ]['write'] ) {
330 + $write_problems[] = 'WordPress root directory';
331 + }
332 +
329 333 if ( ! $paths_permissions[ static::KEY_PATH_UPLOADS_DIR ]['write'] ) {
330 334 $write_problems[] = 'WordPress uploads directory';
331 335 }
332 336
@@ -347,9 +351,9 @@
347 351 }
348 352
349 353 return [
350 354 'value' => $value,
351 - 'warning' => (bool) $write_problems,
355 + 'warning' => ! ! $write_problems,
352 356 ];
353 357 }
354 358
355 359 /**
@@ -416,9 +420,9 @@
416 420 /**
417 421 * @param $paths [] Paths to check permissions.
418 422 * @return array []{exists: bool, read: bool, write: bool, execute: bool}
419 423 */
420 - public function get_paths_permissions( $paths ): array {
424 + public function get_paths_permissions( $paths ) : array {
421 425 $permissions = [];
422 426
423 427 foreach ( $paths as $key_path => $path ) {
424 428 $permissions[ $key_path ] = $this->get_path_permissions( $path );
@@ -432,10 +436,13 @@
432 436 *
433 437 * @param $path_key
434 438 * @return string
435 439 */
436 - public function get_system_path( $path_key ): string {
440 + public function get_system_path( $path_key ) : string {
437 441 switch ( $path_key ) {
442 + case static::KEY_PATH_WP_ROOT_DIR:
443 + return ABSPATH;
444 +
438 445 case static::KEY_PATH_WP_CONTENT_DIR:
439 446 return WP_CONTENT_DIR;
440 447
441 448 case static::KEY_PATH_HTACCESS_FILE:
@@ -463,9 +470,9 @@
463 470 *
464 471 * @param $path
465 472 * @return array{exists: bool, read: bool, write: bool, execute: bool}
466 473 */
467 - public function get_path_permissions( $path ): array {
474 + public function get_path_permissions( $path ) : array {
468 475 if ( empty( $path ) ) {
469 476 return [
470 477 'exists' => false,
471 478 'read' => false,