Reorganise the functions doing wfProfileOut and returning on all if branches.

Makes life easier for static analysis, since they don't need to
handle if the end of a function where a wfProfileOut was not called
was reachable or not.

It is recommended to review this change ignoring whitespaces
(specially for includes/parser/Tidy.php)

Also documented the rationale for the elseif chain in UploadBase::detectVirus()

Change-Id: Ic4f65937fa9e6f926d8fcfd670e3b0e99e06eefc
Merge "Reorganise the functions doing wfProfileOut and returning on all if branches."