Skip to content

Commit

Permalink
Merge pull request #656 from timopollmeier/ical-fix-master
Browse files Browse the repository at this point in the history
Use iCalendar more instead of old period fields (master)
  • Loading branch information
mattmundell authored Jul 31, 2019
2 parents 21a48a4 + 8fd54e5 commit cbc0f8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed
- Fix iCalendar recurrence and timezone handling [#654](https://github.com/greenbone/gvmd/pull/654)
- Fix issues with some scheduled tasks by using iCalendar more instead of old period fields [#656](https://github.com/greenbone/gvmd/pull/655)

### Removed
- The handling of NVT updates via OTP has been removed. [#575](https://github.com/greenbone/gvmd/pull/575)
Expand Down
27 changes: 9 additions & 18 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -20070,11 +20070,7 @@ set_task_schedule (task_t task, schedule_t schedule, int periods)
sql ("UPDATE tasks"
" SET schedule = %llu,"
" schedule_periods = %i,"
" schedule_next_time = (SELECT next_time (first_time,"
" period,"
" period_months,"
" byday,"
" timezone)"
" schedule_next_time = (SELECT next_time_ical (icalendar, timezone)"
" FROM schedules"
" WHERE id = %llu),"
" modification_time = m_now ()"
Expand Down Expand Up @@ -20102,11 +20098,7 @@ set_task_schedule_uuid (const gchar *task_id, schedule_t schedule, int periods)
sql ("UPDATE tasks"
" SET schedule = %llu,"
" schedule_periods = %i,"
" schedule_next_time = (SELECT next_time (first_time,"
" period,"
" period_months,"
" byday,"
" timezone)"
" schedule_next_time = (SELECT next_time_ical (icalendar, timezone)"
" FROM schedules"
" WHERE id = %llu),"
" modification_time = m_now ()"
Expand Down Expand Up @@ -20545,9 +20537,9 @@ clear_duration_schedules (task_t task)
" modification_time = m_now ()"
" WHERE schedule > 0"
"%s"
" AND (SELECT period FROM schedules WHERE schedules.id = schedule) = 0"
" AND (SELECT period_months FROM schedules"
" WHERE schedules.id = schedule) = 0"
" AND NOT (SELECT icalendar LIKE '%%\nRRULE%%'"
" OR icalendar LIKE '%%\nRDATE%%'"
" FROM schedules WHERE schedules.id = schedule)"
" AND (SELECT duration FROM schedules WHERE schedules.id = schedule) > 0"
"%s"
" AND run_status != %i"
Expand Down Expand Up @@ -20582,8 +20574,7 @@ update_duration_schedule_periods (task_t task)
duration_expired_element
= /* The task has started, so assume that the start time was the last
* most recent start of the period. */
" AND (SELECT next_time (first_time, period, period_months, byday,"
" timezone, -1)"
" AND (SELECT next_time_ical (icalendar, timezone, -1)"
" + duration"
" FROM schedules"
" WHERE schedules.id = schedule)"
Expand All @@ -20596,9 +20587,9 @@ update_duration_schedule_periods (task_t task)
" WHERE schedule > 0"
"%s"
" AND schedule_periods = 1"
" AND ((SELECT period FROM schedules WHERE schedules.id = schedule) > 0"
" OR (SELECT period_months FROM schedules"
" WHERE schedules.id = schedule) > 0)"
" AND (SELECT icalendar LIKE '%%\nRRULE%%'"
" OR icalendar LIKE '%%\nRDATE%%'"
" FROM schedules WHERE schedules.id = schedule)"
" AND (SELECT duration FROM schedules WHERE schedules.id = schedule) > 0"
" AND schedule_next_time = 0" /* Set as flag when starting task. */
"%s"
Expand Down

0 comments on commit cbc0f8e

Please sign in to comment.