PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.0.5
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.0.5
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 5.2.2 5.3 All 153 releases
← All changes | cron/bootstrap.php +34 -56 5.24.0.5 View file →
@@ -1,56 +1,34 @@
1 -<?php
2 -/**
3 - * MainWP bootstrap.
4 - *
5 - * Set default php.ini variables
6 - * check if load wp-load & wp-config exist & include them
7 - * else exit due to "Unsupported WordPress Setup".
8 - *
9 - * @package MainWP/Bootstrap
10 - */
11 -
12 -// phpcs:disable -- required to support custom wp-config.php file location
13 -
14 -// set php.ini variables.
15 -@ignore_user_abort( true );
16 -if ( false !== strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) ) {
17 - @set_time_limit( 0 );
18 -}
19 -$mem = '512M';
20 -@ini_set( 'memory_limit', $mem );
21 -@ini_set( 'max_execution_time', 0 );
22 -
23 -/**
24 - * Checks whether cron is in progress.
25 - *
26 - * @const ( bool ) Default: true
27 - * @source https://github.com/mainwp/mainwp/blob/master/cron/bootstrap.php
28 - */
29 -define( 'DOING_CRON', true );
30 -$included = false;
31 -
32 -
33 -if ( file_exists( __DIR__ . '/../../../../wp-load.php' ) ) {
34 - include_once __DIR__ . '/../../../../wp-load.php'; // NOSONAR - WP compatible.
35 - $included = true;
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 - }
51 -}
52 -
53 -// phpcs:enable
54 -if ( ! $included ) {
55 - exit( 'Unsupported WordPress setup' );
56 -}
1 +<?php
2 +
3 +@ignore_user_abort( true );
4 +@set_time_limit( 0 );
5 +$mem = '512M';
6 +@ini_set( 'memory_limit', $mem );
7 +@ini_set( 'max_execution_time', 0 );
8 +
9 +define( 'DOING_CRON', true );
10 +$included = false;
11 +
12 +if ( file_exists( __DIR__ . '/../../../../wp-load.php' ) ) {
13 + include_once __DIR__ . '/../../../../wp-load.php';
14 + $included = true;
15 +} else if ( file_exists( __DIR__ . '/../../../../wp-config.php' ) ) {
16 + $wp_config = file_get_contents( __DIR__ . '/../../../../wp-config.php' );
17 + preg_match_all( '/.*define[^d].*ABSPATH.*/i', $wp_config, $matches );
18 + if ( count( $matches ) > 0 ) {
19 + foreach ( $matches as $match ) {
20 + $execute = str_ireplace( 'ABSPATH', 'TMPABSPATH', $match[ 0 ] );
21 + $execute = str_ireplace( '__FILE__', "'" . __DIR__ . '/../../../../wp-config.php' . "'", $execute );
22 + eval( $execute );
23 + if ( file_exists( TMPABSPATH . 'wp-load.php' ) ) {
24 + include_once TMPABSPATH . 'wp-load.php';
25 + $included = true;
26 + break;
27 + }
28 + }
29 + }
30 +}
31 +
32 +if ( !$included ) {
33 + exit( 'Unsupported wordpress setup' );
34 +}