Automattic\WooCommerce\Internal\DataStores\Orders
LegacyDataCleanup::toggle_flag
Sets the flag that indicates that the cleanup process should be initiated.
Method of the class: LegacyDataCleanup{}
No Hooks.
Returns
true|false. Whether the legacy data cleanup was initiated or not.
Usage
$LegacyDataCleanup = new LegacyDataCleanup(); $LegacyDataCleanup->toggle_flag( $enabled ): bool;
- $enabled(true|false) (required)
- TRUE if the process should be initiated, FALSE if it should be canceled.
LegacyDataCleanup::toggle_flag() LegacyDataCleanup::toggle flag code WC 10.4.3
public function toggle_flag( bool $enabled ): bool {
if ( $enabled && $this->can_run() ) {
$this->batch_processing->enqueue_processor( self::class );
return true;
} else {
$this->batch_processing->remove_processor( self::class );
return $enabled ? false : true;
}
}