{"action":"opened","issue":{"url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/2174","repository_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform","labels_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/2174/labels{/name}","comments_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/2174/comments","events_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/2174/events","html_url":"https://github.com/dnnsoftware/Dnn.Platform/issues/2174","id":342806611,"node_id":"MDU6SXNzdWUzNDI4MDY2MTE=","number":2174,"title":"Site Export Gets Stuck on \"In Progress\"","user":{"login":"JTMaher2","id":3793173,"node_id":"MDQ6VXNlcjM3OTMxNzM=","avatar_url":"https://avatars3.githubusercontent.com/u/3793173?v=4","gravatar_id":"","url":"https://api.github.com/users/JTMaher2","html_url":"https://github.com/JTMaher2","followers_url":"https://api.github.com/users/JTMaher2/followers","following_url":"https://api.github.com/users/JTMaher2/following{/other_user}","gists_url":"https://api.github.com/users/JTMaher2/gists{/gist_id}","starred_url":"https://api.github.com/users/JTMaher2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JTMaher2/subscriptions","organizations_url":"https://api.github.com/users/JTMaher2/orgs","repos_url":"https://api.github.com/users/JTMaher2/repos","events_url":"https://api.github.com/users/JTMaher2/events{/privacy}","received_events_url":"https://api.github.com/users/JTMaher2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T16:43:17Z","updated_at":"2018-07-19T16:43:17Z","closed_at":null,"author_association":"NONE","body":"## Description \r\nThe export wizard gets stuck on the \"In Progress\" state. I inspected the source code for DotNetNuke.SiteExportImport.dll, and found that the \"ExportModulePackage(ExportModule exportModule)\" function in \"PagesExportService.cs\" was passing a null desktop module to \"PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == desktopModule.PackageID).\" This was causing an \"Object reference not set to an instance of an object exception\" to be generated, and no further progress to be made.\r\n\r\nFor some reason, the \"ExportModulePackage(ExportModule exportModule)\" is being called for a module that is not present in the \"dbo.DesktopModules\" table. Therefore, when \"DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger)\" is called with this ID, it returns null. Subsequently, the call to \"PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == desktopModule.PackageID)\" generates an exception due to a property being accessed on a null object.\r\n\r\nI worked around this issue by building a custom \"DotNetNuke.SiteExportImport.dll\" with the following code for \"ExportModulePackage(ExportModule exportModule)\":\r\n\r\n    private int ExportModulePackage(ExportModule exportModule)\r\n        {\r\n            if (!_exportedModuleDefinitions.Contains(exportModule.ModuleDefID))\r\n            {\r\n                var packageZipFile = $\"{Globals.ApplicationMapPath}{Constants.ExportFolder}{_exportImportJob.Directory.TrimEnd('\\\\', '/')}\\\\{Constants.ExportZipPackages}\";\r\n                var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(exportModule.ModuleDefID);\r\n                var desktopModuleId = moduleDefinition.DesktopModuleID; // this ID that is not present in dbo.DesktopModules\r\n                var desktopModule = DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger); // Because the ID is not present in dbo.DesktopModules, this returns null\r\n\r\n                // I added this if statement to prevent GetExtensionPackage from throwing an exception\r\n                if (desktopModule != null)\r\n                {\r\n                    var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.PackageID == desktopModule.PackageID);\r\n                    var filePath = InstallerUtil.GetPackageBackupPath(package);\r\n\r\n                    if (File.Exists(filePath))\r\n                    {\r\n                        var offset = Path.GetDirectoryName(filePath)?.Length + 1;\r\n                        CompressionUtil.AddFileToArchive(filePath, packageZipFile, offset.GetValueOrDefault(0));\r\n\r\n                        Repository.CreateItem(new ExportPackage\r\n                        {\r\n                            PackageName = package.Name,\r\n                            Version = package.Version,\r\n                            PackageType = package.PackageType,\r\n                            PackageFileName = InstallerUtil.GetPackageBackupName(package)\r\n                        }, null);\r\n\r\n                        _exportedModuleDefinitions.Add(exportModule.ModuleDefID);\r\n                        return 1;\r\n                    }\r\n                }\r\n            }\r\n            return 0;\r\n        }\r\n## Steps to reproduce\r\n1) Queue a new export for any page on the site.\r\n2) Observe that the export routine never completes.\r\n## Current result\r\nThe export wizard gets stuck, and an incomplete set of files get generated in the \"App_Data/ExportImport/<DATE_AND_TIME>\" folder. The only files that are present are \"export.dnndb\" and \"export_files.zip\".\r\n## Expected result\r\nThe export wizard should complete the export process. A full set of files should be generated in the \"App_Data/ExportImport/<DATE_AND_TIME>\" folder. These should include \"export.json,\" \"export_db.zip,\" \"export_files.zip,\" \"export_packages.zip,\" \"export_templates.zip,\" and \"export_themes.zip.\"\r\n## Affected version\r\n\r\n<!-- Check all that apply and add more if necessary -->\r\n\r\n* [ ] 9.2 <-- My site is not running 9.2, so I don't know if 9.2 is affected.\r\n* [x] 9.1.1\r\n* [ ] 9.1\r\n* [ ] 9.0\r\n\r\n## Affected browser\r\n\r\n<!-- \r\n  Check all that apply and add more if necessary.\r\n  If possible, please also specify exact versions and mention the operating system\r\n-->\r\n\r\n* [x] Chrome <-- I only tested this in Chrome, but I would assume that all other browsers are affected.\r\n* [x] Firefox\r\n* [x] Safari\r\n* [x] Internet Explorer\r\n* [x] Edge\r\n"}}
{"actor":{"display_login":"JTMaher2"}}