WC_Logger::clear_expired_logs() public WC 3.4.0
Clear all logs older than a defined number of days. Defaults to 30 days.
{} Это метод класса: WC_Logger{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$WC_Logger = new WC_Logger(); $WC_Logger->clear_expired_logs();
Список изменений
С версии 3.4.0 | Введена. |
Код WC_Logger::clear_expired_logs() WC Logger::clear expired logs WC 5.0.0
public function clear_expired_logs() {
$days = absint( apply_filters( 'woocommerce_logger_days_to_retain_logs', 30 ) );
$timestamp = strtotime( "-{$days} days" );
foreach ( $this->handlers as $handler ) {
if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
$handler->delete_logs_before_timestamp( $timestamp );
}
}
}