Skip to content

Commit 32c61cb

Browse files
authored
Merge pull request #1086 from crstauf/fix-forum-17945942
Set `as_has_wp_comment_logs` option value to `no` rather than deleting
2 parents 2b53f9f + 6aaeacc commit 32c61cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

classes/ActionScheduler_WPCommentCleaner.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,23 @@ public static function has_logs() {
6666
* Attached to the migration complete hook 'action_scheduler/migration_complete'.
6767
*/
6868
public static function maybe_schedule_cleanup() {
69+
$has_logs = 'no';
70+
6971
$args = array(
7072
'type' => ActionScheduler_wpCommentLogger::TYPE,
7173
'number' => 1,
7274
'fields' => 'ids',
7375
);
7476

7577
if ( (bool) get_comments( $args ) ) {
76-
update_option( self::$has_logs_option_key, 'yes' );
78+
$has_logs = 'yes';
7779

7880
if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) {
7981
as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook );
8082
}
8183
}
84+
85+
update_option( self::$has_logs_option_key, $has_logs, true );
8286
}
8387

8488
/**
@@ -95,7 +99,7 @@ public static function delete_all_action_comments() {
9599
)
96100
);
97101

98-
delete_option( self::$has_logs_option_key );
102+
update_option( self::$has_logs_option_key, 'no', true );
99103
}
100104

101105
/**

0 commit comments

Comments
 (0)