Fixed bug #13193: Day of week in scheduler cron command is not calculated correctly
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 7 Feb 2010 19:57:19 +0000 (19:57 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 7 Feb 2010 19:57:19 +0000 (19:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6865 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/class.tx_scheduler_croncmd.php

index fd4d610..3c895bb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-02-07  Christian Kuhn  <lolli@schwarzbu.ch>
 
+       * Fixed bug #13193: Day of week in scheduler cron command is not calculated correctly
        * Added feature #12859: caching framework db backend: Use t3lib_db to insert all tags in one run
 
 2010-02-07  Xavier Perseguers  <typo3@perseguers.ch>
index 68734f7..bdb1fc4 100644 (file)
@@ -193,7 +193,15 @@ class tx_scheduler_CronCmd {
                $validDays = $this->getList($this->cmd_sections[2], 1, $max_days);
 
                        // Consider special field 'day of week'
-               if ($this->cmd_sections[2] != '*' && (strpos($this->cmd_sections[4], '*') === false && preg_match('/[1-7]{1}/', $this->cmd_sections[4]) !== false)) {
+                       // @TODO: Implement lists and ranges for day of week (2,3 and 1-5 and */2,3 and 1,1-5/2)
+                       // @TODO: Support usage of day names in day of week field ("mon", "sun", etc.)
+               if ((strpos($this->cmd_sections[4], '*') === FALSE && preg_match('/[1-7]{1}/', $this->cmd_sections[4]) !== FALSE)) {
+                               // Unset days from 'day of month' if * is given
+                               // * * * * 1 results to every monday of this month
+                               // * * 1,2 * 1 results to every monday, plus first and second day of month
+                       if ($this->cmd_sections[2] == '*') {
+                               $validDays = array();
+                       }
                                // Get list
                        for ($i = 1; $i <= $max_days; $i++) {
                                if (strftime('%u', mktime(0, 0, 0, $currentMonth, $i, $currentYear)) == $this->cmd_sections[4]) {