mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00

--HG-- branch : dev rename : src/Orchard.Web/Modules/Orchard.Packaging/Services/NugetLogger.cs => src/Orchard.Web/Modules/Orchard.Packaging/Models/NugetLogger.cs rename : src/Orchard.Web/Modules/Orchard.Packaging/Services/PackageData.cs => src/Orchard.Web/Modules/Orchard.Packaging/Models/PackageData.cs rename : src/Orchard.Web/Modules/Orchard.Packaging/Services/PackagingEntry.cs => src/Orchard.Web/Modules/Orchard.Packaging/Models/PackagingEntry.cs
32 lines
1.5 KiB
C#
32 lines
1.5 KiB
C#
using Orchard.Packaging.Services;
|
|
using Orchard.Tasks;
|
|
|
|
namespace Orchard.PackageManager.Services {
|
|
/// <summary>
|
|
/// Background task responsible for fetching feeds from the Gallery into the
|
|
/// BackgroundPackageUpdateStatus singleton dependency.
|
|
/// The purpose is to make sure we don't block the Admin panel the first time
|
|
/// it's accessed when the PackageManager feature is enabled. The first time
|
|
/// the panel is accessed, the list of updates will be empty. It will be non empty
|
|
/// only if the user asks for an explicit refresh or after the first background
|
|
/// task sweep.
|
|
/// </summary>
|
|
public class BackgroundPackageUpdateTask : IBackgroundTask {
|
|
private readonly IPackageUpdateService _packageUpdateService;
|
|
private readonly IPackagingSourceManager _packagingSourceManager;
|
|
private readonly IBackgroundPackageUpdateStatus _backgroundPackageUpdateStatus;
|
|
|
|
public BackgroundPackageUpdateTask(IPackageUpdateService packageUpdateService,
|
|
IPackagingSourceManager packagingSourceManager,
|
|
IBackgroundPackageUpdateStatus backgroundPackageUpdateStatus) {
|
|
|
|
_packageUpdateService = packageUpdateService;
|
|
_packagingSourceManager = packagingSourceManager;
|
|
_backgroundPackageUpdateStatus = backgroundPackageUpdateStatus;
|
|
}
|
|
|
|
public void Sweep() {
|
|
_backgroundPackageUpdateStatus.Value = _packageUpdateService.GetPackagesStatus(_packagingSourceManager.GetSources());
|
|
}
|
|
}
|
|
} |