Support » Plugin: Task Scheduler » [bug] Nice plugin with interesting glitch

  • Hi – great plugin, thanks for putting in all the hard work!

    It has a weird glitch though: tasks won’t be scheduled for Mondays. Now I’d understand if the plugin would like to take a break on weekends – but Monday?! ๐Ÿ™‚

    How to reproduce: Schedule task for “daily” execution but check only the “Monday” box. Voila – next execution will be scheduled for Sunday!

    Please let me know where this can be fixed: There are so many files and folders. Thanks a lot!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author miunosoft



    Cannot reproduce it. Maybe you should check your site timezone.


    If it was my timezone, I’d have the problem with every day, no?

    Here’s what I get: Setting execution to next…

    …Saturday. Next Run Time: 2017/06/10
    …Sunday. Next Run Time: 2017/06/11
    …Monday. Next Run Time: 2017/06/11
    …Tuesday. Next Run Time: 2017/06/06

    Tried different times of the day – same result.

    If you don’t see anything worth fixing, could you please point me to the relevant section in your code? Then I can look into it myself. Thanks!

    Plugin Author miunosoft


    It’s not that I don’t see anything worth fixing but anything having a problem.

    Anyway, if you need to look at the code, maybe you want to check these parts.

    – The line that displays the next run time:

    – The line that detemines the next run time for the daily occurrence type.

    The time is stored as a unix timestamp without any timezone offset. Hope this helps.

    Thanks for the quick replies.

    It seems like the problem may not be with Monday specifically, but with scheduling exactly one week ahead. So while the problem is with Monday today, my guess is that it’ll be with Tuesday tomorrow.

    Glitch is probably somewhere in your function _getNextClosestTime in TaskScheduler_Occurrence_Daily.php where you “remove today’s day from the array”. Seems like doing that somehow breaks the counter, which is why the task that is supposed to run next Monday is actually scheduled for Sunday.

    I’ll look into this some more tomorrow when/if my prediction comes true. If not, I’ll have to rethink my theory. ๐Ÿ˜‰

    Ok seems like I was on the right track…

    _getNextClosestTime() removes the current day from the equation. In the next step, _getNumberOfDaysToClosestDay() can’t find the correct day (“Monday” is missing now) and returns the default “6” in line 231. Changing that value to “7” seems to fix the problem.

    Plugin Author miunosoft


    Sounds like you found something. If you don’t mind, can you post this on the issue tracker of the project repository? Thank you.

    Done. Thanks again for the quick responses.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[bug] Nice plugin with interesting glitch’ is closed to new replies.