Skip to content

Commit

Permalink
Merge branch 'hotfix-7.0.2' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicWatson committed Sep 21, 2023
2 parents 8c8fd99 + df53b28 commit dfab459
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.2

* Fix issue where declared extensions dependencies with no min/max version always overwrite previously installed versions (even if a lower version)

## 7.0.1

* Fix issue where dependencies installed in ways other then box.json would be overwritten when marked as a dependency of another extension. Causing issues with the wrong versions of software being installed.
Expand Down
27 changes: 15 additions & 12 deletions interceptors/PresideCommandsPostInstallInterceptor.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,29 @@ component {
try {
var depboxjson = DeserializeJson( FileRead( depBoxJsonLocation ) );
} catch( any e ) {

return false;
}

versionInstalled = depboxjson.version ?: "";
}

if ( Len( Trim( versionInstalled ) ) && ( hasMinVer || hasMaxVer ) ) {
if ( ListLen( versionInstalled, "##@" ) == 2 ) {
versionInstalled = ListRest( versionInstalled, "##@" );
}
if ( ListLen( versionInstalled, "-" ) > 1 ) {
versionInstalled = ListFirst( versionInstalled, "-" );
}
if ( Len( Trim( versionInstalled ) ) ) {
if ( hasMinVer || hasMaxVer ) {
if ( ListLen( versionInstalled, "##@" ) == 2 ) {
versionInstalled = ListRest( versionInstalled, "##@" );
}
if ( ListLen( versionInstalled, "-" ) > 1 ) {
versionInstalled = ListFirst( versionInstalled, "-" );
}

if ( hasMinVer && semanticVersion.compare( dependencyInfo.minVersion, versionInstalled ) == 1 ) {
throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] does not meet the minimum version requirement of [#dependencyInfo.minVersion#]. Please upgrade your [#dependencySlug#] extension to continue." );
}
if ( hasMinVer && semanticVersion.compare( dependencyInfo.minVersion, versionInstalled ) == 1 ) {
throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] does not meet the minimum version requirement of [#dependencyInfo.minVersion#]. Please upgrade your [#dependencySlug#] extension to continue." );
}

if ( hasMaxVer && semanticVersion.compare( versionInstalled, dependencyInfo.maxVersion ) == 1 ) {
throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] exceeds the maximum version requirement of [#dependencyInfo.maxVersion#]. You will need to manually resolve this situation by either downgrading [#dependencySlug#], installing a later version of [#packageSlug#], or getting the package maintainers of [#packageSlug#] to update the package to be compatible with later versions of [#dependencySlug#]." );
if ( hasMaxVer && semanticVersion.compare( versionInstalled, dependencyInfo.maxVersion ) == 1 ) {
throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] exceeds the maximum version requirement of [#dependencyInfo.maxVersion#]. You will need to manually resolve this situation by either downgrading [#dependencySlug#], installing a later version of [#packageSlug#], or getting the package maintainers of [#packageSlug#] to update the package to be compatible with later versions of [#dependencySlug#]." );
}
}

return true;
Expand Down

0 comments on commit dfab459

Please sign in to comment.