Plugin Directory

Changeset 2781559


Ignore:
Timestamp:
09/07/2022 06:33:18 PM (3 years ago)
Author:
LiteSpeedTech
Message:

Release v5.2.1

Location:
litespeed-cache
Files:
311 added
15 edited

Legend:

Unmodified
Added
Removed
  • litespeed-cache/trunk/assets/css/litespeed.css

    r2764804 r2781559  
    26762676    margin-right: -20px;
    26772677    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;
    26782705}
    26792706
  • litespeed-cache/trunk/litespeed-cache.php

    r2771786 r2781559  
    44 * Plugin URI:        https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
    55 * Description:       High-performance page caching and site optimization from LiteSpeed
    6  * Version:           5.2
     6 * Version:           5.2.1
    77 * Author:            LiteSpeed Technologies
    88 * Author URI:        https://www.litespeedtech.com
     
    3434}
    3535
    36 ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '5.2' );
     36! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '5.2.1' );
    3737
    3838! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
  • litespeed-cache/trunk/readme.txt

    r2771794 r2781559  
    33Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
    44Requires at least: 4.0
    5 Tested up to: 6.0.1
    6 Stable tag: 5.2
     5Tested up to: 6.0.2
     6Stable tag: 5.2.1
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl.html
     
    250250
    251251== 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)
    252258
    253259= 5.2 - Aug 17 2022 =
  • litespeed-cache/trunk/src/cloud.cls.php

    r2771786 r2781559  
    804804            self::debug( 'Carry_on usage', $json[ '_carry_on' ] );
    805805            // Store generic info
    806             foreach ( array( 'usage', 'promo', '_err', '_info', '_note', '_success' ) as $v ) {
     806            foreach ( array( 'usage', 'promo', 'partner', '_err', '_info', '_note', '_success' ) as $v ) {
    807807                if ( ! empty( $json[ '_carry_on' ][ $v ] ) ) {
    808808                    switch ( $v ) {
     
    817817                            }
    818818                            $this->_summary[ $v ][] = $json[ '_carry_on' ][ $v ];
     819                            break;
     820
     821                        case 'partner':
     822                            $this->_summary[ $v ] = $json[ '_carry_on' ][ $v ];
    819823                            break;
    820824
  • litespeed-cache/trunk/src/control.cls.php

    r2761310 r2781559  
    608608
    609609        // Check if has metabox non-cacheable setting or not
    610         if ( $this->cls( 'Metabox' )->setting( 'litespeed_no_cache' ) ) {
     610        if ( file_exists( LSCWP_DIR . 'src/metabox.cls.php' ) && $this->cls( 'Metabox' )->setting( 'litespeed_no_cache' ) ) {
    611611            self::set_nocache( 'per post metabox setting' );
    612612            return;
  • litespeed-cache/trunk/src/crawler.cls.php

    r2771786 r2781559  
    594594     */
    595595    private function _multi_request( $rows, $options ) {
     596        if (!function_exists('curl_multi_init')) exit('curl_multi_init disabled');
    596597        $mh = curl_multi_init();
    597598        $curls = array();
     
    603604                continue;
    604605            }
     606
     607            if (!function_exists('curl_init')) exit('curl_init disabled');
     608
    605609            $curls[ $row[ 'id' ] ] = curl_init();
    606610
     
    697701                return 'H'; // Hit
    698702            }
     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';
    699708        }
    700709
  • litespeed-cache/trunk/src/css.cls.php

    r2771786 r2781559  
    307307        if ( empty( $json[ 'status' ] ) ) {
    308308            if ( ! empty( $json[ $type ] ) ) {
    309                 $this->_save_con( $type, $json[ $type ], $queue_k );
     309                $this->_save_con( $type, $json[ $type ], $queue_k, $is_mobile, $is_webp );
    310310            }
    311311
     
    333333     * @since 4.2
    334334     */
    335     private function _save_con( $type, $css, $queue_k ) {
     335    private function _save_con( $type, $css, $queue_k, $mobile, $webp ) {
    336336        // Add filters
    337337        $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
     
    355355        Debug2::debug2( "[CSS] Save URL to file [file] $static_file [vary] $vary" );
    356356
    357         $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ) );
     357        $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ), $mobile, $webp );
    358358
    359359        Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
  • litespeed-cache/trunk/src/data.cls.php

    r2761310 r2781559  
    3030            'litespeed_update_4_4_4',
    3131        ),
     32        '5.3-a5'    => array(
     33            'litespeed_update_5_3',
     34        ),
    3235    );
    3336
     
    453456     * @since  4.0
    454457     */
    455     public function save_url( $request_url, $vary, $file_type, $filecon_md5, $path ) {
     458    public function save_url( $request_url, $vary, $file_type, $filecon_md5, $path, $mobile = false, $webp = false ) {
    456459        global $wpdb;
    457460
     
    496499
    497500        // 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 ) ) );
     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 ) ) );
    500503
    501504        // Mark existing rows as expired
     
    569572     * @since 4.5
    570573     */
    571     public function mark_as_expired( $request_url ) {
     574    public function mark_as_expired( $request_url, $auto_q = false ) {
    572575        global $wpdb;
    573576
     
    582585        Debug2::debug( '[Data] Mark url_id=' . $url_row[ 'id' ] . ' as expired' );
    583586
     587        $tb_url = $this->tb( 'url' );
    584588        $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        }
    585596        $q = "UPDATE `$tb_url_file` SET expired=%d WHERE url_id=%d AND type=4 AND expired=0";
    586597        $expired = time() + 86400 * apply_filters( 'litespeed_url_file_expired_days', 20 );
    587598        $wpdb->query( $wpdb->prepare( $q, array( $expired, $url_row[ 'id' ] ) ) );
     599
     600        return $existing_url_files;
    588601    }
    589602
  • litespeed-cache/trunk/src/data.upgrade.func.php

    r2656005 r2781559  
    1313use LiteSpeed\Admin_Display;
    1414use LiteSpeed\File;
     15
     16/**
     17 * Append webp/mobile to url_file
     18 * @since 5.3
     19 */
     20function 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}
    1532
    1633/**
  • litespeed-cache/trunk/src/data_structure/url_file.sql

    r2634373 r2781559  
    44`filename` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'md5 of file content',
    55`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',
    68`expired` int(11) NOT NULL DEFAULT 0,
    79PRIMARY KEY (`id`),
  • litespeed-cache/trunk/src/img-optm.cls.php

    r2683957 r2781559  
    153153
    154154        foreach ( $list as $v ) {
     155            if ( ! $v->post_id ) continue;
     156
    155157            $meta_value = $this->_parse_wp_meta_value( $v );
    156158            if ( ! $meta_value ) {
  • litespeed-cache/trunk/src/purge.cls.php

    r2764804 r2781559  
    6767        add_action( 'wp_update_comment_count', array( $this, 'purge_feeds' ) );
    6868
     69        if ($this->conf(self::O_OPTM_UCSS)) add_action('edit_post', __NAMESPACE__ . '\Purge::purge_ucss');
    6970    }
    7071
     
    271272        $post_id_or_url = untrailingslashit( $post_id_or_url );
    272273
    273         Data::cls()->mark_as_expired( $post_id_or_url );
     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        }
    274279    }
    275280
  • litespeed-cache/trunk/src/ucss.cls.php

    r2771786 r2781559  
    8787        $uid = get_current_user_id();
    8888
    89         $ua = ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : '';
     89        $ua = $this->_get_ua();
    9090
    9191        // Store it for cron
     
    117117
    118118    /**
     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    /**
    119171     * Generate UCSS
    120172     *
     
    268320        if ( empty( $json[ 'status' ] ) ) {
    269321            if ( ! empty( $json[ 'ucss' ] ) ) {
    270                 $this->_save_con( 'ucss', $json[ 'ucss' ], $queue_k );
     322                $this->_save_con( 'ucss', $json[ 'ucss' ], $queue_k, $is_mobile, $is_webp );
    271323            }
    272324
     
    294346     * @since 4.2
    295347     */
    296     private function _save_con( $type, $css, $queue_k ) {
     348    private function _save_con( $type, $css, $queue_k, $is_mobile, $is_webp ) {
    297349        // Add filters
    298350        $css = apply_filters( 'litespeed_' . $type, $css, $queue_k );
     
    316368        self::debug2( "Save URL to file [file] $static_file [vary] $vary" );
    317369
    318         $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ) );
     370        $this->cls( 'Data' )->save_url( $url_tag, $vary, $type, $filecon_md5, dirname( $static_file ), $is_mobile, $is_webp );
    319371
    320372        Purge::add( strtoupper( $type ) . '.' . md5( $queue_k ) );
     
    476528            // Save data
    477529            if ( ! empty( $v[ 'data_ucss' ] ) ) {
    478                 $this->_save_con( 'ucss', $v[ 'data_ucss' ], $v[ 'queue_k' ] );
     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 );
    479533
    480534                $valid_i ++;
  • litespeed-cache/trunk/tpl/dash/dashboard.tpl.php

    r2764804 r2781559  
    165165            </div>
    166166        <?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; ?>
    167192    </div>
    168193
  • litespeed-cache/trunk/tpl/toolbox/beta_test.tpl.php

    r2771786 r2781559  
    55// Existing public version list
    66$v_list = array(
     7    '5.2.1',
    78    '5.2',
    89    '5.1',
Note: See TracChangeset for help on using the changeset viewer.