VE-1747: Fix PHP errors, introduce config classes

Ported ConfigFactory and related classes
No longer checking MW version