← All changes
|
vendor/woocommerce/action-scheduler/classes/ActionScheduler_WPCommentCleaner.php
+2
-6
1.6.5
→
trunk
View file →
| @@ -65,10 +65,8 @@ | ||
| 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 | - $has_logs = 'no'; | |
| 70 | - | |
| 71 | 69 | $args = array( |
| 72 | 70 | 'type' => ActionScheduler_wpCommentLogger::TYPE, |
| 73 | 71 | 'number' => 1, |
| 74 | 72 | 'fields' => 'ids', |
| @@ -74,16 +72,14 @@ | ||
| 74 | 72 | 'fields' => 'ids', |
| 75 | 73 | ); |
| 76 | 74 | |
| 77 | 75 | if ( (bool) get_comments( $args ) ) { |
| 78 | - $has_logs = 'yes'; | |
| 76 | + update_option( self::$has_logs_option_key, 'yes' ); | |
| 79 | 77 | |
| 80 | 78 | if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) { |
| 81 | 79 | as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook ); |
| 82 | 80 | } |
| 83 | 81 | } |
| 84 | - | |
| 85 | - update_option( self::$has_logs_option_key, $has_logs, true ); | |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | 84 | /** |
| 89 | 85 | * Delete all action comments from the WP Comments table. |
| @@ -98,9 +94,9 @@ | ||
| 98 | 94 | 'comment_agent' => ActionScheduler_wpCommentLogger::AGENT, |
| 99 | 95 | ) |
| 100 | 96 | ); |
| 101 | 97 | |
| 102 | - update_option( self::$has_logs_option_key, 'no', true ); | |
| 98 | + delete_option( self::$has_logs_option_key ); | |
| 103 | 99 | } |
| 104 | 100 | |
| 105 | 101 | /** |
| 106 | 102 | * Registers admin notices about the orphaned action logs. |