Plugin Directory

Changeset 3465833


Ignore:
Timestamp:
02/20/2026 01:29:15 PM (6 weeks ago)
Author:
hostspa
Message:

1.5.17
Cron purging of cache files. Cron timing: every hour, ttl: 1day

Location:
fastcache-by-host-it
Files:
4 edited
15 copied

Legend:

Unmodified
Added
Removed
  • fastcache-by-host-it/tags/1.5.17/README.txt

    r3460794 r3465833  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.16
     7Stable Tag: 1.5.17
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.17
     135Cron purge of cache files. Cron time every hour, ttl 1day
     136
    1341371.5.16
    135138Fix to restore the original htaccess when the plugin is deactivated
  • fastcache-by-host-it/tags/1.5.17/fastcache.php

    r3460794 r3465833  
    1717 * Plugin URI:        https://fastcache.host.it/wordpress/
    1818 * Description:       Abilita il tuo sito Wordpress alla prima vera CDN realizzata PER Wordpress e configurata AD-HOC per il tuo sito. Il massimo della velocità senza difficoltà di setup.
    19  * Version:           1.5.16
     19 * Version:           1.5.17
    2020 * Author:            Host.it
    2121 * Author URI:        https://fastcache.host.it/
     
    4545define ( '_WP_EXEC', '1' );
    4646define ( '_FASTCACHE_EXEC', 1 );
    47 define ( 'FASTCACHE_VERSION', '1.5.16' );
     47define ( 'FASTCACHE_VERSION', '1.5.17' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/tags/1.5.17/src/Dispatcher.php

    r3458155 r3465833  
    100100        add_action ( 'plugins_loaded', [
    101101            __CLASS__,
    102             'loadPluginTextDomain'
    103         ] );
    104        
    105         add_action ( 'plugins_loaded', [
    106             __CLASS__,
    107             'migration'
    108         ] );
     102            'pluginsLoaded'
     103        ], );
    109104        // register_uninstall_hook ( FASTCACHE_FILE_PATH, [
    110105        //      'FastCache\\Dispatcher',
     
    203198        return $sOptimizedHtml;
    204199    }
     200    public static function pluginsLoaded() {
     201        self::loadPluginTextDomain();
     202        self::migration();
     203        self::cronActivation();
     204    }
    205205    public static function migration() {
    206206        $installed = get_option('fastcache_version');
     
    225225        update_option('fastcache_version', FASTCACHE_VERSION);
    226226       
     227    }
     228    public static function cronActivation() {
     229        if (! wp_next_scheduled ( 'fastcache_cron_prune' )) {
     230            wp_schedule_event ( time (), 'hourly', 'fastcache_cron_prune' );
     231        }
     232
     233        // i need to add a hook to the cronjob
     234        add_action ( 'fastcache_cron_prune', [  __CLASS__,  'cronPrune' ] );
     235
     236    }
     237
     238    public static function cronPrune() {
     239        // in this method i need to cancel all the file in FASTCACHE_CACHE_DIR . "page/*" older than FASTCACHE_TTL_HTACCESS or 1day
     240        $cache_dir = FASTCACHE_CACHE_DIR . "page/*";
     241        $files = glob($cache_dir);
     242        $current_time = time();
     243        $ttl = 86400;
     244        foreach ($files as $file) {
     245            $diff = $current_time - filemtime($file);
     246            if ($diff > $ttl || filesize($file) ==0) {
     247                unlink($file);
     248            }
     249        }
    227250    }
    228251    public static function fastcache_upgrade_to_155() {
  • fastcache-by-host-it/trunk/README.txt

    r3460794 r3465833  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.16
     7Stable Tag: 1.5.17
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.17
     135Cron purging of cache files. Cron timing: every hour, ttl: 1day
     136
    1341371.5.16
    135138Fix to restore the original htaccess when the plugin is deactivated
  • fastcache-by-host-it/trunk/fastcache.php

    r3460794 r3465833  
    1717 * Plugin URI:        https://fastcache.host.it/wordpress/
    1818 * Description:       Abilita il tuo sito Wordpress alla prima vera CDN realizzata PER Wordpress e configurata AD-HOC per il tuo sito. Il massimo della velocità senza difficoltà di setup.
    19  * Version:           1.5.16
     19 * Version:           1.5.17
    2020 * Author:            Host.it
    2121 * Author URI:        https://fastcache.host.it/
     
    4545define ( '_WP_EXEC', '1' );
    4646define ( '_FASTCACHE_EXEC', 1 );
    47 define ( 'FASTCACHE_VERSION', '1.5.16' );
     47define ( 'FASTCACHE_VERSION', '1.5.17' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/trunk/src/Dispatcher.php

    r3458155 r3465833  
    100100        add_action ( 'plugins_loaded', [
    101101            __CLASS__,
    102             'loadPluginTextDomain'
    103         ] );
    104        
    105         add_action ( 'plugins_loaded', [
    106             __CLASS__,
    107             'migration'
    108         ] );
     102            'pluginsLoaded'
     103        ], );
    109104        // register_uninstall_hook ( FASTCACHE_FILE_PATH, [
    110105        //      'FastCache\\Dispatcher',
     
    203198        return $sOptimizedHtml;
    204199    }
     200    public static function pluginsLoaded() {
     201        self::loadPluginTextDomain();
     202        self::migration();
     203        self::cronActivation();
     204    }
    205205    public static function migration() {
    206206        $installed = get_option('fastcache_version');
     
    225225        update_option('fastcache_version', FASTCACHE_VERSION);
    226226       
     227    }
     228    public static function cronActivation() {
     229        if (! wp_next_scheduled ( 'fastcache_cron_prune' )) {
     230            wp_schedule_event ( time (), 'hourly', 'fastcache_cron_prune' );
     231        }
     232
     233        // i need to add a hook to the cronjob
     234        add_action ( 'fastcache_cron_prune', [  __CLASS__,  'cronPrune' ] );
     235
     236    }
     237
     238    public static function cronPrune() {
     239        // in this method i need to cancel all the file in FASTCACHE_CACHE_DIR . "page/*" older than FASTCACHE_TTL_HTACCESS or 1day
     240        $cache_dir = FASTCACHE_CACHE_DIR . "page/*";
     241        $files = glob($cache_dir);
     242        $current_time = time();
     243        $ttl = 86400;
     244        foreach ($files as $file) {
     245            $diff = $current_time - filemtime($file);
     246            if ($diff > $ttl || filesize($file) ==0) {
     247                unlink($file);
     248            }
     249        }
    227250    }
    228251    public static function fastcache_upgrade_to_155() {
Note: See TracChangeset for help on using the changeset viewer.