Skip to content

Commit 9d1048b

Browse files
author
Alex Paliarush
committed
MAGETWO-62567: Make static file versioning number not based on timestamp
1 parent 5ea676e commit 9d1048b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/code/Magento/Deploy/Console/DeployStaticOptions.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ class DeployStaticOptions
126126
*/
127127
const LANGUAGES_ARGUMENT = 'languages';
128128

129+
/**
130+
* Static content version
131+
*/
132+
const CONTENT_VERSION = 'content-version';
133+
129134
/**
130135
* Deploy static command options list
131136
*
@@ -211,7 +216,14 @@ private function getBasicOptions()
211216
null,
212217
InputOption::VALUE_NONE,
213218
'Create symlinks for the files of those locales, which are passed for deployment, '
214-
. 'but have no customizations'
219+
. 'but have no customizations.'
220+
),
221+
new InputOption(
222+
self::CONTENT_VERSION,
223+
null,
224+
InputArgument::OPTIONAL,
225+
'Custom version of static content can be used if running deployment on multiple nodes '
226+
. 'to ensure that static content version is identical and caching works properly.'
215227
),
216228
new InputArgument(
217229
self::LANGUAGES_ARGUMENT,

app/code/Magento/Deploy/Service/DeployStaticContent.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ public function deploy(array $options)
9696
]
9797
);
9898

99-
$version = (new \DateTime())->getTimestamp();
99+
$version = !empty($options[Options::CONTENT_VERSION]) && is_string($options[Options::CONTENT_VERSION])
100+
? $options[Options::CONTENT_VERSION]
101+
: (new \DateTime())->getTimestamp();
100102
$this->versionStorage->save($version);
101103

102104
$packages = $deployStrategy->deploy($options);

0 commit comments

Comments
 (0)