Automattic\WooCommerce\Internal\Admin\Logging

Settings::get_retention_period()publicWC 1.0

Determine the current value of the retention_period_days setting.

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

Хуки из метода

Возвращает

int.

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

$Settings = new Settings();
$Settings->get_retention_period(): int;

Код Settings::get_retention_period() WC 9.7.1

public function get_retention_period(): int {
	$key = self::PREFIX . 'retention_period_days';

	$retention_period = self::DEFAULTS['retention_period_days'];

	if ( has_filter( 'woocommerce_logger_days_to_retain_logs' ) ) {
		/**
		 * Filter the retention period of log entries.
		 *
		 * @param int $days The number of days to retain log entries.
		 *
		 * @since 3.4.0
		 */
		$retention_period = apply_filters( 'woocommerce_logger_days_to_retain_logs', $retention_period );
	} else {
		$retention_period = WC_Admin_Settings::get_option( $key );
	}

	$retention_period = absint( $retention_period );

	if ( $retention_period < 1 ) {
		$retention_period = self::DEFAULTS['retention_period_days'];
	}

	return $retention_period;
}