Changeset 3788909
- Timestamp:
- 11/07/2026 01:06:58 AM (less than one hour ago)
- Location:
- fastcache-by-host-it/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
fastcache.php (modified) (2 diffs)
-
src/Host/admin/class-fastcache-admin.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fastcache-by-host-it/trunk/README.txt
r3783868 r3788909 5 5 Tested up to: 7.0 6 6 Requires PHP: 8.0 7 Stable Tag: 1.7. 97 Stable Tag: 1.7.10 8 8 License: GPL-2.0+ 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 152 152 153 153 == Changelog == 154 1.7.10 155 Corretto Bug#34751: il warm-up dopo la pubblicazione ora salta i tipi di contenuto senza pagina pubblica (classi globali Elementor v4, template), richiede ogni indirizzo una sola volta per richiesta, con un massimo di 10 indirizzi e 25 secondi, e viene eseguito a fine richiesta senza far attendere il salvataggio. Lo stesso controllo vale per lo svuotamento ritardato di Bug#34693. Nuovi filtri: `fastcache_warmup_skip_post_types`, `fastcache_warmup_max_urls`, `fastcache_warmup_time_budget`. 156 154 157 1.7.9 155 158 Corretto Bug#34693: dopo la pubblicazione o l'aggiornamento di un articolo la cache di pagina viene svuotata una seconda volta, circa un minuto dopo l'ultimo salvataggio (intervallo modificabile con il filtro `fastcache_delayed_purge_seconds`, 0 per disattivarlo). In precedenza una visita arrivata mentre i dati SEO non erano ancora definitivi poteva lasciare in cache una copia con canonical, titolo o descrizione sbagliati (ad esempio il canonical della categoria predefinita invece di quella primaria), che restava servita finché non scadeva o veniva svuotata a mano. -
fastcache-by-host-it/trunk/fastcache.php
r3783868 r3788909 17 17 * Plugin URI: https://fastcache.host.it/wordpress/ 18 18 * 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.7. 919 * Version: 1.7.10 20 20 * Author: Host.it 21 21 * Author URI: https://fastcache.host.it/ … … 45 45 define ( '_WP_EXEC', '1' ); 46 46 define ( '_FASTCACHE_EXEC', 1 ); 47 define ( 'FASTCACHE_VERSION', '1.7. 9' );47 define ( 'FASTCACHE_VERSION', '1.7.10' ); 48 48 define ( 'FASTCACHE_FILE_PATH', __FILE__ ); 49 49 -
fastcache-by-host-it/trunk/src/Host/admin/class-fastcache-admin.php
r3783868 r3788909 52 52 */ 53 53 private $inDelayedPurge = false; 54 /** 55 * Urls waiting for the warm-up of the current request: warmupAfterPurge() fills it, runWarmupQueue() requests each 56 * url once at shutdown (Bug#34751: bulk saves of technical records used to trigger hundreds of blocking requests). 57 */ 58 private static $warmupQueue = []; 59 private static $warmupHooked = false; 54 60 /** 55 61 * Initialize the class and set its properties. … … 423 429 } 424 430 431 // Technical records without a public page (Elementor global classes, ...) cannot have a stale page to fix 432 if (! $this->isVisitablePostType(get_post_type($postId))) { 433 return; 434 } 435 425 436 /** 426 437 * Seconds between the last save of a post and its second purge. Return 0 to disable it. … … 482 493 } 483 494 495 // Technical records without a public page (Elementor global classes, templates, ...) have nothing to warm up. 496 if ( ! $this->isVisitablePostType( $post->post_type ) ) { 497 return; 498 } 499 484 500 $urls = []; 485 501 $permalink = get_permalink( $postId ); … … 498 514 } ) ) ); 499 515 516 // Queue instead of requesting now: every url is requested once per PHP request, after the last purge of the 517 // request, and without keeping the saving user waiting (see runWarmupQueue()). 518 foreach ( $urls as $url ) { 519 self::$warmupQueue[ $url ] = true; 520 } 521 if ( ! self::$warmupHooked ) { 522 self::$warmupHooked = true; 523 add_action( 'shutdown', array( __CLASS__, 'runWarmupQueue' ), 20 ); 524 } 525 } 526 527 /** 528 * Whether a post type has pages visitors can open, so it makes sense to warm up and to purge again later. 529 * Filter fastcache_warmup_skip_post_types adds or removes types from the default list of skipped ones. 530 * 531 * @param string $postType 532 * @return bool 533 */ 534 private function isVisitablePostType( $postType ) { 535 if ( function_exists( 'is_post_type_viewable' ) && ! is_post_type_viewable( $postType ) ) { 536 return false; 537 } 538 $skip = apply_filters( 'fastcache_warmup_skip_post_types', array( 'elementor_library' ) ); 539 540 return ! ( is_array( $skip ) && in_array( $postType, $skip, true ) ); 541 } 542 543 /** 544 * Shutdown callback: request the queued warm-up urls once each. 545 * The response is already sent when it runs; where PHP allows it the connection is closed first, so the editor 546 * never waits for these requests. Capped in number of urls and in time, so a bulk save cannot keep a worker busy. 547 * 548 * @return void 549 */ 550 public static function runWarmupQueue() { 551 $urls = array_keys( self::$warmupQueue ); 552 self::$warmupQueue = []; 553 if ( empty( $urls ) ) { 554 return; 555 } 556 557 $max = (int) apply_filters( 'fastcache_warmup_max_urls', 10 ); 558 if ( $max > 0 ) { 559 $urls = array_slice( $urls, 0, $max ); 560 } 561 $deadline = time() + max( 1, (int) apply_filters( 'fastcache_warmup_time_budget', 25 ) ); 562 563 if ( function_exists( 'fastcgi_finish_request' ) ) { 564 fastcgi_finish_request(); 565 } elseif ( function_exists( 'litespeed_finish_request' ) ) { 566 litespeed_finish_request(); 567 } 568 500 569 $ua = 'FastCache-Warmup/' . ( defined( 'FASTCACHE_VERSION' ) ? FASTCACHE_VERSION : '1.7.8' ); 501 570 foreach ( $urls as $url ) { 571 if ( time() > $deadline ) { 572 break; 573 } 502 574 $response = wp_remote_get( $url, [ 503 575 'timeout' => 45,
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)