Plugin Directory

Changeset 3467783


Ignore:
Timestamp:
02/23/2026 02:22:00 PM (6 weeks ago)
Author:
hostspa
Message:

1.5.18
Major improvements to filesystem caching.
All filesystem caches now run in auto-prune mode.
When a post is created, updated, trashed, deleted, or when any event changes its status, all related pages in the WordPress ecosystem are automatically purged from the filesystem cache.
Full Page Caching is now managed through an hourly cron job. During each run, all static cache versions are automatically pruned according to the delay defined in the “TTL aging of cache” setting.
A new dashboard widget has been added to provide quick access to core information and core functions, including activate/deactivate controls for:

PHP Cache
Full Page Cache
CDN

with built-in purge shortcuts.

Location:
fastcache-by-host-it
Files:
14 edited
16 copied

Legend:

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

    r3465833 r3467783  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.17
     7Stable Tag: 1.5.18
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.18
     135Major improvements to filesystem caching.
     136All filesystem caches now run in auto-prune mode.
     137When a post is created, updated, trashed, deleted, or when any event changes its status, all related pages in the WordPress ecosystem are automatically purged from the filesystem cache.
     138Full Page Caching is now managed through an hourly cron job. During each run, all static cache versions are automatically pruned according to the delay defined in the “TTL aging of cache” setting.
     139A new dashboard widget has been added to provide quick access to core information and core functions, including activate/deactivate controls for:
     140    PHP Cache
     141    Full Page Cache
     142    CDN
     143with built-in purge shortcuts.
     144
    1341451.5.17
    135146Cron purging of cache files. Cron timing: every hour, ttl: 1day
  • fastcache-by-host-it/tags/1.5.18/fastcache.php

    r3465833 r3467783  
    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.17
     19 * Version:           1.5.18
    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.17' );
     47define ( 'FASTCACHE_VERSION', '1.5.18' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/tags/1.5.18/languages/fastcache-it_IT.po

    r3458155 r3467783  
    14751475"bypassing the execution of Wordpress. This simulates having a website with "
    14761476"static html pages and dramatically increases performance. NOTE: this feature "
    1477 "is enabled only for logged out users and may not follow cache lifetime given "
    1478 "that if all pages of the website are cached the PHP execution will be "
    1479 "completely skipped. You can delete cached files using admin buttons. This "
    1480 "cache system supports up to 10 segments in the URL path on Apache server "
     1477"is enabled only for logged out users, the PHP execution will be completely skipped."
     1478"This cache system supports up to 10 segments in the URL path on Apache server "
    14811479"version 2.2. If you need more segments, manually edit the .htaccess file or "
    14821480"upgrade to Apache version 2.4"
     
    14871485"Wordpress. Ciò simula la presenza di un sito con pagine HTML statiche e "
    14881486"aumenta drasticamente le prestazioni. NOTA: questa funzionalità è abilitata "
    1489 "solo per gli utenti disconnessi e potrebbe non rispettare la durata della "
    1490 "cache poiché se tutte le pagine del sito vengono memorizzate nella cache, "
    1491 "l'esecuzione di PHP verrà completamente saltata. Puoi eliminare i file "
    1492 "memorizzati nella cache utilizzando i pulsanti di amministrazione. Questo "
    1493 "sistema di cache supporta fino a 10 segmenti nel percorso delle URL su "
     1487"solo per gli utenti disconnessi l'esecuzione di PHP verrà completamente saltata. "
     1488"Questo sistema di cache supporta fino a 10 segmenti nel percorso delle URL su "
    14941489"server Apache versione 2.2 , se hai bisogno di più segmenti modifica "
    14951490"manualmente il file .htaccess oppure fai l'upgrade alla versione 2.4 di "
  • fastcache-by-host-it/tags/1.5.18/src/Admin/Model/Configurations.php

    r3458155 r3467783  
    1414
    1515use FastCacheFramework\Mvc\Model;
    16 use FilesystemIterator;
     16use FastCache\Core\Admin\DashboardWidget;
    1717
    1818class Configurations extends Model {
    1919    public function getCacheSize($cache_path, &$size, &$no_files) {
    20         if (file_exists ( $cache_path )) {
    21             $fi = new FilesystemIterator ( $cache_path, FilesystemIterator::SKIP_DOTS );
    22 
    23             foreach ( $fi as $file ) {
    24                 $size += $file->getSize ();
    25             }
    26 
    27             $no_files += iterator_count ( $fi );
    28         }
    29        
    30         // Add images path if availble
    31         $imagesCachePath = $cache_path . 'images/';
    32         if (file_exists ( $imagesCachePath )) {
    33             $fim = new FilesystemIterator ( $imagesCachePath, FilesystemIterator::SKIP_DOTS );
    34            
    35             foreach ( $fim as $image ) {
    36                 $size += $image->getSize ();
    37             }
    38            
    39             $no_files += iterator_count ( $fim );
    40         }
     20        $stats    = DashboardWidget::getCacheStats();
     21        $size     = $stats['size_raw'];
     22        $no_files = $stats['files_raw'];
    4123    }
    4224}
  • fastcache-by-host-it/tags/1.5.18/src/Core/Platform/Cache.php

    r3460794 r3467783  
    340340        return true;
    341341    }
     342
     343    /**
     344     * Selectively delete page cache files (.html) matching the given URLs.
     345     * Only operates when htaccess_cache_enable is active.
     346     *
     347     * @param array $urls Full URLs to purge from filesystem cache
     348     * @return array List of deleted file paths
     349     * @throws Exception
     350     */
     351    public static function deleteCacheFilesByUrls(array $urls) {
     352        $wp_filesystem = self::getWpFileSystem();
     353        if ($wp_filesystem === false) {
     354            return [];
     355        }
     356
     357        $params = Plugin::getPluginParams();
     358        $deleted = [];
     359
     360        // Only handle htaccess mode (.html files)
     361        if (!$params->get('htaccess_cache_enable', '1')) {
     362            return [];
     363        }
     364
     365        $siteUrl = site_url();
     366        $cacheDir = FASTCACHE_CACHE_DIR . 'page/';
     367
     368        foreach ($urls as $url) {
     369            $slug = str_ireplace('/', '_', str_ireplace($siteUrl, '', $url));
     370
     371            if (strpos($url, '*') !== false) {
     372                // Wildcard: use glob pattern
     373                $pattern = $cacheDir . $slug . '.html';
     374                $files = glob($pattern);
     375                if ($files) {
     376                    foreach ($files as $file) {
     377                        $wp_filesystem->delete($file);
     378                        $deleted[] = $file;
     379                    }
     380                }
     381            } else {
     382                // Exact URL
     383                $file = $cacheDir . $slug . '.html';
     384                if ($wp_filesystem->exists($file)) {
     385                    $wp_filesystem->delete($file);
     386                    $deleted[] = $file;
     387                }
     388            }
     389        }
     390
     391        return $deleted;
     392    }
     393
    342394    public static function purgeServerCache($url) {
    343395        // Parse the URL
  • fastcache-by-host-it/tags/1.5.18/src/Dispatcher.php

    r3465833 r3467783  
    2424use FastCache\Platform\Uri;
    2525use FastCache\Platform\Utility;
     26use FastCache\Core\Admin\DashboardWidget;
    2627
    2728abstract class Dispatcher {
     
    7576                    'loadActionLinks'
    7677            ], 10, 2 );
     78            DashboardWidget::init ();
    7779        } else {
    7880            if(self::$oParams->get ( 'disableCoreLazyload', 0 )) {
     
    237239
    238240    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
     241        // in this method i need to cancel all the file in FASTCACHE_CACHE_DIR . "page/*" older than page_cache_lifetime setting
    240242        $cache_dir = FASTCACHE_CACHE_DIR . "page/*";
    241243        $files = glob($cache_dir);
    242244        $current_time = time();
    243         $ttl = 86400;
     245        $params = Plugin::getPluginParams();
     246        $ttl = (int) $params->get('page_cache_lifetime', '86400');
    244247        foreach ($files as $file) {
    245248            $diff = $current_time - filemtime($file);
  • fastcache-by-host-it/tags/1.5.18/src/Host/admin/class-fastcache-admin.php

    r3458155 r3467783  
    252252                'transition_post_status'
    253253        );
    254         return apply_filters ( 'hostupdatecaching_events', $actions );
     254        return apply_filters ( 'fastcache_host_UpdateCachingEvents', $actions );
    255255    }
    256256
     
    322322        $this->purgeUrls = apply_filters ( 'fastcache_host_v_purge_urls', $this->purgeUrls, $postId );
    323323        if ($this->purgeable === true) {
    324             $this->purgeCache ();
     324            // Purge filesystem (htaccess) cache for affected URLs
     325            $this->purgeFilesystemCache ();
     326            // Purge CDN cache only if CDN is enabled
     327            $this->purgeCdnCache ();
    325328        }
    326329    }
     
    416419        // anche tutti i link relativi alle SITEMAP
    417420        array_push ( $this->purgeUrls, get_home_url () . "/*map*xml*" );
     421    }
     422
     423    /**
     424     * Purge filesystem (htaccess) cache for affected URLs.
     425     * Deletes corresponding .html files from the page cache directory.
     426     *
     427     * @return void
     428     */
     429    private function purgeFilesystemCache() {
     430        $purgeUrls = array_unique ( $this->purgeUrls );
     431        if (empty ( $purgeUrls )) {
     432            return;
     433        }
     434        $logger = new \FastCache\Host\HCommon ();
     435        $deleted = \FastCache\Platform\Cache::deleteCacheFilesByUrls ( $purgeUrls );
     436        if (! empty ( $deleted )) {
     437            $logger->fr ( "FS-CACHE PURGE: Deleted " . count ( $deleted ) . " file(s): " . implode ( ', ', $deleted ) );
     438        }
     439    }
     440
     441    /**
     442     * Purge CDN cache only if CDN is enabled in settings.
     443     *
     444     * @return void
     445     */
     446    private function purgeCdnCache() {
     447        $options = get_option ( FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS );
     448        if (empty ( $options ['fastcache-enable'] )) {
     449            return; // CDN disabled, skip PURGE requests
     450        }
     451        $this->purgeCache ();
    418452    }
    419453
  • fastcache-by-host-it/tags/1.5.18/vendor/composer/autoload_classmap.php

    r3458280 r3467783  
    148148    'FastCache\\Core\\Admin\\InOutConfig' => $baseDir . '/src/Core/Admin/InOutConfig.php',
    149149    'FastCache\\Core\\Admin\\Tasks' => $baseDir . '/src/Core/Admin/Tasks.php',
     150    'FastCache\\Core\\Admin\\DashboardWidget' => $baseDir . '/src/Core/Admin/DashboardWidget.php',
    150151    'FastCache\\Core\\Browser' => $baseDir . '/src/Core/Browser.php',
    151152    'FastCache\\Core\\Cdn' => $baseDir . '/src/Core/Cdn.php',
  • fastcache-by-host-it/tags/1.5.18/vendor/composer/autoload_static.php

    r3458280 r3467783  
    201201        'FastCache\\Core\\Admin\\InOutConfig' => __DIR__ . '/../..' . '/src/Core/Admin/InOutConfig.php',
    202202        'FastCache\\Core\\Admin\\Tasks' => __DIR__ . '/../..' . '/src/Core/Admin/Tasks.php',
     203        'FastCache\\Core\\Admin\\DashboardWidget' => __DIR__ . '/../..' . '/src/Core/Admin/DashboardWidget.php',
    203204        'FastCache\\Core\\Browser' => __DIR__ . '/../..' . '/src/Core/Browser.php',
    204205        'FastCache\\Core\\Cdn' => __DIR__ . '/../..' . '/src/Core/Cdn.php',
  • fastcache-by-host-it/trunk/README.txt

    r3465833 r3467783  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.17
     7Stable Tag: 1.5.18
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.18
     135Major improvements to filesystem caching.
     136All filesystem caches now run in auto-prune mode.
     137When a post is created, updated, trashed, deleted, or when any event changes its status, all related pages in the WordPress ecosystem are automatically purged from the filesystem cache.
     138Full Page Caching is now managed through an hourly cron job. During each run, all static cache versions are automatically pruned according to the delay defined in the “TTL aging of cache” setting.
     139A new dashboard widget has been added to provide quick access to core information and core functions, including activate/deactivate controls for:
     140    PHP Cache
     141    Full Page Cache
     142    CDN
     143with built-in purge shortcuts.
     144
    1341451.5.17
    135146Cron purging of cache files. Cron timing: every hour, ttl: 1day
  • fastcache-by-host-it/trunk/fastcache.php

    r3465833 r3467783  
    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.17
     19 * Version:           1.5.18
    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.17' );
     47define ( 'FASTCACHE_VERSION', '1.5.18' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/trunk/languages/fastcache-it_IT.po

    r3458155 r3467783  
    14751475"bypassing the execution of Wordpress. This simulates having a website with "
    14761476"static html pages and dramatically increases performance. NOTE: this feature "
    1477 "is enabled only for logged out users and may not follow cache lifetime given "
    1478 "that if all pages of the website are cached the PHP execution will be "
    1479 "completely skipped. You can delete cached files using admin buttons. This "
    1480 "cache system supports up to 10 segments in the URL path on Apache server "
     1477"is enabled only for logged out users, the PHP execution will be completely skipped."
     1478"This cache system supports up to 10 segments in the URL path on Apache server "
    14811479"version 2.2. If you need more segments, manually edit the .htaccess file or "
    14821480"upgrade to Apache version 2.4"
     
    14871485"Wordpress. Ciò simula la presenza di un sito con pagine HTML statiche e "
    14881486"aumenta drasticamente le prestazioni. NOTA: questa funzionalità è abilitata "
    1489 "solo per gli utenti disconnessi e potrebbe non rispettare la durata della "
    1490 "cache poiché se tutte le pagine del sito vengono memorizzate nella cache, "
    1491 "l'esecuzione di PHP verrà completamente saltata. Puoi eliminare i file "
    1492 "memorizzati nella cache utilizzando i pulsanti di amministrazione. Questo "
    1493 "sistema di cache supporta fino a 10 segmenti nel percorso delle URL su "
     1487"solo per gli utenti disconnessi l'esecuzione di PHP verrà completamente saltata. "
     1488"Questo sistema di cache supporta fino a 10 segmenti nel percorso delle URL su "
    14941489"server Apache versione 2.2 , se hai bisogno di più segmenti modifica "
    14951490"manualmente il file .htaccess oppure fai l'upgrade alla versione 2.4 di "
  • fastcache-by-host-it/trunk/src/Admin/Model/Configurations.php

    r3458155 r3467783  
    1414
    1515use FastCacheFramework\Mvc\Model;
    16 use FilesystemIterator;
     16use FastCache\Core\Admin\DashboardWidget;
    1717
    1818class Configurations extends Model {
    1919    public function getCacheSize($cache_path, &$size, &$no_files) {
    20         if (file_exists ( $cache_path )) {
    21             $fi = new FilesystemIterator ( $cache_path, FilesystemIterator::SKIP_DOTS );
    22 
    23             foreach ( $fi as $file ) {
    24                 $size += $file->getSize ();
    25             }
    26 
    27             $no_files += iterator_count ( $fi );
    28         }
    29        
    30         // Add images path if availble
    31         $imagesCachePath = $cache_path . 'images/';
    32         if (file_exists ( $imagesCachePath )) {
    33             $fim = new FilesystemIterator ( $imagesCachePath, FilesystemIterator::SKIP_DOTS );
    34            
    35             foreach ( $fim as $image ) {
    36                 $size += $image->getSize ();
    37             }
    38            
    39             $no_files += iterator_count ( $fim );
    40         }
     20        $stats    = DashboardWidget::getCacheStats();
     21        $size     = $stats['size_raw'];
     22        $no_files = $stats['files_raw'];
    4123    }
    4224}
  • fastcache-by-host-it/trunk/src/Core/Platform/Cache.php

    r3460794 r3467783  
    340340        return true;
    341341    }
     342
     343    /**
     344     * Selectively delete page cache files (.html) matching the given URLs.
     345     * Only operates when htaccess_cache_enable is active.
     346     *
     347     * @param array $urls Full URLs to purge from filesystem cache
     348     * @return array List of deleted file paths
     349     * @throws Exception
     350     */
     351    public static function deleteCacheFilesByUrls(array $urls) {
     352        $wp_filesystem = self::getWpFileSystem();
     353        if ($wp_filesystem === false) {
     354            return [];
     355        }
     356
     357        $params = Plugin::getPluginParams();
     358        $deleted = [];
     359
     360        // Only handle htaccess mode (.html files)
     361        if (!$params->get('htaccess_cache_enable', '1')) {
     362            return [];
     363        }
     364
     365        $siteUrl = site_url();
     366        $cacheDir = FASTCACHE_CACHE_DIR . 'page/';
     367
     368        foreach ($urls as $url) {
     369            $slug = str_ireplace('/', '_', str_ireplace($siteUrl, '', $url));
     370
     371            if (strpos($url, '*') !== false) {
     372                // Wildcard: use glob pattern
     373                $pattern = $cacheDir . $slug . '.html';
     374                $files = glob($pattern);
     375                if ($files) {
     376                    foreach ($files as $file) {
     377                        $wp_filesystem->delete($file);
     378                        $deleted[] = $file;
     379                    }
     380                }
     381            } else {
     382                // Exact URL
     383                $file = $cacheDir . $slug . '.html';
     384                if ($wp_filesystem->exists($file)) {
     385                    $wp_filesystem->delete($file);
     386                    $deleted[] = $file;
     387                }
     388            }
     389        }
     390
     391        return $deleted;
     392    }
     393
    342394    public static function purgeServerCache($url) {
    343395        // Parse the URL
  • fastcache-by-host-it/trunk/src/Dispatcher.php

    r3465833 r3467783  
    2424use FastCache\Platform\Uri;
    2525use FastCache\Platform\Utility;
     26use FastCache\Core\Admin\DashboardWidget;
    2627
    2728abstract class Dispatcher {
     
    7576                    'loadActionLinks'
    7677            ], 10, 2 );
     78            DashboardWidget::init ();
    7779        } else {
    7880            if(self::$oParams->get ( 'disableCoreLazyload', 0 )) {
     
    237239
    238240    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
     241        // in this method i need to cancel all the file in FASTCACHE_CACHE_DIR . "page/*" older than page_cache_lifetime setting
    240242        $cache_dir = FASTCACHE_CACHE_DIR . "page/*";
    241243        $files = glob($cache_dir);
    242244        $current_time = time();
    243         $ttl = 86400;
     245        $params = Plugin::getPluginParams();
     246        $ttl = (int) $params->get('page_cache_lifetime', '86400');
    244247        foreach ($files as $file) {
    245248            $diff = $current_time - filemtime($file);
  • fastcache-by-host-it/trunk/src/Host/admin/class-fastcache-admin.php

    r3458155 r3467783  
    252252                'transition_post_status'
    253253        );
    254         return apply_filters ( 'hostupdatecaching_events', $actions );
     254        return apply_filters ( 'fastcache_host_UpdateCachingEvents', $actions );
    255255    }
    256256
     
    322322        $this->purgeUrls = apply_filters ( 'fastcache_host_v_purge_urls', $this->purgeUrls, $postId );
    323323        if ($this->purgeable === true) {
    324             $this->purgeCache ();
     324            // Purge filesystem (htaccess) cache for affected URLs
     325            $this->purgeFilesystemCache ();
     326            // Purge CDN cache only if CDN is enabled
     327            $this->purgeCdnCache ();
    325328        }
    326329    }
     
    416419        // anche tutti i link relativi alle SITEMAP
    417420        array_push ( $this->purgeUrls, get_home_url () . "/*map*xml*" );
     421    }
     422
     423    /**
     424     * Purge filesystem (htaccess) cache for affected URLs.
     425     * Deletes corresponding .html files from the page cache directory.
     426     *
     427     * @return void
     428     */
     429    private function purgeFilesystemCache() {
     430        $purgeUrls = array_unique ( $this->purgeUrls );
     431        if (empty ( $purgeUrls )) {
     432            return;
     433        }
     434        $logger = new \FastCache\Host\HCommon ();
     435        $deleted = \FastCache\Platform\Cache::deleteCacheFilesByUrls ( $purgeUrls );
     436        if (! empty ( $deleted )) {
     437            $logger->fr ( "FS-CACHE PURGE: Deleted " . count ( $deleted ) . " file(s): " . implode ( ', ', $deleted ) );
     438        }
     439    }
     440
     441    /**
     442     * Purge CDN cache only if CDN is enabled in settings.
     443     *
     444     * @return void
     445     */
     446    private function purgeCdnCache() {
     447        $options = get_option ( FASTCACHEHOST_HOST_PLUGINNAME_SETTINGS );
     448        if (empty ( $options ['fastcache-enable'] )) {
     449            return; // CDN disabled, skip PURGE requests
     450        }
     451        $this->purgeCache ();
    418452    }
    419453
  • fastcache-by-host-it/trunk/vendor/composer/autoload_classmap.php

    r3458280 r3467783  
    148148    'FastCache\\Core\\Admin\\InOutConfig' => $baseDir . '/src/Core/Admin/InOutConfig.php',
    149149    'FastCache\\Core\\Admin\\Tasks' => $baseDir . '/src/Core/Admin/Tasks.php',
     150    'FastCache\\Core\\Admin\\DashboardWidget' => $baseDir . '/src/Core/Admin/DashboardWidget.php',
    150151    'FastCache\\Core\\Browser' => $baseDir . '/src/Core/Browser.php',
    151152    'FastCache\\Core\\Cdn' => $baseDir . '/src/Core/Cdn.php',
  • fastcache-by-host-it/trunk/vendor/composer/autoload_static.php

    r3458280 r3467783  
    201201        'FastCache\\Core\\Admin\\InOutConfig' => __DIR__ . '/../..' . '/src/Core/Admin/InOutConfig.php',
    202202        'FastCache\\Core\\Admin\\Tasks' => __DIR__ . '/../..' . '/src/Core/Admin/Tasks.php',
     203        'FastCache\\Core\\Admin\\DashboardWidget' => __DIR__ . '/../..' . '/src/Core/Admin/DashboardWidget.php',
    203204        'FastCache\\Core\\Browser' => __DIR__ . '/../..' . '/src/Core/Browser.php',
    204205        'FastCache\\Core\\Cdn' => __DIR__ . '/../..' . '/src/Core/Cdn.php',
Note: See TracChangeset for help on using the changeset viewer.