File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
app/code/Meta/BusinessExtension/Model/System Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -207,17 +207,21 @@ public function getAppId(): string
207
207
*/
208
208
public function getModuleVersion (): string
209
209
{
210
- $ this ->version = (string )($ this ->version ?: $ this ->cache ->load (self ::VERSION_CACHE_KEY ));
211
- if (!$ this ->version ) {
212
- $ installedPackages = $ this ->composerInformation ->getInstalledMagentoPackages ();
213
- $ extensionVersion = $ installedPackages [self ::EXTENSION_PACKAGE_NAME ]['version ' ] ?? null ;
214
- if (!empty ($ extensionVersion )) {
215
- $ this ->version = $ extensionVersion ;
216
- } else {
217
- $ this ->version = 'dev ' ;
218
- }
219
- $ this ->cache ->save ($ this ->version , self ::VERSION_CACHE_KEY , [AppConfig::CACHE_TAG ]);
210
+ $ cachedVersion = $ this ->cache ->load (self ::VERSION_CACHE_KEY );
211
+ if ($ cachedVersion ) {
212
+ // Once we've calculated the version for this session, default to the cached value.
213
+ return $ cachedVersion ;
214
+ }
215
+ $ installedPackages = $ this ->composerInformation ->getInstalledMagentoPackages ();
216
+ // We are now setting the "DEV" version locally as well as via composer to facilitate logging.
217
+ // If there is ever a conflict, we should prefer Composer's value.
218
+ $ officialExtensionVersion = $ installedPackages [self ::EXTENSION_PACKAGE_NAME ]['version ' ] ?? null ;
219
+ if ($ officialExtensionVersion ) {
220
+ $ this ->version = $ officialExtensionVersion ;
221
+ } else {
222
+ $ this ->version = (string )($ this ->version ?: 'dev ' );
220
223
}
224
+ $ this ->cache ->save ($ this ->version , self ::VERSION_CACHE_KEY , [AppConfig::CACHE_TAG ]);
221
225
return $ this ->version ;
222
226
}
223
227
You can’t perform that action at this time.
0 commit comments