@@ -9,6 +9,8 @@ function run() {
9
9
10
10
add_filter ( 'w3tc_admin_menu ' , array ( $ this , 'w3tc_admin_menu ' ) );
11
11
add_action ( 'w3tc_ajax_ustats_get ' , array ( $ this , 'w3tc_ajax_ustats_get ' ) );
12
+ add_action ( 'w3tc_ajax_ustats_access_log_test ' ,
13
+ array ( $ this , 'w3tc_ajax_ustats_access_log_test ' ) );
12
14
13
15
add_filter ( 'w3tc_usage_statistics_summary_from_history ' , array (
14
16
'W3TC\UsageStatistics_Sources ' ,
@@ -33,9 +35,26 @@ function run() {
33
35
'admin_print_scripts_w3tc_stats '
34
36
) );
35
37
38
+ add_action ( 'w3tc_config_ui_save ' , array (
39
+ $ this ,
40
+ 'w3tc_config_ui_save '
41
+ ), 10 , 2 );
42
+
36
43
add_filter ( 'w3tc_notes ' , array ( $ this , 'w3tc_notes ' ) );
37
44
}
38
45
46
+ #
47
+
48
+
49
+ public function w3tc_config_ui_save ( $ config , $ old_config ) {
50
+ if ( $ config ->get ( 'stats.slot_seconds ' ) !=
51
+ $ old_config ->get ( 'stats.slot_seconds ' ) ) {
52
+ // flush all stats otherwise will be inconsistent
53
+ $ storage = new UsageStatistics_StorageWriter ();
54
+ $ storage ->reset ();
55
+ }
56
+ }
57
+
39
58
40
59
41
60
public function w3tc_notes ( $ notes ) {
@@ -45,8 +64,13 @@ public function w3tc_notes( $notes ) {
45
64
if ( $ c ->get_boolean ( 'stats.enabled ' ) &&
46
65
!$ state_master ->get_boolean ( 'common.hide_note_stats_enabled ' ) ) {
47
66
$ notes ['stats_enabled ' ] = sprintf (
48
- __ ( 'You’re running stats, it’s using Resources and not recommend to run continuously. %s ' ,
67
+ __ ( 'W3 Total Cache: Statistics collection is currently enabled. This consumes additional resources, and is not recommended to be run continuously. %s %s ' ,
49
68
'w3-total-cache ' ),
69
+ Util_Ui::button_link (
70
+ __ ( 'Disable statistics ' , 'w3-total-cache ' ),
71
+ Util_Ui::url ( array ( 'w3tc_ustats_note_disable ' => 'y ' ) ),
72
+ false , 'button ' ,
73
+ 'w3tc_note_stats_disable ' ),
50
74
Util_Ui::button_hide_note2 ( array (
51
75
'w3tc_default_config_state_master ' => 'y ' ,
52
76
'key ' => 'common.hide_note_stats_enabled ' ,
@@ -83,4 +107,19 @@ public function w3tc_ajax_ustats_get() {
83
107
echo json_encode ( $ summary );
84
108
exit ();
85
109
}
110
+
111
+
112
+
113
+ public function w3tc_ajax_ustats_access_log_test () {
114
+ $ filename = $ _REQUEST ['filename ' ];
115
+
116
+ $ filename = str_replace ( ':// ' , '/ ' , $ filename );
117
+ $ h = @fopen ( $ filename , 'rb ' );
118
+ if ( !$ h ) {
119
+ echo 'Failed to open file ' . $ filename ;
120
+ } else {
121
+ echo 'Success ' ;
122
+ }
123
+ exit ();
124
+ }
86
125
}
0 commit comments