Automattic\WooCommerce\Internal\Admin\Logging\FileV2
FileController::get_files_by_id
Get one or more File instances from an array of file IDs.
Метод класса: FileController{}
Хуков нет.
Возвращает
File[].
Использование
$FileController = new FileController(); $FileController->get_files_by_id( $file_ids ): array;
- $file_ids(массив) (обязательный)
- An array of file IDs (file basename without the hash).
Код FileController::get_files_by_id() FileController::get files by id WC 10.7.0
public function get_files_by_id( array $file_ids ): array {
$log_directory = Settings::get_log_directory();
$paths = array();
foreach ( $file_ids as $file_id ) {
// Look for the standard filename format first, which includes a hash.
$glob = glob( $log_directory . $file_id . '-*.log' );
if ( ! $glob ) {
$glob = glob( $log_directory . $file_id . '.log' );
}
if ( is_array( $glob ) ) {
$paths = array_merge( $paths, $glob );
}
}
$files = $this->convert_paths_to_objects( array_unique( $paths ) );
return $files;
}