Plugin Directory

Changeset 2156347


Ignore:
Timestamp:
09/13/2019 10:49:02 PM (6 years ago)
Author:
runcloud
Message:

updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • runcache-purger/trunk/runcache-purger.php

    r2156238 r2156347  
    55 * Plugin URI:      https://wordpress.org/plugins/runcache-purger/
    66 * Description:     This plugin will purge RunCloud.io NGINX fastcgi, Proxy Cache and Redis Object Cache.
    7  * Version:         1.8.0
     7 * Version:         1.9.0
    88 * Author:          RunCloud
    99 * Author URI:      https://profiles.wordpress.org/runcloud/
     
    6464
    6565    // version
    66     private static $version      = '1.8.0';
    67     private static $version_prev = '1.7.0';
     66    private static $version      = '1.9.0';
     67    private static $version_prev = '1.8.0';
    6868
    6969    // later
     
    123123    {
    124124        $scheme = parse_url(get_site_url(), PHP_URL_SCHEME);
    125         return ( 'https' === $scheme ? true : false );
     125        return ('https' === $scheme ? true : false);
    126126    }
    127127
     
    10401040        //self::flush_object();
    10411041
    1042         $type          = (!empty($type) ? $type : self::request_purge_type());
    1043 
    1044         if ( empty($proto) && 'http' !== $proto && 'https' !== $proto ) {
    1045             $proto = ( self::is_wp_ssl() ? 'https' : 'http' );
    1046         }
    1047 
    1048         $request_query = $proto.'://127.0.0.1/runcache-purgeall-' . $type;
     1042        $type = (!empty($type) ? $type : self::request_purge_type());
     1043
     1044        if (empty($proto) && 'http' !== $proto && 'https' !== $proto) {
     1045            $proto = (self::is_wp_ssl() ? 'https' : 'http');
     1046        }
     1047
     1048        $request_query = $proto . '://127.0.0.1/runcache-purgeall-' . $type;
    10491049        return self::remote_request($request_query, ['method' => 'PURGE']);
    10501050    }
     
    16851685     * __shutdown.
    16861686     */
    1687     private static function __shutdown() {
    1688         add_action('shutdown', function() {
     1687    private static function __shutdown()
     1688    {
     1689        add_action('shutdown', function () {
    16891690            wp_cache_flush(0);
    16901691            wp_cache_delete('alloptions', 'options');
    16911692
    1692             if ( function_exists('wp_cache_self_remove') && defined('RUNCACHE_PURGER_DROPIN') ) {
     1693            if (function_exists('wp_cache_self_remove') && defined('RUNCACHE_PURGER_DROPIN')) {
    16931694                wp_cache_self_remove();
    16941695            }
     
    19201921
    19211922        // reset
    1922         $host_url = (!empty($host) ? $host : get_site_url());
    1923         $proto = parse_url($host_url, PHP_URL_SCHEME);
     1923        $host_url       = (!empty($host) ? $host : get_site_url());
     1924        $proto          = parse_url($host_url, PHP_URL_SCHEME);
    19241925        self::$hostname = parse_url($host_url, PHP_URL_HOST);
     1926
     1927        // maybe port 443 is open. Then check if we should use the https proto instead
     1928        if ('https' !== $proto && fsockopen('tls://' . self::$hostname, 443)) {
     1929            $proto = 'https';
     1930        }
    19251931
    19261932        self::request_purge_all($type, $proto);
Note: See TracChangeset for help on using the changeset viewer.