Changeset 3106344
- Timestamp:
- 06/23/2024 11:48:55 PM (21 months ago)
- Location:
- cache-warmer
- Files:
-
- 4 edited
- 39 copied
-
tags/1.3.0 (copied) (copied from cache-warmer/trunk)
-
tags/1.3.0/cache-warmer.php (copied) (copied from cache-warmer/trunk/cache-warmer.php) (1 diff)
-
tags/1.3.0/readme.txt (copied) (copied from cache-warmer/trunk/readme.txt) (2 diffs)
-
tags/1.3.0/src/assets/screens/class-assets-dashboard.php (copied) (copied from cache-warmer/trunk/src/assets/screens/class-assets-dashboard.php)
-
tags/1.3.0/src/class-databases.php (copied) (copied from cache-warmer/trunk/src/class-databases.php)
-
tags/1.3.0/src/class-migrations.php (copied) (copied from cache-warmer/trunk/src/class-migrations.php)
-
tags/1.3.0/src/class-object-cache.php (copied) (copied from cache-warmer/trunk/src/class-object-cache.php) (1 diff)
-
tags/1.3.0/src/class-warm-up.php (copied) (copied from cache-warmer/trunk/src/class-warm-up.php) (4 diffs)
-
tags/1.3.0/src/templates/admin/screens/main.php (copied) (copied from cache-warmer/trunk/src/templates/admin/screens/main.php)
-
tags/1.3.0/vendor/composer/autoload_psr4.php (copied) (copied from cache-warmer/trunk/vendor/composer/autoload_psr4.php)
-
tags/1.3.0/vendor/composer/autoload_real.php (copied) (copied from cache-warmer/trunk/vendor/composer/autoload_real.php)
-
tags/1.3.0/vendor/composer/autoload_static.php (copied) (copied from cache-warmer/trunk/vendor/composer/autoload_static.php)
-
tags/1.3.0/vendor/composer/installed.json (copied) (copied from cache-warmer/trunk/vendor/composer/installed.json)
-
tags/1.3.0/vendor/composer/installed.php (copied) (copied from cache-warmer/trunk/vendor/composer/installed.php)
-
tags/1.3.0/vendor/composer/jetpack_autoload_classmap.php (copied) (copied from cache-warmer/trunk/vendor/composer/jetpack_autoload_classmap.php)
-
tags/1.3.0/vendor/composer/jetpack_autoload_filemap.php (copied) (copied from cache-warmer/trunk/vendor/composer/jetpack_autoload_filemap.php)
-
tags/1.3.0/vendor/psr/http-factory/composer.json (copied) (copied from cache-warmer/trunk/vendor/psr/http-factory/composer.json)
-
tags/1.3.0/vendor/psr/http-factory/src/UploadedFileFactoryInterface.php (copied) (copied from cache-warmer/trunk/vendor/psr/http-factory/src/UploadedFileFactoryInterface.php)
-
tags/1.3.0/vendor/symfony/deprecation-contracts/README.md (copied) (copied from cache-warmer/trunk/vendor/symfony/deprecation-contracts/README.md)
-
tags/1.3.0/vendor/symfony/deprecation-contracts/composer.json (copied) (copied from cache-warmer/trunk/vendor/symfony/deprecation-contracts/composer.json)
-
tags/1.3.0/vendor/symfony/deprecation-contracts/function.php (copied) (copied from cache-warmer/trunk/vendor/symfony/deprecation-contracts/function.php)
-
tags/1.3.0/vendor/tmmtech/wp-plugins-core/readme.txt (copied) (copied from cache-warmer/trunk/vendor/tmmtech/wp-plugins-core/readme.txt)
-
tags/1.3.0/vendor/tmmtech/wp-plugins-core/src/class-action-scheduler.php (copied) (copied from cache-warmer/trunk/vendor/tmmtech/wp-plugins-core/src/class-action-scheduler.php)
-
tags/1.3.0/vendor/tmmtech/wp-plugins-core/src/class-notifications.php (copied) (copied from cache-warmer/trunk/vendor/tmmtech/wp-plugins-core/src/class-notifications.php)
-
tags/1.3.0/vendor/tmmtech/wp-plugins-core/src/class-wp-plugins-core.php (copied) (copied from cache-warmer/trunk/vendor/tmmtech/wp-plugins-core/src/class-wp-plugins-core.php)
-
tags/1.3.0/vendor/tmmtech/wp-plugins-core/wp-plugins-core.php (copied) (copied from cache-warmer/trunk/vendor/tmmtech/wp-plugins-core/wp-plugins-core.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/action-scheduler.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/action-scheduler.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/changelog.txt (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/changelog.txt)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/ActionScheduler_ActionFactory.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/ActionScheduler_AdminView.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/ActionScheduler_AdminView.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Store.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_TimezoneHelper.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/migration/ActionMigrator.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/migration/ActionMigrator.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/functions.php (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/functions.php)
-
tags/1.3.0/vendor/woocommerce/action-scheduler/readme.txt (copied) (copied from cache-warmer/trunk/vendor/woocommerce/action-scheduler/readme.txt)
-
trunk/cache-warmer.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/class-object-cache.php (modified) (1 diff)
-
trunk/src/class-warm-up.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cache-warmer/tags/1.3.0/cache-warmer.php
r3106098 r3106344 3 3 * Plugin Name: Cache Warmer 4 4 * Description: Visits website pages to warm (create) the cache if you have any caching solutions configured. 5 * Version: 1. 2.55 * Version: 1.3.0 6 6 * Text Domain: cache-warmer 7 7 * Author: TMM Technology -
cache-warmer/tags/1.3.0/readme.txt
r3106098 r3106344 3 3 Tags: cache, warming, cloudflare, redis, object cache 4 4 Tested up to: 6.5.4 5 Stable tag: 1. 2.55 Stable tag: 1.3.0 6 6 Requires PHP: 7.4 7 7 License: GPLv3 … … 50 50 == Changelog == 51 51 52 = 1.3.0 2024-06-24 = 53 54 #### Enhancements 55 56 * Speed up warmings (optimization). 57 58 #### Bugfixes 59 60 * Fix stuck object cache bug. 61 52 62 = 1.2.5 2024-06-23 = 53 63 -
cache-warmer/tags/1.3.0/src/class-object-cache.php
r3106098 r3106344 22 22 */ 23 23 public static function use_object_cache() { 24 return '1' === Cache_Warmer::$options->get( 'setting-use-object-cache' );24 return wp_using_ext_object_cache() && '1' === Cache_Warmer::$options->get( 'setting-use-object-cache' ); 25 25 } 26 26 } -
cache-warmer/tags/1.3.0/src/class-warm-up.php
r3081567 r3106344 650 650 651 651 /** 652 * Returns log content. 653 * 654 * @param string $warmed_at File name to get the log content for. 655 * @param int $for_last_minutes For how many minutes to get the fetches for. 652 * Returns the count of how many fetches were done for the warmup, for the last minute. 653 * 654 * @param array $visited_links The array of visited links. 656 655 * 657 656 * @return int Count. 658 657 */ 659 public static function how_many_fetches_were_done_for_the_warmup( $warmed_at, $for_last_minutes = 1) {660 global $wpdb;661 662 $logs_table = DB::get_tables_prefix() . 'warm_ups_logs';663 $ list_table = DB::get_tables_prefix() . 'warm_ups_list';664 665 $threshold = wp_date(666 'Y-m-d H:i:s',667 time() - MINUTE_IN_SECONDS * $for_last_minutes658 public static function how_many_fetches_were_done_for_the_warmup( array &$visited_links ) { 659 $current_time = time(); 660 661 // Remove timestamps older than 60 seconds. 662 $visited_links = array_filter( 663 $visited_links, 664 function ( $timestamp ) use ( $current_time ) { 665 return ( $current_time - $timestamp ) <= 60; 666 } 668 667 ); 669 668 670 $results = $wpdb->get_results( 671 $wpdb->prepare( 672 " 673 SELECT COUNT(*) 674 FROM $logs_table 675 INNER JOIN $list_table ON $logs_table.list_id=$list_table.id 676 WHERE $list_table.warmed_at = %s AND $logs_table.log_date >= %s 677 ", 678 $warmed_at, 679 $threshold 680 ), 681 ARRAY_N 682 ); 683 684 return (int) $results[0][0]; 669 // Add the current timestamp. 670 $visited_links[] = $current_time; 671 672 // Return the count of the visited links. 673 return count( $visited_links ); 685 674 } 686 675 … … 709 698 $meta = $data['meta']; 710 699 711 $warmup_start_date = $meta['start_date'];712 713 700 if ( ! array_key_exists( 'speed_limit', $meta ) ) { 714 701 $meta['speed_limit'] = 1000; … … 716 703 717 704 $speed_limit = &$meta['speed_limit']; 705 706 if ( ! array_key_exists( 'visited_links', $meta ) ) { 707 $meta['visited_links'] = []; 708 } 709 710 $visited_links = &$meta['visited_links']; 718 711 719 712 self::$failed_links_option_key = ! $warm_up_for_unscheduled ? … … 741 734 ++ $i <= self::BATCH_SIZE && // Or until batch size is hit. 742 735 // Or until the current speed is too fast and over the limit. 743 ( $how_many_fetches_were_done = self::how_many_fetches_were_done_for_the_warmup( $ warmup_start_date) ) < $speed_limit // @codingStandardsIgnoreLine736 ( $how_many_fetches_were_done = self::how_many_fetches_were_done_for_the_warmup( $visited_links ) ) < $speed_limit // @codingStandardsIgnoreLine 744 737 ) { 745 738 $first_link_data = Tree::get_the_first_leaf_data( $tree ); -
cache-warmer/trunk/cache-warmer.php
r3106098 r3106344 3 3 * Plugin Name: Cache Warmer 4 4 * Description: Visits website pages to warm (create) the cache if you have any caching solutions configured. 5 * Version: 1. 2.55 * Version: 1.3.0 6 6 * Text Domain: cache-warmer 7 7 * Author: TMM Technology -
cache-warmer/trunk/readme.txt
r3106098 r3106344 3 3 Tags: cache, warming, cloudflare, redis, object cache 4 4 Tested up to: 6.5.4 5 Stable tag: 1. 2.55 Stable tag: 1.3.0 6 6 Requires PHP: 7.4 7 7 License: GPLv3 … … 50 50 == Changelog == 51 51 52 = 1.3.0 2024-06-24 = 53 54 #### Enhancements 55 56 * Speed up warmings (optimization). 57 58 #### Bugfixes 59 60 * Fix stuck object cache bug. 61 52 62 = 1.2.5 2024-06-23 = 53 63 -
cache-warmer/trunk/src/class-object-cache.php
r3106098 r3106344 22 22 */ 23 23 public static function use_object_cache() { 24 return '1' === Cache_Warmer::$options->get( 'setting-use-object-cache' );24 return wp_using_ext_object_cache() && '1' === Cache_Warmer::$options->get( 'setting-use-object-cache' ); 25 25 } 26 26 } -
cache-warmer/trunk/src/class-warm-up.php
r3081567 r3106344 650 650 651 651 /** 652 * Returns log content. 653 * 654 * @param string $warmed_at File name to get the log content for. 655 * @param int $for_last_minutes For how many minutes to get the fetches for. 652 * Returns the count of how many fetches were done for the warmup, for the last minute. 653 * 654 * @param array $visited_links The array of visited links. 656 655 * 657 656 * @return int Count. 658 657 */ 659 public static function how_many_fetches_were_done_for_the_warmup( $warmed_at, $for_last_minutes = 1) {660 global $wpdb;661 662 $logs_table = DB::get_tables_prefix() . 'warm_ups_logs';663 $ list_table = DB::get_tables_prefix() . 'warm_ups_list';664 665 $threshold = wp_date(666 'Y-m-d H:i:s',667 time() - MINUTE_IN_SECONDS * $for_last_minutes658 public static function how_many_fetches_were_done_for_the_warmup( array &$visited_links ) { 659 $current_time = time(); 660 661 // Remove timestamps older than 60 seconds. 662 $visited_links = array_filter( 663 $visited_links, 664 function ( $timestamp ) use ( $current_time ) { 665 return ( $current_time - $timestamp ) <= 60; 666 } 668 667 ); 669 668 670 $results = $wpdb->get_results( 671 $wpdb->prepare( 672 " 673 SELECT COUNT(*) 674 FROM $logs_table 675 INNER JOIN $list_table ON $logs_table.list_id=$list_table.id 676 WHERE $list_table.warmed_at = %s AND $logs_table.log_date >= %s 677 ", 678 $warmed_at, 679 $threshold 680 ), 681 ARRAY_N 682 ); 683 684 return (int) $results[0][0]; 669 // Add the current timestamp. 670 $visited_links[] = $current_time; 671 672 // Return the count of the visited links. 673 return count( $visited_links ); 685 674 } 686 675 … … 709 698 $meta = $data['meta']; 710 699 711 $warmup_start_date = $meta['start_date'];712 713 700 if ( ! array_key_exists( 'speed_limit', $meta ) ) { 714 701 $meta['speed_limit'] = 1000; … … 716 703 717 704 $speed_limit = &$meta['speed_limit']; 705 706 if ( ! array_key_exists( 'visited_links', $meta ) ) { 707 $meta['visited_links'] = []; 708 } 709 710 $visited_links = &$meta['visited_links']; 718 711 719 712 self::$failed_links_option_key = ! $warm_up_for_unscheduled ? … … 741 734 ++ $i <= self::BATCH_SIZE && // Or until batch size is hit. 742 735 // Or until the current speed is too fast and over the limit. 743 ( $how_many_fetches_were_done = self::how_many_fetches_were_done_for_the_warmup( $ warmup_start_date) ) < $speed_limit // @codingStandardsIgnoreLine736 ( $how_many_fetches_were_done = self::how_many_fetches_were_done_for_the_warmup( $visited_links ) ) < $speed_limit // @codingStandardsIgnoreLine 744 737 ) { 745 738 $first_link_data = Tree::get_the_first_leaf_data( $tree );
Note: See TracChangeset
for help on using the changeset viewer.