1
|
|
|
<?php |
2
|
|
|
if ( ! empty( $_POST ) ) { |
3
|
|
|
if ( isset( $_POST['clearcache'] ) ) { |
4
|
|
|
$api = pods_api(); |
5
|
|
|
|
6
|
|
|
$api->cache_flush_pods(); |
7
|
|
|
|
8
|
|
|
if ( defined( 'PODS_PRELOAD_CONFIG_AFTER_FLUSH' ) && PODS_PRELOAD_CONFIG_AFTER_FLUSH ) { |
9
|
|
|
$api->load_pods( array( 'bypass_cache' => true ) ); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
pods_redirect( pods_query_arg( array( 'pods_clearcache' => 1 ), array( 'page', 'tab' ) ) ); |
13
|
|
|
} |
14
|
|
|
} elseif ( 1 == pods_v_sanitized( 'pods_clearcache' ) ) { |
15
|
|
|
pods_message( 'Pods transients and cache have been cleared.' ); |
16
|
|
|
} |
17
|
|
|
?> |
18
|
|
|
|
19
|
|
|
<h3><?php _e( 'Clear Pods Cache', 'pods' ); ?></h3> |
20
|
|
|
|
21
|
|
|
<p><?php esc_html_e( 'This tool will clear all of the transients/cache that are used by Pods.', 'pods' ); ?></p> |
22
|
|
|
|
23
|
|
|
<p class="submit"> |
24
|
|
|
<input type="submit" class="button button-primary" name="clearcache" value="<?php esc_attr_e( 'Clear Pods Cache', 'pods' ); ?>" /> |
25
|
|
|
</p> |
26
|
|
|
|
27
|
|
|
<hr /> |
28
|
|
|
|
29
|
|
|
<h3><?php _e( 'Debug Information', 'pods' ); ?></h3> |
30
|
|
|
|
31
|
|
|
<?php |
32
|
|
|
global $wp_version, $wpdb; |
|
|
|
|
33
|
|
|
|
34
|
|
|
$wp = $wp_version; |
35
|
|
|
$php = phpversion(); |
36
|
|
|
$mysql = $wpdb->db_version(); |
37
|
|
|
$plugins = array(); |
38
|
|
|
|
39
|
|
|
$all_plugins = get_plugins(); |
40
|
|
|
|
41
|
|
|
foreach ( $all_plugins as $plugin_file => $plugin_data ) { |
42
|
|
|
if ( is_plugin_active( $plugin_file ) ) { |
43
|
|
|
$plugins[ $plugin_data['Name'] ] = $plugin_data['Version']; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$stylesheet = get_stylesheet(); |
48
|
|
|
$theme = wp_get_theme( $stylesheet ); |
49
|
|
|
$theme_name = $theme->get( 'Name' ); |
50
|
|
|
|
51
|
|
|
$opcode_cache = array( |
52
|
|
|
'Apc' => function_exists( 'apc_cache_info' ) ? 'Yes' : 'No', |
53
|
|
|
'Memcached' => class_exists( 'eaccelerator_put' ) ? 'Yes' : 'No', |
54
|
|
|
'OPcache' => function_exists( 'opcache_get_status' ) ? 'Yes' : 'No', |
55
|
|
|
'Redis' => class_exists( 'xcache_set' ) ? 'Yes' : 'No', |
56
|
|
|
); |
57
|
|
|
|
58
|
|
|
$object_cache = array( |
59
|
|
|
'APC' => function_exists( 'apc_cache_info' ) ? 'Yes' : 'No', |
60
|
|
|
'APCu' => function_exists( 'apcu_cache_info' ) ? 'Yes' : 'No', |
61
|
|
|
'Memcache' => class_exists( 'Memcache' ) ? 'Yes' : 'No', |
62
|
|
|
'Memcached' => class_exists( 'Memcached' ) ? 'Yes' : 'No', |
63
|
|
|
'Redis' => class_exists( 'Redis' ) ? 'Yes' : 'No', |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
$versions = array( |
67
|
|
|
'WordPress Version' => $wp, |
68
|
|
|
'PHP Version' => $php, |
69
|
|
|
'MySQL Version' => $mysql, |
70
|
|
|
'Server Software' => $_SERVER['SERVER_SOFTWARE'], |
71
|
|
|
'Your User Agent' => $_SERVER['HTTP_USER_AGENT'], |
72
|
|
|
'Session Save Path' => session_save_path(), |
|
|
|
|
73
|
|
|
'Session Save Path Exists' => ( file_exists( session_save_path() ) ? 'Yes' : 'No' ), |
|
|
|
|
74
|
|
|
'Session Save Path Writeable' => ( is_writable( session_save_path() ) ? 'Yes' : 'No' ), |
|
|
|
|
75
|
|
|
'Session Max Lifetime' => ini_get( 'session.gc_maxlifetime' ), |
76
|
|
|
'Opcode Cache' => $opcode_cache, |
77
|
|
|
'Object Cache' => $object_cache, |
78
|
|
|
'WPDB Prefix' => $wpdb->prefix, |
79
|
|
|
'WP Multisite Mode' => ( is_multisite() ? 'Yes' : 'No' ), |
80
|
|
|
'WP Memory Limit' => WP_MEMORY_LIMIT, |
81
|
|
|
'Pods Network-Wide Activated' => ( is_plugin_active_for_network( basename( PODS_DIR ) . '/init.php' ) ? 'Yes' : 'No' ), |
82
|
|
|
'Pods Install Location' => PODS_DIR, |
83
|
|
|
'Pods Tableless Mode Activated' => ( ( pods_tableless() ) ? 'Yes' : 'No' ), |
84
|
|
|
'Pods Light Mode Activated' => ( ( defined( 'PODS_LIGHT' ) && PODS_LIGHT ) ? 'Yes' : 'No' ), |
85
|
|
|
'Currently Active Theme' => $theme_name, |
86
|
|
|
'Currently Active Plugins' => $plugins, |
87
|
|
|
); |
88
|
|
|
|
89
|
|
|
foreach ( $versions as $what => $version ) { |
90
|
|
|
echo '<p><strong>' . esc_html( $what ) . '</strong>: '; |
91
|
|
|
|
92
|
|
|
if ( is_array( $version ) ) { |
93
|
|
|
echo '</p><ul class="ul-disc">'; |
94
|
|
|
|
95
|
|
|
foreach ( $version as $what_v => $v ) { |
96
|
|
|
echo '<li><strong>' . esc_html( $what_v ) . '</strong>: ' . esc_html( $v ) . '</li>'; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
echo '</ul>'; |
100
|
|
|
} else { |
101
|
|
|
echo esc_html( $version ) . '</p>'; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state