This is a fixed version for RegenerateCachedImagesTask (former FlushGeneratedImagesTask) such that it regenerates images instead of silently removing them and breaking existing pages

The pull request also contains some enhancements and fixes to the corresponding testcases.

Fixes #318
Merge pull request #1723 from NicoHaase/master

[API] Fixed version for RegenerateCachedImagesTask (former FlushGeneratedImagesTask)