Fix for #5619: log message is duplicated for 'flushInterval' = 1 and 'exportInterval' = 1

Fix for #5619: log message is duplicated for 'flushInterval' = 1 and 'exportInterval' = 1

`yii\log\Logger::flush()` updated to reset messages before passing them to the dispatcher. This prevents same message to be processed twice.
Due to PHP internal optimization extra copy of `$this->messages` does not incease the memory usage, so it should be all fine.