PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | cron/bootstrap.php +27 -19 4.6.0.1 → 6.2.1 View file →
@@ -8,14 +8,22 @@
8 8 *
9 9 * @package MainWP/Bootstrap
10 10 */
11 11
12 -// phpcs:disable -- required to support custom wp-config.php file location
12 +// phpcs:disable WordPress.Security.PluginSecurity.MissingDirectFileAccessProtection
13 13
14 +/**
15 + * This file must execute before WordPress loads to locate wp-load.php,
16 + * so the standard ABSPATH check would break functionality.
17 + *
18 + * Do not prevent direct access ! defined( 'ABSPATH' ) exit
19 + * to support custom wp-config.php file location, but do prevent direct access if WP is not loaded.
20 + */
21 +
14 22 // set php.ini variables.
15 23 @ignore_user_abort( true );
16 24 if ( false !== strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) ) {
17 - @set_time_limit( 0 );
25 + @set_time_limit( 0 );
18 26 }
19 27 $mem = '512M';
20 28 @ini_set( 'memory_limit', $mem );
21 29 @ini_set( 'max_execution_time', 0 );
@@ -30,27 +38,27 @@
30 38 $included = false;
31 39
32 40
33 41 if ( file_exists( __DIR__ . '/../../../../wp-load.php' ) ) {
34 - include_once __DIR__ . '/../../../../wp-load.php';
35 - $included = true;
42 + include_once __DIR__ . '/../../../../wp-load.php'; // NOSONAR - WP compatible.
43 + $included = true;
36 44 } 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 ( 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 - }
45 + $wp_config = file_get_contents( __DIR__ . '/../../../../wp-config.php' ); // phpcs:ignore -- used before loading WP.
46 + preg_match_all( '/.*define[^d].*ABSPATH.*/i', $wp_config, $matches );
47 + if ( ! empty( $matches ) ) {
48 + foreach ( $matches as $match ) {
49 + $execute = str_ireplace( 'ABSPATH', 'TMPABSPATH', $match[0] );
50 + $execute = str_ireplace( '__FILE__', "'" . __DIR__ . '/../../../../wp-config.php' . "'", $execute );
51 + eval( $execute ); // NOSONAR - wp-config file are safe content.
52 + if ( file_exists( TMPABSPATH . 'wp-load.php' ) ) {
53 + include_once TMPABSPATH . 'wp-load.php'; // NOSONAR - WP compatible.
54 + $included = true;
55 + break;
56 + }
57 + }
58 + }
51 59 }
52 60
53 61 // phpcs:enable
54 62 if ( ! $included ) {
55 - exit( 'Unsupported WordPress setup' );
63 + exit( 'Unsupported WordPress setup' );
56 64 }