PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / trunk
Image Optimizer – Compress Images and Convert to WebP or AVIF vtrunk
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
← All changes | vendor/woocommerce/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php +19 -5 1.4.1 → trunk View file →
@@ -41,12 +41,12 @@
41 41 add_action( self::$cleanup_hook, array( __CLASS__, 'delete_all_action_comments' ) );
42 42
43 43 // While there are orphaned logs left in the comments table, we need to attach the callbacks which filter comment counts.
44 44 add_action( 'pre_get_comments', array( self::$wp_comment_logger, 'filter_comment_queries' ), 10, 1 );
45 - add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
45 + add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs.
46 46 add_action( 'comment_feed_where', array( self::$wp_comment_logger, 'filter_comment_feed' ), 10, 2 );
47 47
48 - // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen
48 + // Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen.
49 49 add_action( 'load-tools_page_action-scheduler', array( __CLASS__, 'register_admin_notice' ) );
50 50 add_action( 'load-woocommerce_page_wc-status', array( __CLASS__, 'register_admin_notice' ) );
51 51 }
52 52
@@ -65,9 +65,15 @@
65 65 * Schedules the WP Post comment table cleanup to run in 6 months if it's not already scheduled.
66 66 * Attached to the migration complete hook 'action_scheduler/migration_complete'.
67 67 */
68 68 public static function maybe_schedule_cleanup() {
69 - if ( (bool) get_comments( array( 'type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids' ) ) ) {
69 + $args = array(
70 + 'type' => ActionScheduler_wpCommentLogger::TYPE,
71 + 'number' => 1,
72 + 'fields' => 'ids',
73 + );
74 +
75 + if ( (bool) get_comments( $args ) ) {
70 76 update_option( self::$has_logs_option_key, 'yes' );
71 77
72 78 if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) {
73 79 as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook );
@@ -79,9 +85,17 @@
79 85 * Delete all action comments from the WP Comments table.
80 86 */
81 87 public static function delete_all_action_comments() {
82 88 global $wpdb;
83 - $wpdb->delete( $wpdb->comments, array( 'comment_type' => ActionScheduler_wpCommentLogger::TYPE, 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT ) );
89 +
90 + $wpdb->delete(
91 + $wpdb->comments,
92 + array(
93 + 'comment_type' => ActionScheduler_wpCommentLogger::TYPE,
94 + 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT,
95 + )
96 + );
97 +
84 98 delete_option( self::$has_logs_option_key );
85 99 }
86 100
87 101 /**
@@ -89,9 +103,9 @@
89 103 */
90 104 public static function register_admin_notice() {
91 105 add_action( 'admin_notices', array( __CLASS__, 'print_admin_notice' ) );
92 106 }
93 -
107 +
94 108 /**
95 109 * Prints details about the orphaned action logs and includes information on where to learn more.
96 110 */
97 111 public static function print_admin_notice() {