Plugin Directory

Changeset 3458784


Ignore:
Timestamp:
02/11/2026 08:50:39 AM (7 weeks ago)
Author:
hostspa
Message:

1.5.15
New feature for Import and Export configuration
Fix for .htaccess duplicated rules

Location:
fastcache-by-host-it
Files:
2 added
4 edited
188 copied

Legend:

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

    r3458280 r3458784  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.14
     7Stable Tag: 1.5.15
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.15
     135New feature for Import and Export configuration
     136Fix for .htaccess duplicated rules
     137
    1341381.5.14
    135139Fix to allow config downloads
  • fastcache-by-host-it/tags/1.5.15/fastcache.php

    r3458280 r3458784  
    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.14
     19 * Version:           1.5.15
    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.14' );
     47define ( 'FASTCACHE_VERSION', '1.5.15' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/tags/1.5.15/src/Core/Platform/Plugin.php

    r3458155 r3458784  
    8181    }
    8282    public static function update(): void {
     83        self::setHtaccessCacheEnableSwitch();
    8384        self::hookToLicense('update');
    8485    }
  • fastcache-by-host-it/tags/1.5.15/src/Core/Platform/Utility.php

    r3458155 r3458784  
    422422                    // Versione legacy per Apache 2.2 (compatibile universale)
    423423                    $htaccessPageCache = <<<APACHECONFIG
    424 ## BEGIN HTACCESS PAGE CACHING - FASTCACHE 2.2 ##
    425 
     424## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##
     425## 3.0
    426426RewriteEngine On
     427RewriteCond %{REQUEST_URI} !^/wp-content/cache/fastcache/page/ [NC]
    427428RewriteRule ^ - [E=FASTCACHE_LEVEL:MISS]
    428429# ===== HOME =====
     
    515516                }
    516517               
    517                 // Scrivi l'htaccess solo se non esiste già il blocco
    518                 if (($postedHtaccessCacheEnable == 1 || $postedHtaccessCacheEnable == -1) && !preg_match('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', $contents)) {
     518                $regex = '~^[ \t]*## BEGIN HTACCESS PAGE CACHING - FASTCACHE[^\r\n]*\R.*?^[ \t]*## END HTACCESS PAGE CACHING - FASTCACHE[^\r\n]*\R?~sm';
     519
     520                if ($postedHtaccessCacheEnable == 1 || $postedHtaccessCacheEnable == -1) {
     521
     522                    // 1) Rimuovi TUTTE le occorrenze (anche duplicate, anche legacy)
     523                    $clean = preg_replace($regex, '', $contents, -1, $count);
     524
     525                    // 2) Se non c’era nulla oppure c’erano duplicati, riscrivi inserendo UN SOLO blocco canonico
     526                    if ($count > 0) {
     527                        return file_put_contents($htaccess, $htaccessPageCache . $clean);
     528                    }
     529
     530                    // 3) Se non è stato rimosso nulla, il blocco non c’era: aggiungilo
     531                    // (qui mantieni la tua logica originale: prepend)
    519532                    return file_put_contents($htaccess, $htaccessPageCache . $contents);
    520                 } elseif (($postedHtaccessCacheEnable == 0 || $postedHtaccessCacheEnable == -1) && preg_match('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', $contents)) {
    521                     $clean_contents = preg_replace('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', '', $contents, -1, $count);
     533
     534                } elseif ($postedHtaccessCacheEnable == 0 || $postedHtaccessCacheEnable == -1) {
     535
     536                    // Disable: rimuovi TUTTI i blocchi
     537                    $clean = preg_replace($regex, '', $contents, -1, $count);
     538
    522539                    if ($count > 0) {
    523                         return file_put_contents($htaccess, $clean_contents);
     540                        return file_put_contents($htaccess, $clean);
    524541                    }
     542
     543                    return true;
    525544                }
     545
    526546            } else {
    527547                return 'FILEDOESNTEXIST';
  • fastcache-by-host-it/trunk/README.txt

    r3458280 r3458784  
    55Tested up to: 6.9.1
    66Requires PHP: 8.0
    7 Stable Tag: 1.5.14
     7Stable Tag: 1.5.15
    88License: GPL-2.0+
    99License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    132132
    133133== Changelog ==
     1341.5.15
     135New feature for Import and Export configuration
     136Fix for .htaccess duplicated rules
     137
    1341381.5.14
    135139Fix to allow config downloads
  • fastcache-by-host-it/trunk/fastcache.php

    r3458280 r3458784  
    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.14
     19 * Version:           1.5.15
    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.14' );
     47define ( 'FASTCACHE_VERSION', '1.5.15' );
    4848define ( 'FASTCACHE_FILE_PATH', __FILE__ );
    4949
  • fastcache-by-host-it/trunk/src/Core/Platform/Plugin.php

    r3458155 r3458784  
    8181    }
    8282    public static function update(): void {
     83        self::setHtaccessCacheEnableSwitch();
    8384        self::hookToLicense('update');
    8485    }
  • fastcache-by-host-it/trunk/src/Core/Platform/Utility.php

    r3458155 r3458784  
    422422                    // Versione legacy per Apache 2.2 (compatibile universale)
    423423                    $htaccessPageCache = <<<APACHECONFIG
    424 ## BEGIN HTACCESS PAGE CACHING - FASTCACHE 2.2 ##
    425 
     424## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##
     425## 3.0
    426426RewriteEngine On
     427RewriteCond %{REQUEST_URI} !^/wp-content/cache/fastcache/page/ [NC]
    427428RewriteRule ^ - [E=FASTCACHE_LEVEL:MISS]
    428429# ===== HOME =====
     
    515516                }
    516517               
    517                 // Scrivi l'htaccess solo se non esiste già il blocco
    518                 if (($postedHtaccessCacheEnable == 1 || $postedHtaccessCacheEnable == -1) && !preg_match('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', $contents)) {
     518                $regex = '~^[ \t]*## BEGIN HTACCESS PAGE CACHING - FASTCACHE[^\r\n]*\R.*?^[ \t]*## END HTACCESS PAGE CACHING - FASTCACHE[^\r\n]*\R?~sm';
     519
     520                if ($postedHtaccessCacheEnable == 1 || $postedHtaccessCacheEnable == -1) {
     521
     522                    // 1) Rimuovi TUTTE le occorrenze (anche duplicate, anche legacy)
     523                    $clean = preg_replace($regex, '', $contents, -1, $count);
     524
     525                    // 2) Se non c’era nulla oppure c’erano duplicati, riscrivi inserendo UN SOLO blocco canonico
     526                    if ($count > 0) {
     527                        return file_put_contents($htaccess, $htaccessPageCache . $clean);
     528                    }
     529
     530                    // 3) Se non è stato rimosso nulla, il blocco non c’era: aggiungilo
     531                    // (qui mantieni la tua logica originale: prepend)
    519532                    return file_put_contents($htaccess, $htaccessPageCache . $contents);
    520                 } elseif (($postedHtaccessCacheEnable == 0 || $postedHtaccessCacheEnable == -1) && preg_match('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', $contents)) {
    521                     $clean_contents = preg_replace('@## BEGIN HTACCESS PAGE CACHING - FASTCACHE ##.*?## END HTACCESS PAGE CACHING - FASTCACHE ##@s', '', $contents, -1, $count);
     533
     534                } elseif ($postedHtaccessCacheEnable == 0 || $postedHtaccessCacheEnable == -1) {
     535
     536                    // Disable: rimuovi TUTTI i blocchi
     537                    $clean = preg_replace($regex, '', $contents, -1, $count);
     538
    522539                    if ($count > 0) {
    523                         return file_put_contents($htaccess, $clean_contents);
     540                        return file_put_contents($htaccess, $clean);
    524541                    }
     542
     543                    return true;
    525544                }
     545
    526546            } else {
    527547                return 'FILEDOESNTEXIST';
Note: See TracChangeset for help on using the changeset viewer.