Automattic\WooCommerce\Internal\Logging
OrderLogsCleanupHelper::cleanup_old_log_files
Delete a batch of place-order-debug-* log files from the filesystem.
Method of the class: OrderLogsCleanupHelper{}
No Hooks.
Returns
true|false. True if there may be more files left to delete.
Usage
// private - for code of main (parent) class only $result = $this->cleanup_old_log_files( $max_age ): bool;
- $max_age(int) (required)
- Maximum age in seconds before a file is eligible for deletion.
OrderLogsCleanupHelper::cleanup_old_log_files() OrderLogsCleanupHelper::cleanup old log files code WC 11.0.1
private function cleanup_old_log_files( int $max_age ): bool {
$deleted = wc_get_container()->get( FileController::class )->delete_stale_files(
'place-order-debug',
time() - $max_age,
self::MAX_FILES_PER_RUN
);
return self::MAX_FILES_PER_RUN === $deleted;
}