Version Description
- Nov 2 2018 =
- : Separate Purge log for better debugging.
- 3rd: Now fully compatible with WPML.
- IAPI: Sped up Image Optimization workflow.
- GUI: Current IP now shows in Debug settings.
- GUI: Space separated placeholder queue list for better look.
- EU3 server IP Changed to 165.227.131.98.
Download this release
Release Info
Developer | LiteSpeedTech |
Plugin | LiteSpeed Cache |
Version | 2.7 |
Comparing to | |
See all releases |
Code changes from version 2.6.4.1 to 2.7
- admin/tpl/setting/settings_debug.php +3 -1
- admin/tpl/setting/settings_media.php +1 -1
- inc/litespeed-cache.class.php +4 -2
- inc/log.class.php +180 -132
- includes/litespeed-cache-log.class.php +180 -132
- includes/litespeed-cache.class.php +4 -2
- languages/litespeed-cache.pot +32 -28
- litespeed-cache.php +1 -1
- readme.txt +11 -2
admin/tpl/setting/settings_debug.php
CHANGED
@@ -55,7 +55,9 @@ if ( ! defined( 'WPINC' ) ) die ;
|
|
55 |
<td>
|
56 |
<?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_ADMIN_IPS, 30 ) ; ?>
|
57 |
<div class="litespeed-desc">
|
58 |
-
<?php echo __( 'Allows listed IPs (one per line) to perform certain actions from their browsers.', 'litespeed-cache' ) ;
|
|
|
|
|
59 |
<?php echo sprintf( __( 'More information about the available commands can be found <a %s>here</a>.', 'litespeed-cache' ),
|
60 |
'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:information:admin-ip-commands" target="_blank"' ) ; ?>
|
61 |
</div>
|
55 |
<td>
|
56 |
<?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_ADMIN_IPS, 30 ) ; ?>
|
57 |
<div class="litespeed-desc">
|
58 |
+
<?php echo __( 'Allows listed IPs (one per line) to perform certain actions from their browsers.', 'litespeed-cache' ) ; ?>
|
59 |
+
<?php echo __( 'Your IP', 'litespeed-cache' ) ; ?>: <code><?php echo LiteSpeed_Cache_Router::get_ip() ; ?></code>
|
60 |
+
<br />
|
61 |
<?php echo sprintf( __( 'More information about the available commands can be found <a %s>here</a>.', 'litespeed-cache' ),
|
62 |
'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:information:admin-ip-commands" target="_blank"' ) ; ?>
|
63 |
</div>
|
admin/tpl/setting/settings_media.php
CHANGED
@@ -105,7 +105,7 @@ $last_responsive_placeholder_generated = LiteSpeed_Cache_Media::get_summary() ;
|
|
105 |
<div class="litespeed-callout-warning">
|
106 |
<h4><?php echo __( 'Size list in queue waiting for cron','litespeed-cache' ) ; ?></h4>
|
107 |
<p>
|
108 |
-
<?php echo implode( '
|
109 |
</p>
|
110 |
</p>
|
111 |
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_MEDIA, LiteSpeed_Cache_Media::TYPE_GENERATE_PLACEHOLDER ) ; ?>" class="litespeed-btn-success">
|
105 |
<div class="litespeed-callout-warning">
|
106 |
<h4><?php echo __( 'Size list in queue waiting for cron','litespeed-cache' ) ; ?></h4>
|
107 |
<p>
|
108 |
+
<?php echo implode( ' ', $last_responsive_placeholder_generated[ 'queue' ] ) ; ?>
|
109 |
</p>
|
110 |
</p>
|
111 |
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_MEDIA, LiteSpeed_Cache_Media::TYPE_GENERATE_PLACEHOLDER ) ; ?>" class="litespeed-btn-success">
|
inc/litespeed-cache.class.php
CHANGED
@@ -25,7 +25,7 @@ class LiteSpeed_Cache
|
|
25 |
|
26 |
const NAME = 'LiteSpeed Cache' ;
|
27 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
28 |
-
const PLUGIN_VERSION = '2.
|
29 |
|
30 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
31 |
|
@@ -91,7 +91,7 @@ class LiteSpeed_Cache
|
|
91 |
|
92 |
// Check if debug is on
|
93 |
$should_debug = intval( self::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ) ;
|
94 |
-
if ( $should_debug == LiteSpeed_Cache_Config::VAL_ON ||
|
95 |
LiteSpeed_Cache_Log::init() ;
|
96 |
}
|
97 |
|
@@ -575,6 +575,8 @@ class LiteSpeed_Cache
|
|
575 |
// send PURGE header (Always send regardless of cache setting disabled/enabled)
|
576 |
if ( defined( 'LITESPEED_ON' ) && $purge_header ) {
|
577 |
@header( $purge_header ) ;
|
|
|
|
|
578 |
if ( defined( 'LSCWP_LOG' ) ) {
|
579 |
LiteSpeed_Cache_Log::debug( $purge_header ) ;
|
580 |
if ( $running_info_showing ) {
|
25 |
|
26 |
const NAME = 'LiteSpeed Cache' ;
|
27 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
28 |
+
const PLUGIN_VERSION = '2.7' ;
|
29 |
|
30 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
31 |
|
91 |
|
92 |
// Check if debug is on
|
93 |
$should_debug = intval( self::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ) ;
|
94 |
+
if ( $should_debug == LiteSpeed_Cache_Config::VAL_ON || $should_debug == LiteSpeed_Cache_Config::VAL_ON2 ) {
|
95 |
LiteSpeed_Cache_Log::init() ;
|
96 |
}
|
97 |
|
575 |
// send PURGE header (Always send regardless of cache setting disabled/enabled)
|
576 |
if ( defined( 'LITESPEED_ON' ) && $purge_header ) {
|
577 |
@header( $purge_header ) ;
|
578 |
+
LiteSpeed_Cache_Log::log_purge( $purge_header ) ;
|
579 |
+
|
580 |
if ( defined( 'LSCWP_LOG' ) ) {
|
581 |
LiteSpeed_Cache_Log::debug( $purge_header ) ;
|
582 |
if ( $running_info_showing ) {
|
inc/log.class.php
CHANGED
@@ -40,62 +40,36 @@ class LiteSpeed_Cache_Log
|
|
40 |
if ( ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) && $_SERVER[ 'HTTP_USER_AGENT' ] === Litespeed_Crawler::FAST_USER_AGENT ) {
|
41 |
self::$log_path = LSCWP_CONTENT_DIR . '/crawler.log' ;
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
|
47 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL ) ) {
|
48 |
-
define( 'LSCWP_LOG_MORE', true ) ;
|
49 |
}
|
50 |
|
51 |
-
$this->_init_request() ;
|
52 |
-
define( 'LSCWP_LOG', true ) ;
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
-
*
|
57 |
*
|
58 |
-
* @since
|
59 |
* @access public
|
60 |
*/
|
61 |
-
public static function
|
62 |
{
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
-
$
|
66 |
|
67 |
-
|
68 |
-
case self::TYPE_CLEAR_LOG :
|
69 |
-
$instance->_clear_log() ;
|
70 |
-
break ;
|
71 |
|
72 |
-
|
73 |
-
break ;
|
74 |
-
}
|
75 |
|
76 |
-
|
77 |
-
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Clear log file
|
81 |
-
*
|
82 |
-
* @since 1.6.6
|
83 |
-
* @access private
|
84 |
-
*/
|
85 |
-
private function _clear_log()
|
86 |
-
{
|
87 |
-
Litespeed_File::save( self::$log_path, '' ) ;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Heartbeat control
|
92 |
-
*
|
93 |
-
* @since 1.1.5
|
94 |
-
* @access public
|
95 |
-
*/
|
96 |
-
public static function disable_heartbeat()
|
97 |
-
{
|
98 |
-
wp_deregister_script( 'heartbeat' ) ;
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -106,8 +80,18 @@ class LiteSpeed_Cache_Log
|
|
106 |
*/
|
107 |
public static function init()
|
108 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
if ( ! defined( 'LSCWP_LOG' ) ) {// If not initialized, do it now
|
110 |
-
self::get_instance() ;
|
|
|
|
|
111 |
}
|
112 |
|
113 |
// Check if hook filters
|
@@ -119,6 +103,97 @@ class LiteSpeed_Cache_Log
|
|
119 |
}
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
* Log all filters and action hooks
|
124 |
*
|
@@ -238,117 +313,90 @@ class LiteSpeed_Cache_Log
|
|
238 |
{
|
239 |
// backtrace handler
|
240 |
if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
|
241 |
-
$
|
242 |
-
for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
|
243 |
-
if ( empty( $trace[ $i ][ 'class' ] ) ) {
|
244 |
-
if ( empty( $trace[ $i ][ 'file' ] ) ) {
|
245 |
-
break ;
|
246 |
-
}
|
247 |
-
$log = "\n" . $trace[ $i ][ 'file' ] ;
|
248 |
-
}
|
249 |
-
else {
|
250 |
-
if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
|
251 |
-
continue ;
|
252 |
-
}
|
253 |
-
|
254 |
-
$log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
|
255 |
-
}
|
256 |
-
if ( ! empty( $trace[$i-1]['line'] ) ) {
|
257 |
-
$log .= '@' . $trace[$i-1]['line'] ;
|
258 |
-
}
|
259 |
-
$msg .= " => $log" ;
|
260 |
-
}
|
261 |
-
|
262 |
}
|
263 |
|
264 |
Litespeed_File::append( self::$log_path, self::format_message( $msg ) ) ;
|
265 |
}
|
266 |
|
267 |
/**
|
268 |
-
*
|
269 |
*
|
270 |
-
* @since
|
271 |
-
* @access private
|
272 |
*/
|
273 |
-
private function
|
274 |
{
|
275 |
-
|
276 |
-
$log_file_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILE_SIZE ) ;
|
277 |
-
if ( file_exists( self::$log_path ) && filesize( self::$log_path ) > $log_file_size*1000000 ) {
|
278 |
-
Litespeed_File::save( self::$log_path, '' ) ;
|
279 |
-
}
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
288 |
}
|
289 |
|
290 |
-
$
|
291 |
-
|
292 |
-
'HTTP_ACCEPT' => '',
|
293 |
-
'HTTP_USER_AGENT' => '',
|
294 |
-
'HTTP_ACCEPT_ENCODING' => '',
|
295 |
-
'HTTP_COOKIE' => '',
|
296 |
-
'X-LSCACHE' => '',
|
297 |
-
'LSCACHE_VARY_COOKIE' => '',
|
298 |
-
'LSCACHE_VARY_VALUE' => '',
|
299 |
-
) ;
|
300 |
-
$server = array_merge( $servervars, $_SERVER ) ;
|
301 |
-
$params = array() ;
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
}
|
319 |
-
else {
|
320 |
-
$params[] = $param ;
|
321 |
-
$params[] = 'Query String: ' . $qs ;
|
322 |
-
}
|
323 |
|
324 |
-
|
325 |
-
$params[] = 'HTTP_REFERER: ' . $server[ 'HTTP_REFERER' ] ;
|
326 |
-
}
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
}
|
333 |
-
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE ) ) {
|
334 |
-
$params[] = 'Cookie: ' . $server['HTTP_COOKIE'] ;
|
335 |
-
}
|
336 |
-
if ( isset( $_COOKIE[ '_lscache_vary' ] ) ) {
|
337 |
-
$params[] = 'Cookie _lscache_vary: ' . $_COOKIE[ '_lscache_vary' ] ;
|
338 |
-
}
|
339 |
-
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
340 |
-
$params[] = 'X-LSCACHE: ' . ( ! empty( $server[ 'X-LSCACHE' ] ) ? 'true' : 'false' ) ;
|
341 |
-
}
|
342 |
-
if( $server['LSCACHE_VARY_COOKIE'] ) {
|
343 |
-
$params[] = 'LSCACHE_VARY_COOKIE: ' . $server['LSCACHE_VARY_COOKIE'] ;
|
344 |
-
}
|
345 |
-
if( $server['LSCACHE_VARY_VALUE'] ) {
|
346 |
-
$params[] = 'LSCACHE_VARY_VALUE: ' . $server['LSCACHE_VARY_VALUE'] ;
|
347 |
-
}
|
348 |
|
349 |
-
|
|
|
|
|
350 |
|
351 |
-
|
352 |
}
|
353 |
|
354 |
/**
|
40 |
if ( ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) && $_SERVER[ 'HTTP_USER_AGENT' ] === Litespeed_Crawler::FAST_USER_AGENT ) {
|
41 |
self::$log_path = LSCWP_CONTENT_DIR . '/crawler.log' ;
|
42 |
}
|
43 |
+
|
44 |
+
! defined( 'LSCWP_LOG_TAG' ) && define( 'LSCWP_LOG_TAG', get_current_blog_id() ) ;
|
|
|
45 |
|
46 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL ) ) {
|
47 |
+
! defined( 'LSCWP_LOG_MORE' ) && define( 'LSCWP_LOG_MORE', true ) ;
|
48 |
}
|
49 |
|
|
|
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* Log Purge headers separately
|
54 |
*
|
55 |
+
* @since 2.7
|
56 |
* @access public
|
57 |
*/
|
58 |
+
public static function log_purge( $purge_header )
|
59 |
{
|
60 |
+
// Check if debug is ON
|
61 |
+
if ( ! defined( 'LSCWP_LOG' ) && ! defined( 'LSCWP_LOG_BYPASS_NOTADMIN' ) ) {
|
62 |
+
return ;
|
63 |
+
}
|
64 |
|
65 |
+
$purge_file = LSCWP_CONTENT_DIR . '/debug.purge.log' ;
|
66 |
|
67 |
+
self::get_instance()->_init_request( $purge_file ) ;
|
|
|
|
|
|
|
68 |
|
69 |
+
$msg = $purge_header . self::_backtrace_info( 6 ) ;
|
|
|
|
|
70 |
|
71 |
+
Litespeed_File::append( $purge_file, self::format_message( $msg ) ) ;
|
|
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
80 |
*/
|
81 |
public static function init()
|
82 |
{
|
83 |
+
$debug = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ;
|
84 |
+
if ( $debug == LiteSpeed_Cache_Config::VAL_ON2 ) {
|
85 |
+
if ( ! LiteSpeed_Cache_Router::is_admin_ip() ) {
|
86 |
+
define( 'LSCWP_LOG_BYPASS_NOTADMIN', true ) ;
|
87 |
+
return ;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
if ( ! defined( 'LSCWP_LOG' ) ) {// If not initialized, do it now
|
92 |
+
self::get_instance()->_init_request() ;
|
93 |
+
define( 'LSCWP_LOG', true ) ;
|
94 |
+
|
95 |
}
|
96 |
|
97 |
// Check if hook filters
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* Create the initial log messages with the request parameters.
|
108 |
+
*
|
109 |
+
* @since 1.0.12
|
110 |
+
* @access private
|
111 |
+
*/
|
112 |
+
private function _init_request( $log_file = null )
|
113 |
+
{
|
114 |
+
if ( ! $log_file ) {
|
115 |
+
$log_file = self::$log_path ;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Check log file size
|
119 |
+
$log_file_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILE_SIZE ) ;
|
120 |
+
if ( file_exists( $log_file ) && filesize( $log_file ) > $log_file_size * 1000000 ) {
|
121 |
+
Litespeed_File::save( $log_file, '' ) ;
|
122 |
+
}
|
123 |
+
|
124 |
+
// For more than 2s's requests, add more break
|
125 |
+
if ( file_exists( $log_file ) && time() - filemtime( $log_file ) > 2 ) {
|
126 |
+
Litespeed_File::append( $log_file, "\n\n\n\n" ) ;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( PHP_SAPI == 'cli' ) {
|
130 |
+
return ;
|
131 |
+
}
|
132 |
+
|
133 |
+
$servervars = array(
|
134 |
+
'Query String' => '',
|
135 |
+
'HTTP_ACCEPT' => '',
|
136 |
+
'HTTP_USER_AGENT' => '',
|
137 |
+
'HTTP_ACCEPT_ENCODING' => '',
|
138 |
+
'HTTP_COOKIE' => '',
|
139 |
+
'X-LSCACHE' => '',
|
140 |
+
'LSCACHE_VARY_COOKIE' => '',
|
141 |
+
'LSCACHE_VARY_VALUE' => '',
|
142 |
+
) ;
|
143 |
+
$server = array_merge( $servervars, $_SERVER ) ;
|
144 |
+
$params = array() ;
|
145 |
+
|
146 |
+
if ( isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] == 'on' ) {
|
147 |
+
$server['SERVER_PROTOCOL'] .= ' (HTTPS) ' ;
|
148 |
+
}
|
149 |
+
|
150 |
+
$param = sprintf( '------%s %s %s', $server['REQUEST_METHOD'], $server['SERVER_PROTOCOL'], strtok( $server['REQUEST_URI'], '?' ) ) ;
|
151 |
+
|
152 |
+
$qs = ! empty( $server['QUERY_STRING'] ) ? $server['QUERY_STRING'] : '' ;
|
153 |
+
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_COLLAPS_QS ) ) {
|
154 |
+
if ( strlen( $qs ) > 53 ) {
|
155 |
+
$qs = substr( $qs, 0, 53 ) . '...' ;
|
156 |
+
}
|
157 |
+
if ( $qs ) {
|
158 |
+
$param .= ' ? ' . $qs ;
|
159 |
+
}
|
160 |
+
$params[] = $param ;
|
161 |
+
}
|
162 |
+
else {
|
163 |
+
$params[] = $param ;
|
164 |
+
$params[] = 'Query String: ' . $qs ;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( ! empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
|
168 |
+
$params[] = 'HTTP_REFERER: ' . $server[ 'HTTP_REFERER' ] ;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
172 |
+
$params[] = 'User Agent: ' . $server[ 'HTTP_USER_AGENT' ] ;
|
173 |
+
$params[] = 'Accept: ' . $server['HTTP_ACCEPT'] ;
|
174 |
+
$params[] = 'Accept Encoding: ' . $server['HTTP_ACCEPT_ENCODING'] ;
|
175 |
+
}
|
176 |
+
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE ) ) {
|
177 |
+
$params[] = 'Cookie: ' . $server['HTTP_COOKIE'] ;
|
178 |
+
}
|
179 |
+
if ( isset( $_COOKIE[ '_lscache_vary' ] ) ) {
|
180 |
+
$params[] = 'Cookie _lscache_vary: ' . $_COOKIE[ '_lscache_vary' ] ;
|
181 |
+
}
|
182 |
+
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
183 |
+
$params[] = 'X-LSCACHE: ' . ( ! empty( $server[ 'X-LSCACHE' ] ) ? 'true' : 'false' ) ;
|
184 |
+
}
|
185 |
+
if( $server['LSCACHE_VARY_COOKIE'] ) {
|
186 |
+
$params[] = 'LSCACHE_VARY_COOKIE: ' . $server['LSCACHE_VARY_COOKIE'] ;
|
187 |
+
}
|
188 |
+
if( $server['LSCACHE_VARY_VALUE'] ) {
|
189 |
+
$params[] = 'LSCACHE_VARY_VALUE: ' . $server['LSCACHE_VARY_VALUE'] ;
|
190 |
+
}
|
191 |
+
|
192 |
+
$request = array_map( 'self::format_message', $params ) ;
|
193 |
+
|
194 |
+
Litespeed_File::append( $log_file, $request ) ;
|
195 |
+
}
|
196 |
+
|
197 |
/**
|
198 |
* Log all filters and action hooks
|
199 |
*
|
313 |
{
|
314 |
// backtrace handler
|
315 |
if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
|
316 |
+
$msg .= self::_backtrace_info( $backtrace_limit ) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
318 |
|
319 |
Litespeed_File::append( self::$log_path, self::format_message( $msg ) ) ;
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
+
* Backtrace info
|
324 |
*
|
325 |
+
* @since 2.7
|
|
|
326 |
*/
|
327 |
+
private static function _backtrace_info( $backtrace_limit )
|
328 |
{
|
329 |
+
$msg = '' ;
|
|
|
|
|
|
|
|
|
330 |
|
331 |
+
$trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 3 ) ;
|
332 |
+
for ( $i=2 ; $i <= $backtrace_limit + 2 ; $i++ ) {// 0st => _backtrace_info(), 1st => push()
|
333 |
+
if ( empty( $trace[ $i ][ 'class' ] ) ) {
|
334 |
+
if ( empty( $trace[ $i ][ 'file' ] ) ) {
|
335 |
+
break ;
|
336 |
+
}
|
337 |
+
$log = "\n" . $trace[ $i ][ 'file' ] ;
|
338 |
+
}
|
339 |
+
else {
|
340 |
+
if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
|
341 |
+
continue ;
|
342 |
+
}
|
343 |
|
344 |
+
$log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
|
345 |
+
}
|
346 |
+
if ( ! empty( $trace[$i-1]['line'] ) ) {
|
347 |
+
$log .= '@' . $trace[$i-1]['line'] ;
|
348 |
+
}
|
349 |
+
$msg .= " => $log" ;
|
350 |
}
|
351 |
|
352 |
+
return $msg ;
|
353 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
+
/**
|
356 |
+
* Clear log file
|
357 |
+
*
|
358 |
+
* @since 1.6.6
|
359 |
+
* @access private
|
360 |
+
*/
|
361 |
+
private function _clear_log()
|
362 |
+
{
|
363 |
+
Litespeed_File::save( self::$log_path, '' ) ;
|
364 |
+
Litespeed_File::save( LSCWP_CONTENT_DIR . '/debug.purge.log', '' ) ;
|
365 |
+
}
|
366 |
|
367 |
+
/**
|
368 |
+
* Heartbeat control
|
369 |
+
*
|
370 |
+
* @since 1.1.5
|
371 |
+
* @access public
|
372 |
+
*/
|
373 |
+
public static function disable_heartbeat()
|
374 |
+
{
|
375 |
+
wp_deregister_script( 'heartbeat' ) ;
|
376 |
+
}
|
377 |
|
378 |
+
/**
|
379 |
+
* Handle all request actions from main cls
|
380 |
+
*
|
381 |
+
* @since 1.6.6
|
382 |
+
* @access public
|
383 |
+
*/
|
384 |
+
public static function handler()
|
385 |
+
{
|
386 |
+
$instance = self::get_instance() ;
|
|
|
|
|
|
|
|
|
|
|
387 |
|
388 |
+
$type = LiteSpeed_Cache_Router::verify_type() ;
|
|
|
|
|
389 |
|
390 |
+
switch ( $type ) {
|
391 |
+
case self::TYPE_CLEAR_LOG :
|
392 |
+
$instance->_clear_log() ;
|
393 |
+
break ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
|
395 |
+
default:
|
396 |
+
break ;
|
397 |
+
}
|
398 |
|
399 |
+
LiteSpeed_Cache_Admin::redirect() ;
|
400 |
}
|
401 |
|
402 |
/**
|
includes/litespeed-cache-log.class.php
CHANGED
@@ -40,62 +40,36 @@ class LiteSpeed_Cache_Log
|
|
40 |
if ( ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) && $_SERVER[ 'HTTP_USER_AGENT' ] === Litespeed_Crawler::FAST_USER_AGENT ) {
|
41 |
self::$log_path = LSCWP_CONTENT_DIR . '/crawler.log' ;
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
|
47 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL ) ) {
|
48 |
-
define( 'LSCWP_LOG_MORE', true ) ;
|
49 |
}
|
50 |
|
51 |
-
$this->_init_request() ;
|
52 |
-
define( 'LSCWP_LOG', true ) ;
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
-
*
|
57 |
*
|
58 |
-
* @since
|
59 |
* @access public
|
60 |
*/
|
61 |
-
public static function
|
62 |
{
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
-
$
|
66 |
|
67 |
-
|
68 |
-
case self::TYPE_CLEAR_LOG :
|
69 |
-
$instance->_clear_log() ;
|
70 |
-
break ;
|
71 |
|
72 |
-
|
73 |
-
break ;
|
74 |
-
}
|
75 |
|
76 |
-
|
77 |
-
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Clear log file
|
81 |
-
*
|
82 |
-
* @since 1.6.6
|
83 |
-
* @access private
|
84 |
-
*/
|
85 |
-
private function _clear_log()
|
86 |
-
{
|
87 |
-
Litespeed_File::save( self::$log_path, '' ) ;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Heartbeat control
|
92 |
-
*
|
93 |
-
* @since 1.1.5
|
94 |
-
* @access public
|
95 |
-
*/
|
96 |
-
public static function disable_heartbeat()
|
97 |
-
{
|
98 |
-
wp_deregister_script( 'heartbeat' ) ;
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -106,8 +80,18 @@ class LiteSpeed_Cache_Log
|
|
106 |
*/
|
107 |
public static function init()
|
108 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
if ( ! defined( 'LSCWP_LOG' ) ) {// If not initialized, do it now
|
110 |
-
self::get_instance() ;
|
|
|
|
|
111 |
}
|
112 |
|
113 |
// Check if hook filters
|
@@ -119,6 +103,97 @@ class LiteSpeed_Cache_Log
|
|
119 |
}
|
120 |
}
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
* Log all filters and action hooks
|
124 |
*
|
@@ -238,117 +313,90 @@ class LiteSpeed_Cache_Log
|
|
238 |
{
|
239 |
// backtrace handler
|
240 |
if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
|
241 |
-
$
|
242 |
-
for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
|
243 |
-
if ( empty( $trace[ $i ][ 'class' ] ) ) {
|
244 |
-
if ( empty( $trace[ $i ][ 'file' ] ) ) {
|
245 |
-
break ;
|
246 |
-
}
|
247 |
-
$log = "\n" . $trace[ $i ][ 'file' ] ;
|
248 |
-
}
|
249 |
-
else {
|
250 |
-
if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
|
251 |
-
continue ;
|
252 |
-
}
|
253 |
-
|
254 |
-
$log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
|
255 |
-
}
|
256 |
-
if ( ! empty( $trace[$i-1]['line'] ) ) {
|
257 |
-
$log .= '@' . $trace[$i-1]['line'] ;
|
258 |
-
}
|
259 |
-
$msg .= " => $log" ;
|
260 |
-
}
|
261 |
-
|
262 |
}
|
263 |
|
264 |
Litespeed_File::append( self::$log_path, self::format_message( $msg ) ) ;
|
265 |
}
|
266 |
|
267 |
/**
|
268 |
-
*
|
269 |
*
|
270 |
-
* @since
|
271 |
-
* @access private
|
272 |
*/
|
273 |
-
private function
|
274 |
{
|
275 |
-
|
276 |
-
$log_file_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILE_SIZE ) ;
|
277 |
-
if ( file_exists( self::$log_path ) && filesize( self::$log_path ) > $log_file_size*1000000 ) {
|
278 |
-
Litespeed_File::save( self::$log_path, '' ) ;
|
279 |
-
}
|
280 |
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
288 |
}
|
289 |
|
290 |
-
$
|
291 |
-
|
292 |
-
'HTTP_ACCEPT' => '',
|
293 |
-
'HTTP_USER_AGENT' => '',
|
294 |
-
'HTTP_ACCEPT_ENCODING' => '',
|
295 |
-
'HTTP_COOKIE' => '',
|
296 |
-
'X-LSCACHE' => '',
|
297 |
-
'LSCACHE_VARY_COOKIE' => '',
|
298 |
-
'LSCACHE_VARY_VALUE' => '',
|
299 |
-
) ;
|
300 |
-
$server = array_merge( $servervars, $_SERVER ) ;
|
301 |
-
$params = array() ;
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
}
|
319 |
-
else {
|
320 |
-
$params[] = $param ;
|
321 |
-
$params[] = 'Query String: ' . $qs ;
|
322 |
-
}
|
323 |
|
324 |
-
|
325 |
-
$params[] = 'HTTP_REFERER: ' . $server[ 'HTTP_REFERER' ] ;
|
326 |
-
}
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
}
|
333 |
-
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE ) ) {
|
334 |
-
$params[] = 'Cookie: ' . $server['HTTP_COOKIE'] ;
|
335 |
-
}
|
336 |
-
if ( isset( $_COOKIE[ '_lscache_vary' ] ) ) {
|
337 |
-
$params[] = 'Cookie _lscache_vary: ' . $_COOKIE[ '_lscache_vary' ] ;
|
338 |
-
}
|
339 |
-
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
340 |
-
$params[] = 'X-LSCACHE: ' . ( ! empty( $server[ 'X-LSCACHE' ] ) ? 'true' : 'false' ) ;
|
341 |
-
}
|
342 |
-
if( $server['LSCACHE_VARY_COOKIE'] ) {
|
343 |
-
$params[] = 'LSCACHE_VARY_COOKIE: ' . $server['LSCACHE_VARY_COOKIE'] ;
|
344 |
-
}
|
345 |
-
if( $server['LSCACHE_VARY_VALUE'] ) {
|
346 |
-
$params[] = 'LSCACHE_VARY_VALUE: ' . $server['LSCACHE_VARY_VALUE'] ;
|
347 |
-
}
|
348 |
|
349 |
-
|
|
|
|
|
350 |
|
351 |
-
|
352 |
}
|
353 |
|
354 |
/**
|
40 |
if ( ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) && $_SERVER[ 'HTTP_USER_AGENT' ] === Litespeed_Crawler::FAST_USER_AGENT ) {
|
41 |
self::$log_path = LSCWP_CONTENT_DIR . '/crawler.log' ;
|
42 |
}
|
43 |
+
|
44 |
+
! defined( 'LSCWP_LOG_TAG' ) && define( 'LSCWP_LOG_TAG', get_current_blog_id() ) ;
|
|
|
45 |
|
46 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL ) ) {
|
47 |
+
! defined( 'LSCWP_LOG_MORE' ) && define( 'LSCWP_LOG_MORE', true ) ;
|
48 |
}
|
49 |
|
|
|
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* Log Purge headers separately
|
54 |
*
|
55 |
+
* @since 2.7
|
56 |
* @access public
|
57 |
*/
|
58 |
+
public static function log_purge( $purge_header )
|
59 |
{
|
60 |
+
// Check if debug is ON
|
61 |
+
if ( ! defined( 'LSCWP_LOG' ) && ! defined( 'LSCWP_LOG_BYPASS_NOTADMIN' ) ) {
|
62 |
+
return ;
|
63 |
+
}
|
64 |
|
65 |
+
$purge_file = LSCWP_CONTENT_DIR . '/debug.purge.log' ;
|
66 |
|
67 |
+
self::get_instance()->_init_request( $purge_file ) ;
|
|
|
|
|
|
|
68 |
|
69 |
+
$msg = $purge_header . self::_backtrace_info( 6 ) ;
|
|
|
|
|
70 |
|
71 |
+
Litespeed_File::append( $purge_file, self::format_message( $msg ) ) ;
|
|
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
80 |
*/
|
81 |
public static function init()
|
82 |
{
|
83 |
+
$debug = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ;
|
84 |
+
if ( $debug == LiteSpeed_Cache_Config::VAL_ON2 ) {
|
85 |
+
if ( ! LiteSpeed_Cache_Router::is_admin_ip() ) {
|
86 |
+
define( 'LSCWP_LOG_BYPASS_NOTADMIN', true ) ;
|
87 |
+
return ;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
if ( ! defined( 'LSCWP_LOG' ) ) {// If not initialized, do it now
|
92 |
+
self::get_instance()->_init_request() ;
|
93 |
+
define( 'LSCWP_LOG', true ) ;
|
94 |
+
|
95 |
}
|
96 |
|
97 |
// Check if hook filters
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* Create the initial log messages with the request parameters.
|
108 |
+
*
|
109 |
+
* @since 1.0.12
|
110 |
+
* @access private
|
111 |
+
*/
|
112 |
+
private function _init_request( $log_file = null )
|
113 |
+
{
|
114 |
+
if ( ! $log_file ) {
|
115 |
+
$log_file = self::$log_path ;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Check log file size
|
119 |
+
$log_file_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILE_SIZE ) ;
|
120 |
+
if ( file_exists( $log_file ) && filesize( $log_file ) > $log_file_size * 1000000 ) {
|
121 |
+
Litespeed_File::save( $log_file, '' ) ;
|
122 |
+
}
|
123 |
+
|
124 |
+
// For more than 2s's requests, add more break
|
125 |
+
if ( file_exists( $log_file ) && time() - filemtime( $log_file ) > 2 ) {
|
126 |
+
Litespeed_File::append( $log_file, "\n\n\n\n" ) ;
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( PHP_SAPI == 'cli' ) {
|
130 |
+
return ;
|
131 |
+
}
|
132 |
+
|
133 |
+
$servervars = array(
|
134 |
+
'Query String' => '',
|
135 |
+
'HTTP_ACCEPT' => '',
|
136 |
+
'HTTP_USER_AGENT' => '',
|
137 |
+
'HTTP_ACCEPT_ENCODING' => '',
|
138 |
+
'HTTP_COOKIE' => '',
|
139 |
+
'X-LSCACHE' => '',
|
140 |
+
'LSCACHE_VARY_COOKIE' => '',
|
141 |
+
'LSCACHE_VARY_VALUE' => '',
|
142 |
+
) ;
|
143 |
+
$server = array_merge( $servervars, $_SERVER ) ;
|
144 |
+
$params = array() ;
|
145 |
+
|
146 |
+
if ( isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] == 'on' ) {
|
147 |
+
$server['SERVER_PROTOCOL'] .= ' (HTTPS) ' ;
|
148 |
+
}
|
149 |
+
|
150 |
+
$param = sprintf( '------%s %s %s', $server['REQUEST_METHOD'], $server['SERVER_PROTOCOL'], strtok( $server['REQUEST_URI'], '?' ) ) ;
|
151 |
+
|
152 |
+
$qs = ! empty( $server['QUERY_STRING'] ) ? $server['QUERY_STRING'] : '' ;
|
153 |
+
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_COLLAPS_QS ) ) {
|
154 |
+
if ( strlen( $qs ) > 53 ) {
|
155 |
+
$qs = substr( $qs, 0, 53 ) . '...' ;
|
156 |
+
}
|
157 |
+
if ( $qs ) {
|
158 |
+
$param .= ' ? ' . $qs ;
|
159 |
+
}
|
160 |
+
$params[] = $param ;
|
161 |
+
}
|
162 |
+
else {
|
163 |
+
$params[] = $param ;
|
164 |
+
$params[] = 'Query String: ' . $qs ;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( ! empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
|
168 |
+
$params[] = 'HTTP_REFERER: ' . $server[ 'HTTP_REFERER' ] ;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
172 |
+
$params[] = 'User Agent: ' . $server[ 'HTTP_USER_AGENT' ] ;
|
173 |
+
$params[] = 'Accept: ' . $server['HTTP_ACCEPT'] ;
|
174 |
+
$params[] = 'Accept Encoding: ' . $server['HTTP_ACCEPT_ENCODING'] ;
|
175 |
+
}
|
176 |
+
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE ) ) {
|
177 |
+
$params[] = 'Cookie: ' . $server['HTTP_COOKIE'] ;
|
178 |
+
}
|
179 |
+
if ( isset( $_COOKIE[ '_lscache_vary' ] ) ) {
|
180 |
+
$params[] = 'Cookie _lscache_vary: ' . $_COOKIE[ '_lscache_vary' ] ;
|
181 |
+
}
|
182 |
+
if ( defined( 'LSCWP_LOG_MORE' ) ) {
|
183 |
+
$params[] = 'X-LSCACHE: ' . ( ! empty( $server[ 'X-LSCACHE' ] ) ? 'true' : 'false' ) ;
|
184 |
+
}
|
185 |
+
if( $server['LSCACHE_VARY_COOKIE'] ) {
|
186 |
+
$params[] = 'LSCACHE_VARY_COOKIE: ' . $server['LSCACHE_VARY_COOKIE'] ;
|
187 |
+
}
|
188 |
+
if( $server['LSCACHE_VARY_VALUE'] ) {
|
189 |
+
$params[] = 'LSCACHE_VARY_VALUE: ' . $server['LSCACHE_VARY_VALUE'] ;
|
190 |
+
}
|
191 |
+
|
192 |
+
$request = array_map( 'self::format_message', $params ) ;
|
193 |
+
|
194 |
+
Litespeed_File::append( $log_file, $request ) ;
|
195 |
+
}
|
196 |
+
|
197 |
/**
|
198 |
* Log all filters and action hooks
|
199 |
*
|
313 |
{
|
314 |
// backtrace handler
|
315 |
if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
|
316 |
+
$msg .= self::_backtrace_info( $backtrace_limit ) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
318 |
|
319 |
Litespeed_File::append( self::$log_path, self::format_message( $msg ) ) ;
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
+
* Backtrace info
|
324 |
*
|
325 |
+
* @since 2.7
|
|
|
326 |
*/
|
327 |
+
private static function _backtrace_info( $backtrace_limit )
|
328 |
{
|
329 |
+
$msg = '' ;
|
|
|
|
|
|
|
|
|
330 |
|
331 |
+
$trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 3 ) ;
|
332 |
+
for ( $i=2 ; $i <= $backtrace_limit + 2 ; $i++ ) {// 0st => _backtrace_info(), 1st => push()
|
333 |
+
if ( empty( $trace[ $i ][ 'class' ] ) ) {
|
334 |
+
if ( empty( $trace[ $i ][ 'file' ] ) ) {
|
335 |
+
break ;
|
336 |
+
}
|
337 |
+
$log = "\n" . $trace[ $i ][ 'file' ] ;
|
338 |
+
}
|
339 |
+
else {
|
340 |
+
if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
|
341 |
+
continue ;
|
342 |
+
}
|
343 |
|
344 |
+
$log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
|
345 |
+
}
|
346 |
+
if ( ! empty( $trace[$i-1]['line'] ) ) {
|
347 |
+
$log .= '@' . $trace[$i-1]['line'] ;
|
348 |
+
}
|
349 |
+
$msg .= " => $log" ;
|
350 |
}
|
351 |
|
352 |
+
return $msg ;
|
353 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
+
/**
|
356 |
+
* Clear log file
|
357 |
+
*
|
358 |
+
* @since 1.6.6
|
359 |
+
* @access private
|
360 |
+
*/
|
361 |
+
private function _clear_log()
|
362 |
+
{
|
363 |
+
Litespeed_File::save( self::$log_path, '' ) ;
|
364 |
+
Litespeed_File::save( LSCWP_CONTENT_DIR . '/debug.purge.log', '' ) ;
|
365 |
+
}
|
366 |
|
367 |
+
/**
|
368 |
+
* Heartbeat control
|
369 |
+
*
|
370 |
+
* @since 1.1.5
|
371 |
+
* @access public
|
372 |
+
*/
|
373 |
+
public static function disable_heartbeat()
|
374 |
+
{
|
375 |
+
wp_deregister_script( 'heartbeat' ) ;
|
376 |
+
}
|
377 |
|
378 |
+
/**
|
379 |
+
* Handle all request actions from main cls
|
380 |
+
*
|
381 |
+
* @since 1.6.6
|
382 |
+
* @access public
|
383 |
+
*/
|
384 |
+
public static function handler()
|
385 |
+
{
|
386 |
+
$instance = self::get_instance() ;
|
|
|
|
|
|
|
|
|
|
|
387 |
|
388 |
+
$type = LiteSpeed_Cache_Router::verify_type() ;
|
|
|
|
|
389 |
|
390 |
+
switch ( $type ) {
|
391 |
+
case self::TYPE_CLEAR_LOG :
|
392 |
+
$instance->_clear_log() ;
|
393 |
+
break ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
|
395 |
+
default:
|
396 |
+
break ;
|
397 |
+
}
|
398 |
|
399 |
+
LiteSpeed_Cache_Admin::redirect() ;
|
400 |
}
|
401 |
|
402 |
/**
|
includes/litespeed-cache.class.php
CHANGED
@@ -25,7 +25,7 @@ class LiteSpeed_Cache
|
|
25 |
|
26 |
const NAME = 'LiteSpeed Cache' ;
|
27 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
28 |
-
const PLUGIN_VERSION = '2.
|
29 |
|
30 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
31 |
|
@@ -91,7 +91,7 @@ class LiteSpeed_Cache
|
|
91 |
|
92 |
// Check if debug is on
|
93 |
$should_debug = intval( self::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ) ;
|
94 |
-
if ( $should_debug == LiteSpeed_Cache_Config::VAL_ON ||
|
95 |
LiteSpeed_Cache_Log::init() ;
|
96 |
}
|
97 |
|
@@ -575,6 +575,8 @@ class LiteSpeed_Cache
|
|
575 |
// send PURGE header (Always send regardless of cache setting disabled/enabled)
|
576 |
if ( defined( 'LITESPEED_ON' ) && $purge_header ) {
|
577 |
@header( $purge_header ) ;
|
|
|
|
|
578 |
if ( defined( 'LSCWP_LOG' ) ) {
|
579 |
LiteSpeed_Cache_Log::debug( $purge_header ) ;
|
580 |
if ( $running_info_showing ) {
|
25 |
|
26 |
const NAME = 'LiteSpeed Cache' ;
|
27 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
28 |
+
const PLUGIN_VERSION = '2.7' ;
|
29 |
|
30 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
31 |
|
91 |
|
92 |
// Check if debug is on
|
93 |
$should_debug = intval( self::config( LiteSpeed_Cache_Config::OPID_DEBUG ) ) ;
|
94 |
+
if ( $should_debug == LiteSpeed_Cache_Config::VAL_ON || $should_debug == LiteSpeed_Cache_Config::VAL_ON2 ) {
|
95 |
LiteSpeed_Cache_Log::init() ;
|
96 |
}
|
97 |
|
575 |
// send PURGE header (Always send regardless of cache setting disabled/enabled)
|
576 |
if ( defined( 'LITESPEED_ON' ) && $purge_header ) {
|
577 |
@header( $purge_header ) ;
|
578 |
+
LiteSpeed_Cache_Log::log_purge( $purge_header ) ;
|
579 |
+
|
580 |
if ( defined( 'LSCWP_LOG' ) ) {
|
581 |
LiteSpeed_Cache_Log::debug( $purge_header ) ;
|
582 |
if ( $running_info_showing ) {
|
languages/litespeed-cache.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the LiteSpeed Cache package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: LiteSpeed Cache 2.6.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
|
7 |
-
"POT-Creation-Date: 2018-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -603,8 +603,8 @@ msgstr ""
|
|
603 |
|
604 |
#: admin/tpl/crawler.php:92 admin/tpl/inc/check_cache_disabled.php:38
|
605 |
#: admin/tpl/inc/img_optm.summary.php:210 admin/tpl/manage/manage_cdn.php:15
|
606 |
-
#: admin/tpl/setting/settings_debug.php:
|
607 |
-
#: admin/tpl/setting/settings_debug.php:
|
608 |
#: admin/tpl/setting/settings_media.php:182
|
609 |
#: admin/tpl/setting/settings_optimize.php:15 admin/tpl/settings.php:185
|
610 |
msgid "WARNING"
|
@@ -874,7 +874,7 @@ msgstr ""
|
|
874 |
msgid "Rate %s on %s"
|
875 |
msgstr ""
|
876 |
|
877 |
-
#. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.6.4) #-#-#-#-#
|
878 |
#. Plugin Name of the plugin/theme
|
879 |
#: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:353
|
880 |
#: includes/litespeed-cache-gui.class.php:353
|
@@ -1753,7 +1753,7 @@ msgstr ""
|
|
1753 |
msgid "Media"
|
1754 |
msgstr ""
|
1755 |
|
1756 |
-
#: admin/tpl/network_settings.php:10 admin/tpl/setting/settings_debug.php:
|
1757 |
#: admin/tpl/settings.php:14
|
1758 |
msgid "Advanced"
|
1759 |
msgstr ""
|
@@ -2402,97 +2402,101 @@ msgid ""
|
|
2402 |
msgstr ""
|
2403 |
|
2404 |
#: admin/tpl/setting/settings_debug.php:59
|
|
|
|
|
|
|
|
|
2405 |
msgid ""
|
2406 |
"More information about the available commands can be found <a %s>here</a>."
|
2407 |
msgstr ""
|
2408 |
|
2409 |
-
#: admin/tpl/setting/settings_debug.php:
|
2410 |
msgid "Debug Level"
|
2411 |
msgstr ""
|
2412 |
|
2413 |
-
#: admin/tpl/setting/settings_debug.php:
|
2414 |
msgid "Basic"
|
2415 |
msgstr ""
|
2416 |
|
2417 |
-
#: admin/tpl/setting/settings_debug.php:
|
2418 |
msgid "Advanced level will log more details."
|
2419 |
msgstr ""
|
2420 |
|
2421 |
-
#: admin/tpl/setting/settings_debug.php:
|
2422 |
msgid "Log File Size Limit"
|
2423 |
msgstr ""
|
2424 |
|
2425 |
-
#: admin/tpl/setting/settings_debug.php:
|
2426 |
#: admin/tpl/setting/settings_tuning.php:88
|
2427 |
msgid "MB"
|
2428 |
msgstr ""
|
2429 |
|
2430 |
-
#: admin/tpl/setting/settings_debug.php:
|
2431 |
msgid ""
|
2432 |
"Specify the maximum size of the log file. Minimum is 3MB. Maximum is 3000MB."
|
2433 |
msgstr ""
|
2434 |
|
2435 |
-
#: admin/tpl/setting/settings_debug.php:
|
2436 |
msgid "Heartbeat"
|
2437 |
msgstr ""
|
2438 |
|
2439 |
-
#: admin/tpl/setting/settings_debug.php:
|
2440 |
msgid ""
|
2441 |
"Disable WordPress heartbeat to prevent AJAX calls from breaking debug "
|
2442 |
"logging."
|
2443 |
msgstr ""
|
2444 |
|
2445 |
-
#: admin/tpl/setting/settings_debug.php:
|
2446 |
msgid ""
|
2447 |
"Disabling this may cause WordPress tasks triggered by AJAX to stop working."
|
2448 |
msgstr ""
|
2449 |
|
2450 |
-
#: admin/tpl/setting/settings_debug.php:
|
2451 |
msgid "Log Cookies"
|
2452 |
msgstr ""
|
2453 |
|
2454 |
-
#: admin/tpl/setting/settings_debug.php:
|
2455 |
msgid "Log request cookie values."
|
2456 |
msgstr ""
|
2457 |
|
2458 |
-
#: admin/tpl/setting/settings_debug.php:
|
2459 |
msgid "Collapse Query Strings"
|
2460 |
msgstr ""
|
2461 |
|
2462 |
-
#: admin/tpl/setting/settings_debug.php:
|
2463 |
msgid "Shorten query strings in the debug log to improve readability."
|
2464 |
msgstr ""
|
2465 |
|
2466 |
-
#: admin/tpl/setting/settings_debug.php:
|
2467 |
msgid "Log Filters"
|
2468 |
msgstr ""
|
2469 |
|
2470 |
-
#: admin/tpl/setting/settings_debug.php:
|
2471 |
msgid "Log all WordPress filter hooks."
|
2472 |
msgstr ""
|
2473 |
|
2474 |
-
#: admin/tpl/setting/settings_debug.php:
|
2475 |
msgid "Enabling this option will cause log file size to grow quickly."
|
2476 |
msgstr ""
|
2477 |
|
2478 |
-
#: admin/tpl/setting/settings_debug.php:
|
2479 |
msgid "Exclude Filters"
|
2480 |
msgstr ""
|
2481 |
|
2482 |
-
#: admin/tpl/setting/settings_debug.php:
|
2483 |
msgid "Listed filters (one per line) will not be logged."
|
2484 |
msgstr ""
|
2485 |
|
2486 |
-
#: admin/tpl/setting/settings_debug.php:
|
2487 |
-
#: admin/tpl/setting/settings_debug.php:
|
2488 |
msgid "Recommended default value"
|
2489 |
msgstr ""
|
2490 |
|
2491 |
-
#: admin/tpl/setting/settings_debug.php:
|
2492 |
msgid "Exclude Part Filters"
|
2493 |
msgstr ""
|
2494 |
|
2495 |
-
#: admin/tpl/setting/settings_debug.php:
|
2496 |
msgid "Filters containing these strings (one per line) will not be logged."
|
2497 |
msgstr ""
|
2498 |
|
2 |
# This file is distributed under the same license as the LiteSpeed Cache package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: LiteSpeed Cache 2.6.4.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
|
7 |
+
"POT-Creation-Date: 2018-11-01 21:26:55+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
603 |
|
604 |
#: admin/tpl/crawler.php:92 admin/tpl/inc/check_cache_disabled.php:38
|
605 |
#: admin/tpl/inc/img_optm.summary.php:210 admin/tpl/manage/manage_cdn.php:15
|
606 |
+
#: admin/tpl/setting/settings_debug.php:107
|
607 |
+
#: admin/tpl/setting/settings_debug.php:140
|
608 |
#: admin/tpl/setting/settings_media.php:182
|
609 |
#: admin/tpl/setting/settings_optimize.php:15 admin/tpl/settings.php:185
|
610 |
msgid "WARNING"
|
874 |
msgid "Rate %s on %s"
|
875 |
msgstr ""
|
876 |
|
877 |
+
#. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.6.4.1) #-#-#-#-#
|
878 |
#. Plugin Name of the plugin/theme
|
879 |
#: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:353
|
880 |
#: includes/litespeed-cache-gui.class.php:353
|
1753 |
msgid "Media"
|
1754 |
msgstr ""
|
1755 |
|
1756 |
+
#: admin/tpl/network_settings.php:10 admin/tpl/setting/settings_debug.php:80
|
1757 |
#: admin/tpl/settings.php:14
|
1758 |
msgid "Advanced"
|
1759 |
msgstr ""
|
2402 |
msgstr ""
|
2403 |
|
2404 |
#: admin/tpl/setting/settings_debug.php:59
|
2405 |
+
msgid "Your IP"
|
2406 |
+
msgstr ""
|
2407 |
+
|
2408 |
+
#: admin/tpl/setting/settings_debug.php:61
|
2409 |
msgid ""
|
2410 |
"More information about the available commands can be found <a %s>here</a>."
|
2411 |
msgstr ""
|
2412 |
|
2413 |
+
#: admin/tpl/setting/settings_debug.php:68
|
2414 |
msgid "Debug Level"
|
2415 |
msgstr ""
|
2416 |
|
2417 |
+
#: admin/tpl/setting/settings_debug.php:74
|
2418 |
msgid "Basic"
|
2419 |
msgstr ""
|
2420 |
|
2421 |
+
#: admin/tpl/setting/settings_debug.php:84
|
2422 |
msgid "Advanced level will log more details."
|
2423 |
msgstr ""
|
2424 |
|
2425 |
+
#: admin/tpl/setting/settings_debug.php:90
|
2426 |
msgid "Log File Size Limit"
|
2427 |
msgstr ""
|
2428 |
|
2429 |
+
#: admin/tpl/setting/settings_debug.php:93
|
2430 |
#: admin/tpl/setting/settings_tuning.php:88
|
2431 |
msgid "MB"
|
2432 |
msgstr ""
|
2433 |
|
2434 |
+
#: admin/tpl/setting/settings_debug.php:95
|
2435 |
msgid ""
|
2436 |
"Specify the maximum size of the log file. Minimum is 3MB. Maximum is 3000MB."
|
2437 |
msgstr ""
|
2438 |
|
2439 |
+
#: admin/tpl/setting/settings_debug.php:102
|
2440 |
msgid "Heartbeat"
|
2441 |
msgstr ""
|
2442 |
|
2443 |
+
#: admin/tpl/setting/settings_debug.php:106
|
2444 |
msgid ""
|
2445 |
"Disable WordPress heartbeat to prevent AJAX calls from breaking debug "
|
2446 |
"logging."
|
2447 |
msgstr ""
|
2448 |
|
2449 |
+
#: admin/tpl/setting/settings_debug.php:108
|
2450 |
msgid ""
|
2451 |
"Disabling this may cause WordPress tasks triggered by AJAX to stop working."
|
2452 |
msgstr ""
|
2453 |
|
2454 |
+
#: admin/tpl/setting/settings_debug.php:115
|
2455 |
msgid "Log Cookies"
|
2456 |
msgstr ""
|
2457 |
|
2458 |
+
#: admin/tpl/setting/settings_debug.php:119
|
2459 |
msgid "Log request cookie values."
|
2460 |
msgstr ""
|
2461 |
|
2462 |
+
#: admin/tpl/setting/settings_debug.php:125
|
2463 |
msgid "Collapse Query Strings"
|
2464 |
msgstr ""
|
2465 |
|
2466 |
+
#: admin/tpl/setting/settings_debug.php:129
|
2467 |
msgid "Shorten query strings in the debug log to improve readability."
|
2468 |
msgstr ""
|
2469 |
|
2470 |
+
#: admin/tpl/setting/settings_debug.php:135
|
2471 |
msgid "Log Filters"
|
2472 |
msgstr ""
|
2473 |
|
2474 |
+
#: admin/tpl/setting/settings_debug.php:139
|
2475 |
msgid "Log all WordPress filter hooks."
|
2476 |
msgstr ""
|
2477 |
|
2478 |
+
#: admin/tpl/setting/settings_debug.php:141
|
2479 |
msgid "Enabling this option will cause log file size to grow quickly."
|
2480 |
msgstr ""
|
2481 |
|
2482 |
+
#: admin/tpl/setting/settings_debug.php:148
|
2483 |
msgid "Exclude Filters"
|
2484 |
msgstr ""
|
2485 |
|
2486 |
+
#: admin/tpl/setting/settings_debug.php:152
|
2487 |
msgid "Listed filters (one per line) will not be logged."
|
2488 |
msgstr ""
|
2489 |
|
2490 |
+
#: admin/tpl/setting/settings_debug.php:153
|
2491 |
+
#: admin/tpl/setting/settings_debug.php:164
|
2492 |
msgid "Recommended default value"
|
2493 |
msgstr ""
|
2494 |
|
2495 |
+
#: admin/tpl/setting/settings_debug.php:159
|
2496 |
msgid "Exclude Part Filters"
|
2497 |
msgstr ""
|
2498 |
|
2499 |
+
#: admin/tpl/setting/settings_debug.php:163
|
2500 |
msgid "Filters containing these strings (one per line) will not be logged."
|
2501 |
msgstr ""
|
2502 |
|
litespeed-cache.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: LiteSpeed Cache
|
16 |
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
|
17 |
* Description: High-performance page caching and site optimization from LiteSpeed
|
18 |
-
* Version: 2.
|
19 |
* Author: LiteSpeed Technologies
|
20 |
* Author URI: https://www.litespeedtech.com
|
21 |
* License: GPLv3
|
15 |
* Plugin Name: LiteSpeed Cache
|
16 |
* Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
|
17 |
* Description: High-performance page caching and site optimization from LiteSpeed
|
18 |
+
* Version: 2.7
|
19 |
* Author: LiteSpeed Technologies
|
20 |
* Author URI: https://www.litespeedtech.com
|
21 |
* License: GPLv3
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
|
|
3 |
Tags: caching, optimize, performance, pagespeed, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.8
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
@@ -248,6 +248,7 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
|
|
248 |
|
249 |
= What are the known compatible plugins and themes? =
|
250 |
|
|
|
251 |
* [bbPress](https://wordpress.org/plugins/bbpress/)
|
252 |
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
|
253 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
|
@@ -275,9 +276,17 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
|
|
275 |
|
276 |
== Changelog ==
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
= 2.6.4.1 - Oct 25 2018 =
|
279 |
* 🔥🐞<strong>Media</strong>: Fixed a bug where the wrong table was used in the Image Optimization process.
|
280 |
-
*
|
281 |
|
282 |
= 2.6.4 - Oct 24 2018 =
|
283 |
* 🌱: Ability to create custom default config options per hosting company.
|
3 |
Tags: caching, optimize, performance, pagespeed, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.9.8
|
6 |
+
Stable tag: 2.7
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
248 |
|
249 |
= What are the known compatible plugins and themes? =
|
250 |
|
251 |
+
* [WPML](https://wpml.org/)
|
252 |
* [bbPress](https://wordpress.org/plugins/bbpress/)
|
253 |
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
|
254 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
|
276 |
|
277 |
== Changelog ==
|
278 |
|
279 |
+
= 2.7 - Nov 2 2018 =
|
280 |
+
* 🌱: Separate Purge log for better debugging.
|
281 |
+
* <strong>3rd</strong>: Now fully compatible with WPML.
|
282 |
+
* <strong>IAPI</strong>: Sped up Image Optimization workflow.
|
283 |
+
* <strong>GUI</strong>: Current IP now shows in Debug settings.
|
284 |
+
* <strong>GUI</strong>: Space separated placeholder queue list for better look.
|
285 |
+
* <strong>EU3 server IP Changed to 165.227.131.98</strong>.
|
286 |
+
|
287 |
= 2.6.4.1 - Oct 25 2018 =
|
288 |
* 🔥🐞<strong>Media</strong>: Fixed a bug where the wrong table was used in the Image Optimization process.
|
289 |
+
* <strong>IAPI</strong>: IAPI v2.6.4.1.
|
290 |
|
291 |
= 2.6.4 - Oct 24 2018 =
|
292 |
* 🌱: Ability to create custom default config options per hosting company.
|