From 4613449b6561d18e8e59ebe52a162a735a2e12a6 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 10 Nov 2015 00:23:14 +0000 Subject: [PATCH] Enable new module versioning for VisualEditorDataModule This module effectively uses it already since this module doesn't add meta data to getDefinitionSummary, but rather adds all of getScript() into the hash, which is exactly what enableModuleContentVersion is for. Using this has the advantage of being well-tested and better cached, as right now the script has to be computed twice (once for the response, and once for the version header), whereas enableModuleContentVersion uses RL's in-process cache. Bug: T102578 Change-Id: I42fb720988b4b4b4310bde238dc321b62866f827 --- VisualEditorDataModule.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/VisualEditorDataModule.php b/VisualEditorDataModule.php index a0c5aebaa0..b390c2d184 100644 --- a/VisualEditorDataModule.php +++ b/VisualEditorDataModule.php @@ -135,25 +135,21 @@ class VisualEditorDataModule extends ResourceLoaderModule { return $citationTools; } - public function getDependencies( ResourceLoaderContext $context = null ) { - return array( - 'ext.visualEditor.base', - 'ext.visualEditor.mediawiki', - ); - } - - public function getDefinitionSummary( ResourceLoaderContext $context ) { - $summary = parent::getDefinitionSummary( $context ); - $summary[] = array( - 'script' => $this->getScript( $context ), - ); - return $summary; - } - protected function getGitHeadHash() { if ( $this->gitHeadHash === null ) { $this->gitHeadHash = $this->gitInfo->getHeadSHA1(); } return $this->gitHeadHash; } + + public function enableModuleContentVersion() { + return true; + } + + public function getDependencies( ResourceLoaderContext $context = null ) { + return array( + 'ext.visualEditor.base', + 'ext.visualEditor.mediawiki', + ); + } }