VE-1497: Created MediaWiki API method that delivers list of templates based on passed query

This method is meant to be used within newly developed template tool in VisualEditor.
Its behavior is specifically described in JIRA ticket.

https://wikia-inc.atlassian.net/browse/VE-1433
https://wikia-inc.atlassian.net/browse/VE-1497
VE-1497: Removed unnecessary count check
VE-1497: Fixed typo in method comment: user -> used
VE-1497: Performance optimization - cache locally count result
Merge pull request #4878 from Wikia/VE-1497

VE-1497: Created MediaWiki API method that delivers list of templates based on passed query