LiteSpeed Cache - Version 5.2.1

Version Description

  • Sep 7 2022 =
  • Core Fixed a fatal error that occurred when uninstalling. (#894556 Hostinger)
  • Dash Show partner info on the dashboard for partner-tier QC accounts.
  • UCSS Auto-purge UCSS on post update. (Ankit)
  • Crawler Respect the LITESPEED_CRAWLER_DISABLE_BLOCKLIST constant for unexpected results too. (Abe)
Download this release

Release Info

Developer LiteSpeedTech
Plugin Icon 128x128 LiteSpeed Cache
Version 5.2.1
Comparing to
See all releases

Code changes from version 5.2 to 5.2.1

assets/css/litespeed.css CHANGED
@@ -2677,6 +2677,33 @@ g.litespeed-pie_info .litespeed-pie-done {
2677
  margin-bottom: -0.55em !important;
2678
  }
2679
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2680
  .litespeed-dashboard-group .litespeed-postbox {
2681
  width: calc(25% - 20px);
2682
  display: flex;
2677
  margin-bottom: -0.55em !important;
2678
  }
2679
 
2680
+ .litespeed-postbox.litespeed-postbox-partner .inside {
2681
+ margin: 11px 0;
2682
+ }
2683
+
2684
+ .litespeed-dashboard-stats-wrapper .litespeed-postbox.litespeed-postbox-partner h3.litespeed-title {
2685
+ color: #777;
2686
+ font-weight: normal;
2687
+ font-size: 13px;
2688
+ }
2689
+
2690
+ .litespeed-postbox.litespeed-postbox-partner a {
2691
+ font-size: 1.35rem;
2692
+ font-weight: bold;
2693
+ text-decoration: none;
2694
+ margin-top: 5px;
2695
+ max-width: 100%;
2696
+ display: inline-block;
2697
+ }
2698
+
2699
+ .litespeed-postbox.litespeed-postbox-partner a:hover {
2700
+ text-decoration: underline;
2701
+ }
2702
+
2703
+ .litespeed-postbox.litespeed-postbox-partner img {
2704
+ max-width: 12rem;
2705
+ }
2706
+
2707
  .litespeed-dashboard-group .litespeed-postbox {
2708
  width: calc(25% - 20px);
2709
  display: flex;
litespeed-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: LiteSpeed Cache
4
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
5
  * Description: High-performance page caching and site optimization from LiteSpeed
6
- * Version: 5.2
7
  * Author: LiteSpeed Technologies
8
  * Author URI: https://www.litespeedtech.com
9
  * License: GPLv3
@@ -33,7 +33,7 @@ if ( defined( 'LSCWP_V' ) ) {
33
  return;
34
  }
35
 
36
- ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '5.2' );
37
 
38
  ! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
39
  ! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
3
  * Plugin Name: LiteSpeed Cache
4
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
5
  * Description: High-performance page caching and site optimization from LiteSpeed
6
+ * Version: 5.2.1
7
  * Author: LiteSpeed Technologies
8
  * Author URI: https://www.litespeedtech.com
9
  * License: GPLv3
33
  return;
34
  }
35
 
36
+ ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '5.2.1' );
37
 
38
  ! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
39
  ! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: LiteSpeedTech
3
  Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
- Tested up to: 6.0.1
6
- Stable tag: 5.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -250,6 +250,12 @@ The vast majority of plugins and themes are compatible with LiteSpeed Cache. The
250
 
251
  == Changelog ==
252
 
 
 
 
 
 
 
253
  = 5.2 - Aug 17 2022 =
254
  * 🌱**UCSS** Added UCSS message queue to improve service quality and reliability
255
  * 🐞**VPI** Fixed conflict w/ image lazyload; used HTML before image lazyload to avoid invalid `data:base64` results.
2
  Contributors: LiteSpeedTech
3
  Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
+ Tested up to: 6.0.2
6
+ Stable tag: 5.2.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
250
 
251
  == Changelog ==
252
 
