WC_Log_Handler_File::delete_logs_before_timestamp( integer $timestamp )
Delete all logs older than a defined timestamp.
Description Description
Parameters Parameters
- $timestamp
-
(Required) Timestamp to delete logs before.
Source Source
File: includes/log-handlers/class-wc-log-handler-file.php
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. } } }
Changelog Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |