| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | |
| 14 | 14 | // set php.ini variables. |
| 15 | 15 | @ignore_user_abort( true ); |
| 16 | 16 | if ( false !== strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) ) { |
| 17 | - @set_time_limit( 0 ); | |
| 17 | + @set_time_limit( 0 ); | |
| 18 | 18 | } |
| 19 | 19 | $mem = '512M'; |
| 20 | 20 | @ini_set( 'memory_limit', $mem ); |
| 21 | 21 | @ini_set( 'max_execution_time', 0 ); |
| @@ -30,27 +30,27 @@ | ||
| 30 | 30 | $included = false; |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | if ( file_exists( __DIR__ . '/../../../../wp-load.php' ) ) { |
| 34 | - include_once __DIR__ . '/../../../../wp-load.php'; // NOSONAR - WP compatible. | |
| 35 | - $included = true; | |
| 34 | + include_once __DIR__ . '/../../../../wp-load.php'; | |
| 35 | + $included = true; | |
| 36 | 36 | } elseif ( file_exists( __DIR__ . '/../../../../wp-config.php' ) ) { |
| 37 | - $wp_config = file_get_contents( __DIR__ . '/../../../../wp-config.php' ); // phpcs:ignore -- used before loading WP. | |
| 38 | - preg_match_all( '/.*define[^d].*ABSPATH.*/i', $wp_config, $matches ); | |
| 39 | - if ( ! empty( $matches ) ) { | |
| 40 | - foreach ( $matches as $match ) { | |
| 41 | - $execute = str_ireplace( 'ABSPATH', 'TMPABSPATH', $match[0] ); | |
| 42 | - $execute = str_ireplace( '__FILE__', "'" . __DIR__ . '/../../../../wp-config.php' . "'", $execute ); | |
| 43 | - eval( $execute ); // NOSONAR - wp-config file are safe content. | |
| 44 | - if ( file_exists( TMPABSPATH . 'wp-load.php' ) ) { | |
| 45 | - include_once TMPABSPATH . 'wp-load.php'; // NOSONAR - WP compatible. | |
| 46 | - $included = true; | |
| 47 | - break; | |
| 48 | - } | |
| 49 | - } | |
| 50 | - } | |
| 37 | + $wp_config = file_get_contents( __DIR__ . '/../../../../wp-config.php' ); // phpcs:ignore -- used before loading WP. | |
| 38 | + preg_match_all( '/.*define[^d].*ABSPATH.*/i', $wp_config, $matches ); | |
| 39 | + if ( count( $matches ) > 0 ) { | |
| 40 | + foreach ( $matches as $match ) { | |
| 41 | + $execute = str_ireplace( 'ABSPATH', 'TMPABSPATH', $match[0] ); | |
| 42 | + $execute = str_ireplace( '__FILE__', "'" . __DIR__ . '/../../../../wp-config.php' . "'", $execute ); | |
| 43 | + eval( $execute ); | |
| 44 | + if ( file_exists( TMPABSPATH . 'wp-load.php' ) ) { | |
| 45 | + include_once TMPABSPATH . 'wp-load.php'; | |
| 46 | + $included = true; | |
| 47 | + break; | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // phpcs:enable |
| 54 | 54 | if ( ! $included ) { |
| 55 | - exit( 'Unsupported WordPress setup' ); | |
| 55 | + exit( 'Unsupported WordPress setup' ); | |
| 56 | 56 | } |