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

[24.5] Use AppId function to delete orphaned extension data AB#557280 #2347

Merged
merged 1 commit into from
Nov 18, 2024
Merged
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
Use AppId function to delete orphaned extension data AB#534788 (#1976)
Problem: Before apps not installed since 14.x might be missing a package
ID. So we are unable to delete them by packageID

Fix: Delete by AppId

Fixes:
[AB#534788](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/534788)
ehenriksen9 committed Nov 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 006c004ba88cdc1179d483e6b21209bedc4b8494
Original file line number Diff line number Diff line change
@@ -52,7 +52,8 @@ codeunit 2500 "Extension Installation Impl"
exit(not NAVAppInstalledApp.IsEmpty());
end;

procedure IsInstalledByAppId(AppID: Guid): Boolean

procedure IsInstalledByAppId(AppId: Guid): Boolean
var
NAVAppInstalledApp: Record "NAV App Installed App";
begin
@@ -207,15 +208,15 @@ codeunit 2500 "Extension Installation Impl"
exit(UninstallExtensionSilently(PackageID, ClearSchema, ClearSchema));
end;

procedure DeleteOrphanData(PackageID: Guid; ExtensionName: Text): Boolean
procedure DeleteOrphanData(AppId: Guid; ExtensionName: Text): Boolean
var
ConfirmManagement: Codeunit "Confirm Management";
begin
CheckPermissions();

if not ConfirmManagement.GetResponse(StrSubstNo(ClearExtensionSchemaOrphanMsg, ExtensionName), false) then exit(false);

exit(UninstallExtensionSilently(PackageID, false, true));
exit(UninstallExtensionSilentlyByAppId(AppId, false, true));
end;

procedure RunOrphanDeletion(OrphanedApplication: Record "Extension Database Snapshot"): Boolean
@@ -226,7 +227,6 @@ codeunit 2500 "Extension Installation Impl"
exit(OrphanedExtensionDetails.RunModal() = Action::OK);
end;


local procedure UninstallExtensionSilently(PackageID: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
begin
CheckPermissions();
@@ -239,6 +239,18 @@ codeunit 2500 "Extension Installation Impl"
exit(true);
end;

local procedure UninstallExtensionSilentlyByAppId(AppId: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
begin
CheckPermissions();
AssertIsInitialized();
DotNetNavAppALInstaller.ALUninstallNavAppByAppId(AppId, ClearData, ClearSchema);

if IsInstalledByAppId(AppId) then
exit(false);

exit(true);
end;

procedure UninstallExtensionWithConfirmDialog(PackageId: Guid; ClearData: Boolean; ClearSchema: Boolean): Boolean
var
PublishedApplication: Record "Published Application";
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ page 2513 "Extn. Orphaned App Details"

trigger OnAction()
begin
ExtensionInstallationImpl.DeleteOrphanData(Rec."Package Id", Rec."Name");
ExtensionInstallationImpl.DeleteOrphanData(Rec."App Id", Rec."Name");
CurrPage.Close();
end;
}