WC_Logger::clear_expired_logs()publicWC 1.0

Clear all logs older than a defined number of days. Defaults to 30 days.

Метод класса: WC_Logger{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Logger = new WC_Logger();
$WC_Logger->clear_expired_logs();

Код WC_Logger::clear_expired_logs() WC 8.9.0

public function clear_expired_logs() {
	$days      = LoggingUtil::get_retention_period();
	$timestamp = strtotime( "-{$days} days" );

	foreach ( $this->get_handlers() as $handler ) {
		if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
			$handler->delete_logs_before_timestamp( $timestamp );
		}
	}
}