PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.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 5.2.2 5.3 All 153 releases
mainwp / cron / bootstrap.php

bootstrap.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 4.1, at cron/bootstrap.php

55 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 @set_time_limit( 0 );
17 $mem = '512M';
18 @ini_set( 'memory_limit', $mem );
19 @ini_set( 'max_execution_time', 0 );
20
21 /**
22 * Checks whether cron is in progress.
23 *
24 * @const ( bool ) Default: true
25 * @source https://github.com/mainwp/mainwp/blob/master/cron/bootstrap.php
26 */
27 define( 'DOING_CRON', true );
28 $included = false;
29
30
31 if ( file_exists( __DIR__ . '/../../../../wp-load.php' ) ) {
32 include_once __DIR__ . '/../../../../wp-load.php';
33 $included = true;
34 } elseif ( file_exists( __DIR__ . '/../../../../wp-config.php' ) ) {
35 $wp_config = file_get_contents( __DIR__ . '/../../../../wp-config.php' ); // phpcs:ignore -- used before loading WP.
36 preg_match_all( '/.*define[^d].*ABSPATH.*/i', $wp_config, $matches );
37 if ( count( $matches ) > 0 ) {
38 foreach ( $matches as $match ) {
39 $execute = str_ireplace( 'ABSPATH', 'TMPABSPATH', $match[0] );
40 $execute = str_ireplace( '__FILE__', "'" . __DIR__ . '/../../../../wp-config.php' . "'", $execute );
41 eval( $execute );
42 if ( file_exists( TMPABSPATH . 'wp-load.php' ) ) {
43 include_once TMPABSPATH . 'wp-load.php';
44 $included = true;
45 break;
46 }
47 }
48 }
49 }
50
51 // phpcs:enable
52 if ( ! $included ) {
53 exit( 'Unsupported WordPress setup' );
54 }
55