WordPress at Your Fingertips
function is not described

WC_Log_Handler_File::delete_logs_before_timestamp() public WC 3.4.0

Delete all logs older than a defined timestamp.

{} It's a method of the class: WC_Log_Handler_File{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Log_Handler_File::delete_logs_before_timestamp( $timestamp );
$timestamp(int)
Timestamp to delete logs before.

Changelog

Since 3.4.0 Introduced.

Code of WC_Log_Handler_File::delete_logs_before_timestamp() WC 5.8.0

public static function delete_logs_before_timestamp( $timestamp = 0 ) {
	if ( ! $timestamp ) {
		return;
	}

	$log_files = self::get_log_files();

	foreach ( $log_files as $log_file ) {
		$last_modified = filemtime( trailingslashit( WC_LOG_DIR ) . $log_file );

		if ( $last_modified < $timestamp ) {
			@unlink( trailingslashit( WC_LOG_DIR ) . $log_file ); // @codingStandardsIgnoreLine.
		}
	}
}