Avoid unnecessary processing when data is empty

This avoids unnecessary calls when it is known that no semantic data are available.

InternalParseBeforeLinks will indicate whether semantic data have been processed or not, this is especially important where MessageCache->parse() runs through the same parser hooks or when edit mode is processed.

- This resolves the ambiguate case of $title->inNamespace( NS_FILE ).
- Use defined( 'CONTENT_MODEL_WIKITEXT' ) instead of class_exists( 'ContentHandler' )
to avoid having the autoloader being executed which decreases the check from 100 ms to 0.1 ms
- Solves the issue with ApprovedRevs (doPurge executed by ApprovedRevs) when it sends an
empty ParserOutput object