Automattic\WooCommerce\Internal\Logging

OrderLogsCleanupHelper::cleanup_old_log_files │ private │ WC 1.0

Delete a batch of place-order-debug-* log files from the filesystem.

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

Хуков нет.

Возвращает

bool. True if there may be more files left to delete.

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

// private - только в коде основоного (родительского) класса
$result = $this->cleanup_old_log_files( $max_age ): bool;
$max_age(int) (обязательный)
Maximum age in seconds before a file is eligible for deletion.

Код OrderLogsCleanupHelper::cleanup_old_log_files() WC 11.2.2

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;
}