Minerva and Vector are duplicating code in various places. If left unchecked that's going to be a lot of additional code we need to maintain after the project has completed. Change now will help us reduce time wasted maintaining and updating skins in future. For example right now adding a link to the footer will require changes in two places rather than one!
Now we are using Mustache, VectorTemplate has become a bit of redundant. There are many problems with the existing skin architecture, in particular the relationship between VectorTemplate and SkinVector. This adds unnecessary confusion and indirection.
Among the problems:
- there is lots of indirection (and about 900 lines of code inherited),
- The naming! VectorTemplate extends BaseTemplate (which then extends QuickTemplate) and SkinVector extends SkinTemplate. VectorTemplate DOES NOT extend SkinTemplate!
- There is no longer a benefit to set and get when you are using Mustache
- BaseTemplate and QuickTemplate come with extra public APIs that the subclass (VectorTemplate) must not break. Notably, /** @var array */ public $data;, This makes many refactors dangerous and challenging.
Move Vector away from VectorTemplate with some minimal changes in MediaWiki core.
Changes needed:
- Several functions in includes/skins/BaseTemplate.php would be moved to static functions so they can be used directly in SkinVector.
- SkinTemplate::setupTemplateForOutput currently does a lot of initialisation of private class variables. I'd like to move those to the constructor
- An html method will be pulled out and used by outputPage to allow a Skin to not use a BaseTemplate
- (Optional) a few helper classes will be added to SkinTemplate to refactor the very long prepareQuickTemplate function
- Slowly methods and properties will be migrated safely to the new SkinVectorTemplate class to mitigate risk. e.g. https://gerrit.wikimedia.org/r/597133
- VectorTemplate will be renamed SkinTemplateVector and made to extend SkinVector. Some deprecated hooks may need to be run with a FallbackTemplate for compatibility with existing known extensions while we continue to deprecate them. https://gerrit.wikimedia.org/r/#/c/mediawiki/skins/Vector/+/593070/
- A single PHP class SkinTemplateVector. This will be an intentional breaking change breaking compatibility with any 3rd party skins that are extending SkinVector.