Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed an infinite loop in schedule item. #5378

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 77 additions & 1 deletion DNN Platform/Library/Services/Scheduling/ScheduleItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace DotNetNuke.Services.Scheduling
using DotNetNuke.Entities;
using DotNetNuke.Entities.Modules;

/// <summary>
/// Represents one item in the scheduler.
/// </summary>
[Serializable]
public class ScheduleItem : BaseEntityInfo, IHydratable
{
Expand Down Expand Up @@ -40,16 +43,34 @@ public ScheduleItem()
this.ScheduleStartDate = Null.NullDate;
}

/// <summary>
/// Gets or sets the the event this item attaches to.
/// </summary>
public string AttachToEvent { get; set; }

/// <summary>
/// Gets or sets a value indicating whether cath-up is enabled.
/// </summary>
public bool CatchUpEnabled { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the item is enabled.
/// </summary>
public bool Enabled { get; set; }

/// <summary>
/// Gets or sets the schedule start date.
/// </summary>
public DateTime ScheduleStartDate { get; set; }

/// <summary>
/// Gets or sets the friednly name for the item.
/// </summary>
public string FriendlyName { get; set; }

/// <summary>
/// Gets or sets the next start date.
/// </summary>
public virtual DateTime NextStart
{
get
Expand All @@ -64,32 +85,68 @@ public virtual DateTime NextStart

set
{
this.NextStart = value;
this.nextStart = value;
}
}

/// <summary>
/// Gets or sets the object dependencies.
/// </summary>
public string ObjectDependencies { get; set; }

/// <summary>
/// Gets or sets a value indicating how many history items to keep.
/// </summary>
public int RetainHistoryNum { get; set; }

/// <summary>
/// Gets or sets the retry time lapse value.
/// </summary>
public int RetryTimeLapse { get; set; }

/// <summary>
/// Gets or sets the unit of measure for the retry time lapse value.
/// </summary>
public string RetryTimeLapseMeasurement { get; set; }

/// <summary>
/// Gets or sets the ID of the scheduled item.
/// </summary>
public int ScheduleID { get; set; }

/// <summary>
/// Gets or sets the servers this task should run on.
/// </summary>
public string Servers { get; set; }

/// <summary>
/// Gets or sets the recurrence time lapse value.
/// </summary>
public int TimeLapse { get; set; }

/// <summary>
/// Gets or sets the unit of measure for the recurrence time lapse value.
/// </summary>
public string TimeLapseMeasurement { get; set; }

/// <summary>
/// Gets or sets the full type name.
/// </summary>
public string TypeFullName { get; set; }

/// <summary>
/// Gets or sets the process group.
/// </summary>
public int ProcessGroup { get; set; }

/// <summary>
/// Gets or sets the <see cref="ScheduleSource"/>.
/// </summary>
public ScheduleSource ScheduleSource { get; set; }

/// <summary>
/// Gets or sets the ID of the running thread.
/// </summary>
public int ThreadID { get; set; }

/// <inheritdoc/>
Expand All @@ -112,6 +169,11 @@ public virtual void Fill(IDataReader dr)
this.FillInternal(dr);
}

/// <summary>
/// Gets or sets a value indicating whether the item has object dependencies.
/// </summary>
/// <param name="strObjectDependencies">A string representing the name of the object dependencies.</param>
/// <returns>A value indicating whether the item has object dependencies.</returns>
public bool HasObjectDependencies(string strObjectDependencies)
{
if (strObjectDependencies.IndexOf(",") > -1)
Expand All @@ -135,11 +197,21 @@ public bool HasObjectDependencies(string strObjectDependencies)
return false;
}

/// <summary>
/// Adds a schedule item setting value.
/// </summary>
/// <param name="key">The setting key.</param>
/// <param name="value">The value of the setting.</param>
public void AddSetting(string key, string value)
{
this.scheduleItemSettings.Add(key, value);
}

/// <summary>
/// Gets a specific setting.
/// </summary>
/// <param name="key">The key of the setting to get.</param>
/// <returns>The value of the setting.</returns>
public virtual string GetSetting(string key)
{
if (this.scheduleItemSettings == null)
Expand All @@ -157,6 +229,10 @@ public virtual string GetSetting(string key)
}
}

/// <summary>
/// Gets all the item settings.
/// </summary>
/// <returns>An <see cref="Hashtable"/> of all the settings.</returns>
public virtual Hashtable GetSettings()
{
this.scheduleItemSettings = SchedulingProvider.Instance().GetScheduleItemSettings(this.ScheduleID);
Expand Down