[TYPO3-core] RFC #16611: Bug: [scheduler] tx_scheduler_CronCmd needs refactoring
Christian Kuhn
lolli at schwarzbu.ch
Sun Dec 5 18:30:10 CET 2010
This is an SVN patch request.
Type: bugfix
Branches: trunk
BT: http://bugs.typo3.org/view.php?id=16611
Problem:
The scheduler cron command parser complex, hard to unterstand and still
has several bugs.
Solution:
Rewrite from scratch.
Notes:
- The new code has very high unit test code coverage, we're now counting
286 assertions for this extension.
- This patch introduces a new class which 'normalizes' a given cron
command. The class implements the full cron command syntax as documented
eg. in vixiecron. Take a look at the unit tests to see what is possible.
- The cron command normalizer throws exceptions if something is wrong
with the command. So it can be easily used in the scheduler backend to
validate a command (with another RFC).
- After the cron command normalizer was successfully run, the cron
command just consists of a list of comma separated integers or the
character '*' for each field.
- The CronCmd class itself, and especially the recursive method
calculateNextValue() was rewritten and is now much more simple to
understand and should be pretty easy to maintain. The strategy is to
increment the given timestamp until all cron command restrictions match.
- As you might guess, this took me quite some hours to get it right. I'm
pretty sure all important things are ok, even things like a cron command
timed on every leap year is handled. Still, even with so many unit tests
I'm not 100% sure it's bugfree.
Regards
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 16611_01.diff
Type: text/x-patch
Size: 65701 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101205/f8f45e5f/attachment-0001.bin>
More information about the TYPO3-team-core
mailing list