253
+ = 5.2.1 - Sep 7 2022 =
254
+ * 🐞**Core** Fixed a fatal error that occurred when uninstalling. (#894556 Hostinger)
255
+ * **Dash** Show partner info on the dashboard for partner-tier QC accounts.
256
+ * **UCSS** Auto-purge UCSS on post update. (Ankit)
257
+ * 🕸️**Crawler** Respect the `LITESPEED_CRAWLER_DISABLE_BLOCKLIST` constant for unexpected results too. (Abe)
258
+
259
  = 5.2 - Aug 17 2022 =
260
  * 🌱**UCSS** Added UCSS message queue to improve service quality and reliability
261
  * 🐞**VPI** Fixed conflict w/ image lazyload; used HTML before image lazyload to avoid invalid `data:base64` results.
src/cloud.cls.php CHANGED
@@ -803,7 +803,7 @@ class Cloud extends Base {
803
  if ( ! empty( $json[ '_carry_on' ] ) ) {
804
  self::debug( 'Carry_on usage', $json[ '_carry_on' ] );
805
  // Store generic info
806
- foreach ( array( 'usage', 'promo', '_err', '_info', '_note', '_success' ) as $v ) {
807
  if ( ! empty( $json[ '_carry_on' ][ $v ] ) ) {
808
  switch ( $v ) {
809
  case 'usage':
@@ -818,6 +818,10 @@ class Cloud extends Base {
818
  $this->_summary[ $v ][] = $json[ '_carry_on' ][ $v ];
819
  break;
820
 
 
 
 
 
821
  case '_error':
822
  case '_info':
823
  case '_note':
803
  if ( ! empty( $json[ '_carry_on' ] ) ) {
804
  self::debug( 'Carry_on usage', $json[ '_carry_on' ] );
805
  // Store generic info
806
+ foreach ( array( 'usage', 'promo', 'partner', '_err', '_info', '_note', '_success' ) as $v ) {
807
  if ( ! empty( $json[ '_carry_on' ][ $v ] ) ) {
808
  switch ( $v ) {
809
  case 'usage':
818
  $this->_summary[ $v ][] = $json[ '_carry_on' ][ $v ];
819
  break;
820
 
821
+ case 'partner':
822
+ $this->_summary[ $v ] = $json[ '_carry_on' ][ $v ];
823
+ break;
824
+
825
  case '_error':
826
  case '_info':
827
  case '_note':
src/control.cls.php CHANGED
@@ -607,7 +607,7 @@ class Control extends Root {
607
  }
608
 
609
  // Check if has metabox non-cacheable setting or not
610
- if ( $this->cls( 'Metabox' )->setting( 'litespeed_no_cache' ) ) {
611
  self::set_nocache( 'per post metabox setting' );
612
  return;
613
  }
607
  }
608
 
609
  // Check if has metabox non-cacheable setting or not
610
+ if ( file_exists( LSCWP_DIR . 'src/metabox.cls.php' ) && $this->cls( 'Metabox' )->setting( 'litespeed_no_cache' ) ) {
611
  self::set_nocache( 'per post metabox setting' );
612
  return;
613
  }
src/crawler.cls.php CHANGED
@@ -593,6 +593,7 @@ class Crawler extends Root {
593
  * @access private
594
  */
595
  private function _multi_request( $rows, $options ) {
 
596
  $mh = curl_multi_init();
597
  $curls = array();
598
  foreach ( $rows as $row ) {
@@ -602,6 +603,9 @@ class Crawler extends Root {
602
  if ( substr( $row[ 'res' ], $this->_summary[ 'curr_crawler' ], 1 ) == 'N' ) {
603
  continue;
604
  }
 
 
 
605
  $curls[ $row[ 'id' ] ] = curl_init();
606
 
607
  // Append URL
@@ -698,6 +702,11 @@ class Crawler extends Root {
698
  }
699
  }
700
 
 
 
 
 
 
701
  return 'B'; // Blacklist
702
  }
703
 
593
  * @access private
594
  */
595
  private function _multi_request( $rows, $options ) {
596
+ if (!function_exists('curl_multi_init')) exit('curl_multi_init disabled');
597
  $mh = curl_multi_init();
598
  $curls = array();
599
  foreach ( $rows as $row ) {
603
  if ( substr( $row[ 'res' ], $this->_summary[ 'curr_crawler' ], 1 ) == 'N' ) {
604
  continue;
605
  }
606
+
607
+ if (!function_exists('curl_init')) exit('curl_init disabled');
608
+
609
  $curls[ $row[ 'id' ] ] = curl_init();
610
 
611
  // Append URL
702
  }
703
  }
704
 
705
+ // If blacklist is disabled
706
+ if ( ( defined( 'LITESPEED_CRAWLER_DISABLE_BLOCKLIST' ) && LITESPEED_CRAWLER_DISABLE_BLOCKLIST ) || apply_filters( 'litespeed_crawler_disable_blocklist', '__return_false', $url ) ) {
707
+ return 'M';
708
+ }
709
+
710
  return 'B'; // Blacklist
711
  }
712
 
src/css.cls.php CHANGED
@@ -306,7 +306,7 @@ class CSS extends Base {
306
  // Old version compatibility
307
  if ( empty( $json[ 'status' ] ) ) {
308
  if ( ! empty( $json[ $type ] ) ) {
309
- $this->_save_con( $type, $json[ $type ], $queue_k );
310
  }
311
 
312
  // Delete the row
@@ -332,7 +332,7 @@ class CSS extends Base {
332
  *
333
  * @since 4.2
334
  */
335
- private function _save_con( $type, $css, $queue_k ) {
336
  // Add filters
337
  $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
338
  Debug2::debug2( '[CSS] con: ' . $css );
@@ -354,7 +354,7 @@ class CSS extends Base {
354
  $vary = $this->_queue[ $queue_k ][ 'vary' ];
355
  Debug2::debug2( "[CSS] Save URL to file [file] $static_file [vary] $vary" );
356
 
357
- $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ) );
358
 
359
  Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
360
  }
306
  // Old version compatibility
307
  if ( empty( $json[ 'status' ] ) ) {
308
  if ( ! empty( $json[ $type ] ) ) {
309
+ $this->_save_con( $type, $json[ $type ], $queue_k, $is_mobile, $is_webp );
310
  }
311
 
312
  // Delete the row
332
  *
333
  * @since 4.2
334
  */
335
+ private function _save_con( $type, $css, $queue_k, $mobile, $webp ) {
336
  // Add filters
337
  $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
338
  Debug2::debug2( '[CSS] con: ' . $css );
354
  $vary = $this->_queue[ $queue_k ][ 'vary' ];
355
  Debug2::debug2( "[CSS] Save URL to file [file] $static_file [vary] $vary" );
356
 
357
+ $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ), $mobile, $webp );
358
 
359
  Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
360
  }
src/data.cls.php CHANGED
@@ -29,6 +29,9 @@ class Data extends Root {
29
  '4.4.4-b1' => array(
30
  'litespeed_update_4_4_4',
31
  ),
 
 
 
32
  );
33
 
34
  private $_db_site_updater = array(
@@ -452,7 +455,7 @@ class Data extends Root {
452
  * Generate filename based on URL, if content md5 existed, reuse existing file.
453
  * @since 4.0
454
  */
455
- public function save_url( $request_url, $vary, $file_type, $filecon_md5, $path ) {
456
  global $wpdb;
457
 
458
  if ( strlen( $vary ) > 32 ) {
@@ -495,8 +498,8 @@ class Data extends Root {
495
  }
496
 
497
  // New record needed
498
- $q = "INSERT INTO `$tb_url_file` SET url_id=%d, vary=%s, filename=%s, type=%d, expired = 0";
499
- $wpdb->query( $wpdb->prepare( $q, array( $url_id, $vary, $filecon_md5, $type ) ) );
500
 
501
  // Mark existing rows as expired
502
  if ( $file_row ) {
@@ -568,7 +571,7 @@ class Data extends Root {
568
  * Mark all entries of one URL to expired
569
  * @since 4.5
570
  */
571
- public function mark_as_expired( $request_url ) {
572
  global $wpdb;
573
 
574
  Debug2::debug( '[Data] Try to mark as expired: ' . $request_url );
@@ -581,10 +584,20 @@ class Data extends Root {
581
 
582
  Debug2::debug( '[Data] Mark url_id=' . $url_row[ 'id' ] . ' as expired' );
583
 
 
584
  $tb_url_file = $this->tb( 'url_file' );
 
 
 
 
 
 
 
585
  $q = "UPDATE `$tb_url_file` SET expired=%d WHERE url_id=%d AND type=4 AND expired=0";
586
  $expired = time() + 86400 * apply_filters( 'litespeed_url_file_expired_days', 20 );
587
  $wpdb->query( $wpdb->prepare( $q, array( $expired, $url_row[ 'id' ] ) ) );
 
 
588
  }
589
 
590
  /**
29
  '4.4.4-b1' => array(
30
  'litespeed_update_4_4_4',
31
  ),
32
+ '5.3-a5' => array(
33
+ 'litespeed_update_5_3',
34
+ ),
35
  );
36
 
37
  private $_db_site_updater = array(
455
  * Generate filename based on URL, if content md5 existed, reuse existing file.
456
  * @since 4.0
457
  */
458
+ public function save_url( $request_url, $vary, $file_type, $filecon_md5, $path, $mobile = false, $webp = false ) {
459
  global $wpdb;
460
 
461
  if ( strlen( $vary ) > 32 ) {
498
  }
499
 
500
  // New record needed
501
+ $q = "INSERT INTO `$tb_url_file` SET url_id=%d, vary=%s, filename=%s, type=%d, mobile=%d, webp=%d, expired=0";
502
+ $wpdb->query( $wpdb->prepare( $q, array( $url_id, $vary, $filecon_md5, $type, $mobile?1:0, $webp?1:0 ) ) );
503
 
504
  // Mark existing rows as expired
505
  if ( $file_row ) {
571
  * Mark all entries of one URL to expired
572
  * @since 4.5
573
  */
574
+ public function mark_as_expired( $request_url, $auto_q = false ) {
575
  global $wpdb;
576
 
577
  Debug2::debug( '[Data] Try to mark as expired: ' . $request_url );
584
 
585
  Debug2::debug( '[Data] Mark url_id=' . $url_row[ 'id' ] . ' as expired' );
586
 
587
+ $tb_url = $this->tb( 'url' );
588
  $tb_url_file = $this->tb( 'url_file' );
589
+
590
+ $existing_url_files = array();
591
+ if ( $auto_q ) {
592
+ $q = "SELECT a.*, b.url FROM `$tb_url_file` a LEFT JOIN `$tb_url` b ON b.id=a.url_id WHERE a.url_id=%d AND a.type=4 AND a.expired=0";
593
+ $q = $wpdb->prepare( $q, $url_row[ 'id' ] );
594
+ $existing_url_files = $wpdb->get_results( $q, ARRAY_A );
595
+ }
596
  $q = "UPDATE `$tb_url_file` SET expired=%d WHERE url_id=%d AND type=4 AND expired=0";
597
  $expired = time() + 86400 * apply_filters( 'litespeed_url_file_expired_days', 20 );
598
  $wpdb->query( $wpdb->prepare( $q, array( $expired, $url_row[ 'id' ] ) ) );
599
+
600
+ return $existing_url_files;
601
  }
602
 
603
  /**
src/data.upgrade.func.php CHANGED
@@ -13,6 +13,23 @@ use LiteSpeed\Conf;
13
  use LiteSpeed\Admin_Display;
14
  use LiteSpeed\File;
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * Add expired to url_file table
18
  * @since 4.4.4
13
  use LiteSpeed\Admin_Display;
14
  use LiteSpeed\File;
15
 
16
+ /**
17
+ * Append webp/mobile to url_file
18
+ * @since 5.3
19
+ */
20
+ function litespeed_update_5_3() {
21
+ global $wpdb;
22
+ Debug2::debug( "[Data] Upgrade url_file table" );
23
+ $tb_exists = $wpdb->get_var( 'SHOW TABLES LIKE "' . $wpdb->prefix . 'litespeed_url_file"' );
24
+ if ( $tb_exists ) {
25
+ $q = 'ALTER TABLE `' . $wpdb->prefix . 'litespeed_url_file`
26
+ ADD COLUMN `mobile` tinyint(4) NOT NULL COMMENT "mobile=1",
27
+ ADD COLUMN `webp` tinyint(4) NOT NULL COMMENT "webp=1"
28
+ ';
29
+ $wpdb->query( $q );
30
+ }
31
+ }
32
+
33
  /**
34
  * Add expired to url_file table
35
  * @since 4.4.4
src/data_structure/url_file.sql CHANGED
@@ -3,6 +3,8 @@
3
  `vary` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'md5 of final vary',
4
  `filename` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'md5 of file content',
5
  `type` tinyint(4) NOT NULL COMMENT 'css=1,js=2,ccss=3,ucss=4',
 
 
6
  `expired` int(11) NOT NULL DEFAULT 0,
7
  PRIMARY KEY (`id`),
8
  KEY `filename` (`filename`),
3
  `vary` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'md5 of final vary',
4
  `filename` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'md5 of file content',
5
  `type` tinyint(4) NOT NULL COMMENT 'css=1,js=2,ccss=3,ucss=4',
6
+ `mobile` tinyint(4) NOT NULL COMMENT 'mobile=1',
7
+ `webp` tinyint(4) NOT NULL COMMENT 'webp=1',
8
  `expired` int(11) NOT NULL DEFAULT 0,
9
  PRIMARY KEY (`id`),
10
  KEY `filename` (`filename`),
src/img-optm.cls.php CHANGED
@@ -152,6 +152,8 @@ class Img_Optm extends Base {
152
  }
153
 
154
  foreach ( $list as $v ) {
 
 
155
  $meta_value = $this->_parse_wp_meta_value( $v );
156
  if ( ! $meta_value ) {
157
  $this->_save_err_meta( $v->post_id );
152
  }
153
 
154
  foreach ( $list as $v ) {
155
+ if ( ! $v->post_id ) continue;
156
+
157
  $meta_value = $this->_parse_wp_meta_value( $v );
158
  if ( ! $meta_value ) {
159
  $this->_save_err_meta( $v->post_id );
src/purge.cls.php CHANGED
@@ -66,6 +66,7 @@ class Purge extends Base {
66
 
67
  add_action( 'wp_update_comment_count', array( $this, 'purge_feeds' ) );
68
 
 
69
  }
70
 
71
  /**
@@ -270,7 +271,11 @@ class Purge extends Base {
270
  }
271
  $post_id_or_url = untrailingslashit( $post_id_or_url );
272
 
273
- Data::cls()->mark_as_expired( $post_id_or_url );
 
 
 
 
274
  }
275
 
276
  /**
66
 
67
  add_action( 'wp_update_comment_count', array( $this, 'purge_feeds' ) );
68
 
69
+ if ($this->conf(self::O_OPTM_UCSS)) add_action('edit_post', __NAMESPACE__ . '\Purge::purge_ucss');
70
  }
71
 
72
  /**
271
  }
272
  $post_id_or_url = untrailingslashit( $post_id_or_url );
273
 
274
+ $existing_url_files = Data::cls()->mark_as_expired( $post_id_or_url, true );
275
+ if ( $existing_url_files ) {
276
+ // Add to UCSS Q
277
+ self::cls( 'UCSS' )->add_to_q($existing_url_files);
278
+ }
279
  }
280
 
281
  /**
src/ucss.cls.php CHANGED
@@ -86,7 +86,7 @@ class UCSS extends Base {
86
 
87
  $uid = get_current_user_id();
88
 
89
- $ua = ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : '';
90
 
91
  // Store it for cron
92
  $this->_queue = $this->load_queue( 'ucss' );
@@ -115,6 +115,58 @@ class UCSS extends Base {
115
  return false;
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  /**
119
  * Generate UCSS
120
  *
@@ -267,7 +319,7 @@ class UCSS extends Base {
267
  // Old version compatibility
268
  if ( empty( $json[ 'status' ] ) ) {
269
  if ( ! empty( $json[ 'ucss' ] ) ) {
270
- $this->_save_con( 'ucss', $json[ 'ucss' ], $queue_k );
271
  }
272
 
273
  // Delete the row
@@ -293,7 +345,7 @@ class UCSS extends Base {
293
  *
294
  * @since 4.2
295
  */
296
- private function _save_con( $type, $css, $queue_k ) {
297
  // Add filters
298
  $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
299
  self::debug2( 'con: ', $css );
@@ -315,7 +367,7 @@ class UCSS extends Base {
315
  $vary = $this->_queue[ $queue_k ][ 'vary' ];
316
  self::debug2( "Save URL to file [file] $static_file [vary] $vary" );
317
 
318
- $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ) );
319
 
320
  Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
321
  }
@@ -475,7 +527,9 @@ class UCSS extends Base {
475
 
476
  // Save data
477
  if ( ! empty( $v[ 'data_ucss' ] ) ) {
478
- $this->_save_con( 'ucss', $v[ 'data_ucss' ], $v[ 'queue_k' ] );
 
 
479
 
480
  $valid_i ++;
481
  }
86
 
87
  $uid = get_current_user_id();
88
 
89
+ $ua = $this->_get_ua();
90
 
91
  // Store it for cron
92
  $this->_queue = $this->load_queue( 'ucss' );
115
  return false;
116
  }
117
 
118
+ /**
119
+ * Get User Agent
120
+ *
121
+ * @since 5.3
122
+ */
123
+ private function _get_ua() {
124
+ return ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : '';
125
+ }
126
+
127
+ /**
128
+ * Add rows to q
129
+ *
130
+ * @since 5.3
131
+ */
132
+ public function add_to_q($url_files) {
133
+ return; // will enable in v5.4
134
+ // Store it for cron
135
+ $this->_queue = $this->load_queue( 'ucss' );
136
+
137
+ if ( count( $this->_queue ) > 500 ) {
138
+ self::debug( 'UCSS Queue is full - 500' );
139
+ return false;
140
+ }
141
+
142
+ $ua = $this->_get_ua();
143
+ foreach ( $url_files as $url_file ) {
144
+ $vary = $url_file[ 'vary' ];
145
+ $request_url = $url_file[ 'url' ];
146
+ $is_mobile = $url_file[ 'is_mobile' ];
147
+ $is_webp = $url_file[ 'is_webp' ];
148
+ $request_url = $url_file[ 'url' ];
149
+ $url_tag = self::get_url_tag( $request_url );
150
+
151
+ $queue_k = ( strlen( $vary ) > 32 ? md5( $vary ) : $vary ) . ' ' . $url_tag;
152
+ $q = array(
153
+ 'url' => apply_filters( 'litespeed_ucss_url', $request_url ),
154
+ 'user_agent' => substr( $ua, 0, 200 ),
155
+ 'is_mobile' => $is_mobile,
156
+ 'is_webp' => $is_webp,
157
+ 'uid' => false,
158
+ 'vary' => $vary,
159
+ 'url_tag' => $url_tag,
160
+ ); // Current UA will be used to request
161
+
162
+ $this->_queue[ $queue_k ] = $q;
163
+ }
164
+ $this->save_queue( 'ucss', $this->_queue );
165
+ self::debug( 'Added queue_ucss [url_tag] ' . $url_tag . ' [UA] ' . $ua . ' [vary] ' . $vary . ' [uid] false' );
166
+
167
+
168
+ }
169
+
170
  /**
171
  * Generate UCSS
172
  *
319
  // Old version compatibility
320
  if ( empty( $json[ 'status' ] ) ) {
321
  if ( ! empty( $json[ 'ucss' ] ) ) {
322
+ $this->_save_con( 'ucss', $json[ 'ucss' ], $queue_k, $is_mobile, $is_webp );
323
  }
324
 
325
  // Delete the row
345
  *
346
  * @since 4.2
347
  */
348
+ private function _save_con( $type, $css, $queue_k, $is_mobile, $is_webp ) {
349
  // Add filters
350
  $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
351
  self::debug2( 'con: ', $css );
367
  $vary = $this->_queue[ $queue_k ][ 'vary' ];
368
  self::debug2( "Save URL to file [file] $static_file [vary] $vary" );
369
 
370
+ $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ), $is_mobile, $is_webp );
371
 
372
  Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
373
  }
527
 
528
  // Save data
529
  if ( ! empty( $v[ 'data_ucss' ] ) ) {
530
+ $is_mobile = $this->_queue[ $v[ 'queue_k' ] ][ 'is_mobile' ];
531
+ $is_webp = $this->_queue[ $v[ 'queue_k' ] ][ 'is_webp' ];
532
+ $this->_save_con( 'ucss', $v[ 'data_ucss' ], $v[ 'queue_k' ], $is_mobile, $is_webp );
533
 
534
  $valid_i ++;
535
  }
tpl/dash/dashboard.tpl.php CHANGED
@@ -164,6 +164,31 @@ $vpi_queue_count = count( $this->load_queue( 'vpi' ) );
164
  </div>
165
  </div>
166
  <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  </div>
168
 
169
  <p class="litespeed-right litespeed-qc-dashboard-link"><a href="<?php echo Cloud::CLOUD_SERVER_DASH; ?>" class="litespeed-link-with-icon" target="_blank"><?php echo __( 'Go to QUIC.cloud dashboard', 'litespeed-cache' ) ;?> <span class="dashicons dashicons-external"></span></a></p>
164
  </div>
165
  </div>
166
  <?php endforeach; ?>
167
+
168
+ <?php if (!empty($cloud_summary['partner'])) : ?>
169
+ <div class="litespeed-postbox litespeed-postbox-partner">
170
+ <div class="inside">
171
+ <h3 class="litespeed-title"><?php echo __('Partner Benefits Provided by','litespeed-cache') ; ?></h3>
172
+ <div>
173
+
174
+ <?php if ($cloud_summary['partner']['logo']): ?>
175
+ <?php if ($cloud_summary['partner']['url']): ?>
176
+ <a href="<?php echo $cloud_summary['partner']['url']; ?>" target="_blank"><img src="<?php echo $cloud_summary['partner']['logo']; ?>" alt="<?php echo $cloud_summary['partner']['name']; ?>"></a>
177
+ <?php else: ?>
178
+ <img src="<?php echo $cloud_summary['partner']['logo']; ?>" alt="<?php echo $cloud_summary['partner']['name']; ?>">
179
+ <?php endif; ?>
180
+ <?php elseif ($cloud_summary['partner']['name']): ?>
181
+ <?php if ($cloud_summary['partner']['url']): ?>
182
+ <a href="<?php echo $cloud_summary['partner']['url']; ?>" target="_blank"><span class="postbox-partner-name"><?php echo $cloud_summary['partner']['name']; ?></span></a>
183
+ <?php else: ?>
184
+ <span class="postbox-partner-name"><?php echo $cloud_summary['partner']['name']; ?></span>
185
+ <?php endif; ?>
186
+ <?php endif; ?>
187
+
188
+ </div>
189
+ </div>
190
+ </div>
191
+ <?php endif; ?>
192
  </div>
193
 
194
  <p class="litespeed-right litespeed-qc-dashboard-link"><a href="<?php echo Cloud::CLOUD_SERVER_DASH; ?>" class="litespeed-link-with-icon" target="_blank"><?php echo __( 'Go to QUIC.cloud dashboard', 'litespeed-cache' ) ;?> <span class="dashicons dashicons-external"></span></a></p>
tpl/toolbox/beta_test.tpl.php CHANGED
@@ -4,6 +4,7 @@ defined( 'WPINC' ) || exit;
4
 
5
  // Existing public version list
6
  $v_list = array(
 
7
  '5.2',
8
  '5.1',
9
  '4.6',
4
 
5
  // Existing public version list
6
  $v_list = array(
7
+ '5.2.1',
8
  '5.2',
9
  '5.1',
10
  '4.6',