-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathbackwpup.php
More file actions
executable file
·100 lines (82 loc) · 2.99 KB
/
Copy pathbackwpup.php
File metadata and controls
executable file
·100 lines (82 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
* Plugin Name: BackWPup
* Plugin URI: https://backwpup.com/
* Description: WordPress Backup Plugin
* Author: BackWPup – WordPress Backup & Restore Plugin
* Author URI: https://backwpup.com
* Version: 5.7.4
* Requires at least: 5.3
* Requires PHP: 7.4
* Text Domain: backwpup
* Domain Path: /languages
* Network: true
* License: GPLv2+
*/
use WPMedia\BackWPup\Dependencies\League\Container\Container;
use WPMedia\BackWPup\Plugin\Plugin;
use WP\MCP\Core\McpAdapter;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( defined( 'BACKWPUP_PLUGIN_LOADED' ) || class_exists( \BackWPup::class, false ) ) {
return;
}
define( 'BACKWPUP_PLUGIN_FILE', __FILE__ );
define( 'BACKWPUP_PLUGIN_LOADED', true );
// Include the Composer autoload file.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
$can_boot_mcp_adapter =
class_exists( McpAdapter::class )
&& version_compare( $GLOBALS['wp_version'] ?? '0', '6.9', '>=' )
&& function_exists( 'wp_register_ability' )
&& function_exists( 'wp_get_ability' )
&& function_exists( 'wp_get_abilities' )
&& function_exists( 'wp_register_ability_category' );
if ( $can_boot_mcp_adapter ) {
/**
* Filter whether the BackWPup MCP server is enabled or not.
*
* When this resolves to false, the MCP adapter is not instantiated, so the
* MCP REST endpoint and abilities are never registered.
*
* @since 5.7.3
*
* @param bool $enabled Whether the MCP server is enabled or not. Default true.
*/
if ( wpm_apply_filters_typed( 'boolean', 'backwpup_mcp_server_enabled', true ) ) {
McpAdapter::instance();
}
}
require_once __DIR__ . '/inc/functions.php';
require_once __DIR__ . '/src/compat.php';
$restore_commons = untrailingslashit( BackWPup::get_plugin_data( 'plugindir' ) ) . '/src/Infrastructure/Restore/commons.php';
if ( $restore_commons ) {
require_once $restore_commons;
}
require_once __DIR__ . '/inc/class-system-requirements.php';
require_once __DIR__ . '/inc/class-system-tests.php';
$system_requirements = new BackWPup_System_Requirements();
$system_tests = new BackWPup_System_Tests( $system_requirements );
// Don't activate on anything less than PHP 7.4 or WordPress 4.9.
if ( ! $system_tests->is_php_version_compatible() || ! $system_tests->is_wp_version_compatible() ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php'; // @phpstan-ignore-line
deactivate_plugins( __FILE__ );
exit(
sprintf(
// translators: %1$s is the minimum PHP version, %2$s is the minimum WordPress version.
esc_html__(
'BackWPup requires PHP version %1$s with spl extension or greater and WordPress %2$s or greater.',
'backwpup'
),
esc_html( $system_requirements->php_minimum_version() ),
esc_html( $system_requirements->wp_minimum_version() )
)
);
}
// Deactivation hook.
register_deactivation_hook( __FILE__, [ BackWPup_Install::class, 'deactivate' ] );
$backwpup_plugin = new Plugin( new Container(), __FILE__ );
add_action( 'plugins_loaded', [ $backwpup_plugin, 'init' ], 11 );