Updates and support for re-use of CMS logic in Deploy (#14990)

* Adds additional parameter to IFileSource.GetFilesAsync allowing the caller to continue on a file not found exception.

* Moved redirect tracking and creation logic out of handler into a service, allowing for re-use in Deploy.

* Reverted breaking change in IFileSource by obsoleting old method and
This commit is contained in:
Andy Butland
2023-10-31 12:38:44 +01:00
committed by GitHub
parent 53b87cb78c
commit d08d141bcf
5 changed files with 179 additions and 164 deletions

View File

@@ -68,18 +68,24 @@ public interface IFileSource
/// <param name="fileTypes">A collection of file types which can store the files.</param>
void GetFiles(IEnumerable<StringUdi> udis, IFileTypeCollection fileTypes);
// TODO (V14): Remove obsolete method and default implementation for GetFilesAsync overloads.
/// <summary>
/// Gets files and store them using a file store.
/// </summary>
/// <param name="udis">The udis of the files to get.</param>
/// <param name="fileTypes">A collection of file types which can store the files.</param>
/// <param name="token">A cancellation token.</param>
[Obsolete("Please use the method overload taking all parameters. This method overload will be removed in Umbraco 14.")]
Task GetFilesAsync(IEnumerable<StringUdi> udis, IFileTypeCollection fileTypes, CancellationToken token);
///// <summary>
///// Gets the content of a file as a bytes array.
///// </summary>
///// <param name="Udi">A file entity identifier.</param>
///// <returns>A byte array containing the file content.</returns>
// byte[] GetFileBytes(StringUdi Udi);
/// <summary>
/// Gets files and store them using a file store.
/// </summary>
/// <param name="udis">The udis of the files to get.</param>
/// <param name="fileTypes">A collection of file types which can store the files.</param>
/// <param name="continueOnFileNotFound">A flag indicating whether to continue if a file isn't found or to stop and throw a FileNotFoundException.</param>
/// <param name="token">A cancellation token.</param>
Task GetFilesAsync(IEnumerable<StringUdi> udis, IFileTypeCollection fileTypes, bool continueOnFileNotFound, CancellationToken token)
=> GetFilesAsync(udis, fileTypes, token);
}