Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not include Licensing assembly with framework but prevent uninstall #3657

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Oqtane.Package/Oqtane.Client.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<files>
<file src="..\Oqtane.Client\bin\Release\net8.0\Oqtane.Client.dll" target="lib\net8.0" />
<file src="..\Oqtane.Client\bin\Release\net8.0\Oqtane.Client.pdb" target="lib\net8.0" />
<file src="..\Oqtane.Server\bin\Release\net8.0\Oqtane.Licensing.Client.Oqtane.dll" target="lib\net8.0" />
<file src="icon.png" target="" />
</files>
</package>
1 change: 0 additions & 1 deletion Oqtane.Package/Oqtane.Shared.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<files>
<file src="..\Oqtane.Shared\bin\Release\net8.0\Oqtane.Shared.dll" target="lib\net8.0" />
<file src="..\Oqtane.Shared\bin\Release\net8.0\Oqtane.Shared.pdb" target="lib\net8.0" />
<file src="..\Oqtane.Server\bin\Release\net8.0\Oqtane.Licensing.Shared.Oqtane.dll" target="lib\net8.0" />
<file src="icon.png" target="" />
</files>
</package>
46 changes: 27 additions & 19 deletions Oqtane.Server/Infrastructure/InstallationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,20 @@ public static string InstallPackages(string webRootPath, string contentRootPath)
// register assembly
if (Path.GetExtension(filename) == ".dll")
{
// if package version was not installed previously
if (!File.Exists(Path.Combine(sourceFolder, name + ".log")))
// do not register licensing assemblies
if (!Path.GetFileName(filename).StartsWith("Oqtane.Licensing."))
{
if (assemblies.ContainsKey(Path.GetFileName(filename)))
// if package version was not installed previously
if (!File.Exists(Path.Combine(sourceFolder, name + ".log")))
{
assemblies[Path.GetFileName(filename)] += 1;
}
else
{
assemblies.Add(Path.GetFileName(filename), 1);
if (assemblies.ContainsKey(Path.GetFileName(filename)))
{
assemblies[Path.GetFileName(filename)] += 1;
}
else
{
assemblies.Add(Path.GetFileName(filename), 1);
}
}
}
}
Expand Down Expand Up @@ -255,23 +259,27 @@ public bool UninstallPackage(string PackageName)
// delete assets
if (Path.GetExtension(filepath) == ".dll")
{
// use assembly log to determine if assembly is used in other packages
if (assemblies.ContainsKey(Path.GetFileName(filepath)))
// do not remove licensing assemblies
if (!Path.GetFileName(filepath).StartsWith("Oqtane.Licensing."))
{
if (assemblies[Path.GetFileName(filepath)] == 1)
// use assembly log to determine if assembly is used in other packages
if (assemblies.ContainsKey(Path.GetFileName(filepath)))
{
DeleteFile(filepath);
assemblies.Remove(Path.GetFileName(filepath));
if (assemblies[Path.GetFileName(filepath)] == 1)
{
DeleteFile(filepath);
assemblies.Remove(Path.GetFileName(filepath));
}
else
{
assemblies[Path.GetFileName(filepath)] -= 1;
}
}
else
else // does not exist in assembly log
{
assemblies[Path.GetFileName(filepath)] -= 1;
DeleteFile(filepath);
}
}
else // does not exist in assembly log
{
DeleteFile(filepath);
}
}
else // not an assembly
{
Expand Down
1 change: 0 additions & 1 deletion Oqtane.Server/Oqtane.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.1" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.7" />
<PackageReference Include="Oqtane.Licensing" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />
Expand Down