Files
Orchard/src/Orchard.Web/Modules/Orchard.PackageManager/Services/BackgroundPackageUpdateTask.cs
Andre Rodrigues 6050e585be Integrating package manager for package updates.
--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
2011-02-18 08:21:19 -08:00

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());
}
}
}