Automattic\WooCommerce\Internal\Admin\Logging\FileV2

File::generate_file_id()public staticWC 1.0

Generate a public ID for a log file based on its properties.

The file ID is the basename of the file without the hash part. It allows us to identify a file without revealing its full name in the filesystem, so that it's difficult to access the file directly with an HTTP request.

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

Хуков нет.

Возвращает

Строку.

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

$result = File::generate_file_id( $source, ?int $rotation, $created ): string;
$source(строка) (обязательный)
The source of the log entries contained in the file.
?int $rotation **
-
По умолчанию: null
$created(int)
The date the file was created, as a Unix timestamp.

Код File::generate_file_id() WC 9.7.1

public static function generate_file_id( string $source, ?int $rotation = null, int $created = 0 ): string {
	$file_id = static::sanitize_source( $source );

	if ( ! is_null( $rotation ) ) {
		$file_id .= '.' . $rotation;
	}

	if ( $created > 0 ) {
		$file_id .= '-' . gmdate( 'Y-m-d', $created );
	}

	return $file_id;
}