1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Automattic\Jetpack\Sync\Modules; |
4
|
|
|
|
5
|
|
|
class WP_Super_Cache extends \Jetpack_Sync_Module { |
6
|
|
|
|
7
|
|
|
public function __construct() { |
8
|
|
|
add_filter( 'jetpack_sync_constants_whitelist', array( $this, 'add_wp_super_cache_constants_whitelist' ), 10 ); |
9
|
|
|
add_filter( 'jetpack_sync_callable_whitelist', array( $this, 'add_wp_super_cache_callable_whitelist' ), 10 ); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
static $wp_super_cache_constants = array( |
13
|
|
|
'WPLOCKDOWN', |
14
|
|
|
'WPSC_DISABLE_COMPRESSION', |
15
|
|
|
'WPSC_DISABLE_LOCKING', |
16
|
|
|
'WPSC_DISABLE_HTACCESS_UPDATE', |
17
|
|
|
'ADVANCEDCACHEPROBLEM', |
18
|
|
|
); |
19
|
|
|
|
20
|
|
|
static $wp_super_cache_callables = array( |
21
|
|
|
'wp_super_cache_globals' => array( __CLASS__, 'get_wp_super_cache_globals' ), |
22
|
|
|
); |
23
|
|
|
|
24
|
|
|
public function name() { |
25
|
|
|
return 'wp-super-cache'; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public static function get_wp_super_cache_globals() { |
29
|
|
|
global $wp_cache_mod_rewrite; |
30
|
|
|
global $cache_enabled; |
31
|
|
|
global $super_cache_enabled; |
32
|
|
|
global $ossdlcdn; |
33
|
|
|
global $cache_rebuild_files; |
34
|
|
|
global $wp_cache_mobile; |
35
|
|
|
global $wp_super_cache_late_init; |
36
|
|
|
global $wp_cache_anon_only; |
37
|
|
|
global $wp_cache_not_logged_in; |
38
|
|
|
global $wp_cache_clear_on_post_edit; |
39
|
|
|
global $wp_cache_mobile_enabled; |
40
|
|
|
global $wp_super_cache_debug; |
41
|
|
|
global $cache_max_time; |
42
|
|
|
global $wp_cache_refresh_single_only; |
43
|
|
|
global $wp_cache_mfunc_enabled; |
44
|
|
|
global $wp_supercache_304; |
45
|
|
|
global $wp_cache_no_cache_for_get; |
46
|
|
|
global $wp_cache_mutex_disabled; |
47
|
|
|
global $cache_jetpack; |
48
|
|
|
global $cache_domain_mapping; |
49
|
|
|
|
50
|
|
|
return array( |
51
|
|
|
'wp_cache_mod_rewrite' => $wp_cache_mod_rewrite, |
52
|
|
|
'cache_enabled' => $cache_enabled, |
53
|
|
|
'super_cache_enabled' => $super_cache_enabled, |
54
|
|
|
'ossdlcdn' => $ossdlcdn, |
55
|
|
|
'cache_rebuild_files' => $cache_rebuild_files, |
56
|
|
|
'wp_cache_mobile' => $wp_cache_mobile, |
57
|
|
|
'wp_super_cache_late_init' => $wp_super_cache_late_init, |
58
|
|
|
'wp_cache_anon_only' => $wp_cache_anon_only, |
59
|
|
|
'wp_cache_not_logged_in' => $wp_cache_not_logged_in, |
60
|
|
|
'wp_cache_clear_on_post_edit' => $wp_cache_clear_on_post_edit, |
61
|
|
|
'wp_cache_mobile_enabled' => $wp_cache_mobile_enabled, |
62
|
|
|
'wp_super_cache_debug' => $wp_super_cache_debug, |
63
|
|
|
'cache_max_time' => $cache_max_time, |
64
|
|
|
'wp_cache_refresh_single_only' => $wp_cache_refresh_single_only, |
65
|
|
|
'wp_cache_mfunc_enabled' => $wp_cache_mfunc_enabled, |
66
|
|
|
'wp_supercache_304' => $wp_supercache_304, |
67
|
|
|
'wp_cache_no_cache_for_get' => $wp_cache_no_cache_for_get, |
68
|
|
|
'wp_cache_mutex_disabled' => $wp_cache_mutex_disabled, |
69
|
|
|
'cache_jetpack' => $cache_jetpack, |
70
|
|
|
'cache_domain_mapping' => $cache_domain_mapping, |
71
|
|
|
); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function add_wp_super_cache_constants_whitelist( $list ) { |
75
|
|
|
return array_merge( $list, self::$wp_super_cache_constants ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function add_wp_super_cache_callable_whitelist( $list ) { |
79
|
|
|
return array_merge( $list, self::$wp_super_cache_callables ); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|