Plugin Directory

Changeset 2940517


Ignore:
Timestamp:
07/19/2023 06:53:16 PM (2 years ago)
Author:
LiteSpeedTech
Message:

Release v5.5.1

Location:
litespeed-cache
Files:
330 added
4 edited

Legend:

Unmodified
Added
Removed
  • litespeed-cache/trunk/litespeed-cache.php

    r2928795 r2940517  
    55 * Plugin URI:        https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
    66 * Description:       High-performance page caching and site optimization from LiteSpeed
    7  * Version:           5.5
     7 * Version:           5.5.1
    88 * Author:            LiteSpeed Technologies
    99 * Author URI:        https://www.litespeedtech.com
     
    3535}
    3636
    37 !defined('LSCWP_V') && define('LSCWP_V', '5.5');
     37!defined('LSCWP_V') && define('LSCWP_V', '5.5.1');
    3838
    3939!defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR);
  • litespeed-cache/trunk/readme.txt

    r2928795 r2940517  
    44Requires at least: 4.0
    55Tested up to: 6.2.2
    6 Stable tag: 5.5
     6Stable tag: 5.5.1
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl.html
     
    250250
    251251== Changelog ==
     252
     253= 5.5.1 - Jul 19 2023 =
     254* 🐞**Image Optimization** Fixed a bug where WebP replacements couldn't be pulled without optimizing the original images.
     255* 🐞**Image Optimization** Invalid images will now be removed when sending requests to the server. (#138993)
     256* **Cloud** Added support for error codes `unpulled_images` and `blocklisted`. (Tynan)
    252257
    253258= 5.5 - Jun 20 2023 =
  • litespeed-cache/trunk/src/cloud.cls.php

    r2928795 r2940517  
    751751
    752752        if (!empty($json['_code'])) {
     753            self::debug('Hit err _code: ' . $json['_code']);
     754            if ($json['_code'] == 'unpulled_images') {
     755                $msg = __('Cloud server refused the current request due to unpulled images. Please pull the images first.', 'litespeed-cache');
     756                Admin_Display::error($msg);
     757                return;
     758            }
     759            if ($json['_code'] == 'blocklisted') {
     760                $msg = __('Your domain_key has been temporarily blocklisted to prevent abuse. You may contact support at QUIC.cloud to learn more.', 'litespeed-cache');
     761                Admin_Display::error($msg);
     762                return;
     763            }
     764
    753765            if ($json['_code'] == 'rate_limit') {
    754766                self::debug('Cloud server rate limit exceeded.');
  • litespeed-cache/trunk/src/img-optm.cls.php

    r2928795 r2940517  
    610610
    611611            $_img_info = $this->__media->info($v->src, $v->post_id);
     612
     613            # If record is invalid, remove from img_optming table
     614            if (empty($_img_info['url']) || empty($_img_info['md5'])) {
     615                $wpdb->query($wpdb->prepare("DELETE FROM `$this->_table_img_optming` WHERE id=%d", $v->id));
     616                continue;
     617            }
    612618            $img = array(
    613619                'id'    => $v->id,
     
    894900
    895901            $server_info = json_decode($row_img->server_info, true);
    896             if (empty($server_info['ori'])) {
    897                 // Delete working table
    898                 $q = "DELETE FROM `$this->_table_img_optming` WHERE id = %d ";
    899                 $wpdb->query($wpdb->prepare($q, $row_img->id));
    900 
    901                 continue;
    902             }
    903             /**
    904              * Use wp orignal get func to avoid allow_url_open off issue
    905              * @since  1.6.5
    906              */
    907             $image_url = $server_info['server'] . '/' . $server_info['ori'];
    908             self::debug('Pulling image: ' . $image_url);
    909             $response = wp_remote_get($image_url, array('timeout' => 60));
    910             if (is_wp_error($response)) {
    911                 $error_message = $response->get_error_message();
    912                 self::debug('❌ failed to pull image: ' . $error_message);
    913                 return;
    914             }
    915 
    916             if ($response['response']['code'] == 404) {
    917                 $this->_step_back_image($row_img->id);
    918 
    919                 $msg = __('Some optimized image file(s) has expired and was cleared.', 'litespeed-cache');
    920                 Admin_Display::error($msg);
    921                 continue;
    922             }
    923 
    924             file_put_contents($local_file . '.tmp', $response['body']);
    925 
    926             if (!file_exists($local_file . '.tmp') || !filesize($local_file . '.tmp') || md5_file($local_file . '.tmp') !== $server_info['ori_md5']) {
    927                 self::debug('❌ Failed to pull optimized img: file md5 mismatch [url] ' . $server_info['server'] . '/' . $server_info['ori'] . ' [server_md5] ' . $server_info['ori_md5']);
    928 
    929                 // Delete working table
    930                 $q = "DELETE FROM `$this->_table_img_optming` WHERE id = %d ";
    931                 $wpdb->query($wpdb->prepare($q, $row_img->id));
    932 
    933                 $msg = __('One or more pulled images does not match with the notified image md5', 'litespeed-cache');
    934                 Admin_Display::error($msg);
    935                 continue;
    936             }
    937 
    938             // Backup ori img
    939             if (!$rm_ori_bkup) {
    940                 $extension = pathinfo($local_file, PATHINFO_EXTENSION);
    941                 $bk_file = substr($local_file, 0, -strlen($extension)) . 'bk.' . $extension;
    942                 file_exists($local_file) && rename($local_file, $bk_file);
    943             }
    944 
    945             // Replace ori img
    946             rename($local_file . '.tmp', $local_file);
    947 
    948             self::debug('Pulled optimized img: ' . $local_file);
    949 
    950             /**
    951              * API Hook
    952              * @since  2.9.5
    953              * @since  3.0 $row_img has less elements now. Most useful ones are `post_id`/`src`
    954              */
    955             do_action('litespeed_img_pull_ori', $row_img, $local_file);
    956 
    957             $total_pulled_ori++;
    958             // }
     902            if (!empty($server_info['ori'])) {
     903                /**
     904                 * Use wp original get func to avoid allow_url_open off issue
     905                 * @since  1.6.5
     906                 */
     907                $image_url = $server_info['server'] . '/' . $server_info['ori'];
     908                self::debug('Pulling image: ' . $image_url);
     909                $response = wp_remote_get($image_url, array('timeout' => 60));
     910                if (is_wp_error($response)) {
     911                    $error_message = $response->get_error_message();
     912                    self::debug('❌ failed to pull image: ' . $error_message);
     913                    return;
     914                }
     915
     916                if ($response['response']['code'] == 404) {
     917                    $this->_step_back_image($row_img->id);
     918
     919                    $msg = __('Some optimized image file(s) has expired and was cleared.', 'litespeed-cache');
     920                    Admin_Display::error($msg);
     921                    continue;
     922                }
     923
     924                file_put_contents($local_file . '.tmp', $response['body']);
     925
     926                if (!file_exists($local_file . '.tmp') || !filesize($local_file . '.tmp') || md5_file($local_file . '.tmp') !== $server_info['ori_md5']) {
     927                    self::debug('❌ Failed to pull optimized img: file md5 mismatch [url] ' . $server_info['server'] . '/' . $server_info['ori'] . ' [server_md5] ' . $server_info['ori_md5']);
     928
     929                    // Delete working table
     930                    $q = "DELETE FROM `$this->_table_img_optming` WHERE id = %d ";
     931                    $wpdb->query($wpdb->prepare($q, $row_img->id));
     932
     933                    $msg = __('One or more pulled images does not match with the notified image md5', 'litespeed-cache');
     934                    Admin_Display::error($msg);
     935                    continue;
     936                }
     937
     938                // Backup ori img
     939                if (!$rm_ori_bkup) {
     940                    $extension = pathinfo($local_file, PATHINFO_EXTENSION);
     941                    $bk_file = substr($local_file, 0, -strlen($extension)) . 'bk.' . $extension;
     942                    file_exists($local_file) && rename($local_file, $bk_file);
     943                }
     944
     945                // Replace ori img
     946                rename($local_file . '.tmp', $local_file);
     947
     948                self::debug('Pulled optimized img: ' . $local_file);
     949
     950                /**
     951                 * API Hook
     952                 * @since  2.9.5
     953                 * @since  3.0 $row_img has less elements now. Most useful ones are `post_id`/`src`
     954                 */
     955                do_action('litespeed_img_pull_ori', $row_img, $local_file);
     956
     957                $total_pulled_ori++;
     958            }
    959959
    960960            // Save webp image
    961961            $webp_size = 0;
    962 
    963962            if (!empty($server_info['webp'])) {
    964963                // Fetch
Note: See TracChangeset for help on using the changeset viewer.